Skip to content

Comments

refactor: migrate to src layout and add linting/type-checking configs#6

Draft
mortenoh wants to merge 27 commits intomainfrom
refactor/src-layout-and-linting-config
Draft

refactor: migrate to src layout and add linting/type-checking configs#6
mortenoh wants to merge 27 commits intomainfrom
refactor/src-layout-and-linting-config

Conversation

@mortenoh
Copy link
Member

@mortenoh mortenoh commented Feb 24, 2026

Summary

  • Migrate from flat layout (main.py at root) to src/eo_api/ package layout
  • Add ruff, mypy, and pyright configurations to pyproject.toml
  • Add ruff, mypy, pyright as dev dependencies with make lint target
  • Split main.py into routers (cog, ogcapi) with Pydantic response models
  • Add explicit TilerFactory configuration with inline documentation
  • Document pygeoapi YAML-based configuration system in ogcapi.py
  • Add docs/ogcapi.md reference guide covering OGC API standards, pygeoapi configuration, resource types, and plugin system
  • Add pytest with initial test suite and make test target
  • Add GitHub Actions CI workflow (lint + test on push/PR to main)
  • Pin Python version to 3.13 via .python-version
  • Add uv_build build system and make help as default target
  • Add CLAUDE.md with commit conventions
  • Add /health endpoint with Status StrEnum for Docker container health checks
  • Add Dockerfile and docker Makefile targets
  • Add /info endpoint returning app/Python/titiler/pygeoapi/uvicorn versions
  • Tag root endpoints (/, /health, /info) as "System" in OpenAPI docs
  • Add compose.yml with env_file, port mapping, and restart policy
  • Replace docker-build/docker-run Makefile targets with docker-up/docker-down using docker compose
  • Add make openapi target from main

Test plan

  • make lint passes
  • make test passes
  • CI workflow runs successfully on PR
  • make run starts the app correctly with new module path
  • GET /info returns expected version JSON
  • /docs shows root endpoints grouped under "System" tag
  • docker compose config validates successfully
  • make docker-up builds and starts the container

Move main.py into src/eo_api/ package layout. Add ruff, mypy, and
pyright configurations to pyproject.toml. Update Makefile and README
with new module path. Add ruff, mypy, pyright as dev dependencies.
@mortenoh mortenoh marked this pull request as draft February 24, 2026 17:48
Add build-system config using uv_build backend so the src layout
package installs correctly. Add make help as default target.
Extract route definitions into dedicated router modules (routers/root.py,
routers/cog.py) and add Pydantic schemas (schemas.py). Clean up main.py
by removing noisy comments, fixing the load_dotenv() placement, and
switching to fastapi.middleware.cors.
…router

Rename the generic MessageResponse model to StatusMessage for clarity.
Move the pygeoapi mount into its own router module for future configuration.
@mortenoh mortenoh force-pushed the refactor/src-layout-and-linting-config branch from 17bea73 to 71c5bc1 Compare February 24, 2026 18:07
Add containerized deployment with uv base image, non-root user,
and healthcheck. Include .dockerignore and docker-build/docker-run
Make targets.
Add __version__ to eo_api package, an AppInfo schema, and a GET /info
endpoint returning app/Python/titiler/pygeoapi/uvicorn versions. Tag all
root router endpoints with "System" for OpenAPI grouping.
Replace docker-build/docker-run with docker-up/docker-down targets
that use docker compose for declarative container management.
Shell-form CMD runs under /bin/sh which doesn't forward SIGTERM,
causing exit code 137 on Ctrl-C. Tini as PID 1 fixes this.
Move plugins/ from repo root into src/eo_api/routers/ogcapi/plugins/,
convert ogcapi.py into a package, rename dhis2orgUnits.py to snake_case,
fix mutable default args, add missing self param, and add docstrings.
Update pygeoapi-config.yml provider paths accordingly.
GET /ogcapi/collections/dhis2-org-units/items/{id} returned 500 because
the provider didn't override BaseProvider.get(), which raises
NotImplementedError. Add a stub get() that returns a single hardcoded
GeoJSON Feature, consistent with the existing query() stub.
Replace stub data in DHIS2OrgUnitsProvider with live API calls to the
DHIS2 play server. Use Pydantic for response validation and
geojson-pydantic for GeoJSON output. Fields: name, code, shortName,
level, openingDate, geometry.
Add OrgUnitProperties Pydantic model and derive get_fields() from its
JSON Schema so the /schema endpoint receives {"type": "string"} dicts
instead of plain strings. Rename Makefile docker targets to start/restart.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant