Repository navigation
build: migrate to pyproject.toml - #264
Conversation
Replace setup.py and the requirements*.txt files with PEP 621 metadata in pyproject.toml (setuptools backend). Distribution name, import package and the `dev` and `docs` extras are unchanged. - declare `requires-python = ">=3.10"` (3.9 is end of life) - ship `py.typed` inside the package so the "Typed" classifier holds - package only `foca*`, so `tests` is no longer installed into site-packages; configure pytest `pythonpath` so tests still import - declare `typing_extensions` as a runtime dependency (it is imported by `foca.models.config`) - drop the obsolete `typing` backport and the unused `toml`, `mypy-extensions`, `types-urllib3`, `types-setuptools`, `pylint`, `python-semantic-release` and `readthedocs-sphinx-ext` - drop `setup_requires` and the setuptools-git based MANIFEST.in - remove the stale semantic-release config from setup.cfg; move the mypy config to pyproject.toml (flake8 config stays in setup.cfg until ruff replaces it) - install FOCA directly from the source tree in the Docker image Closes #232 Co-Authored-By: Claude Opus 5.5 <[email protected]>
FOCA now requires Python >= 3.10. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideMigrates FOCA from setup.py and requirements files to setuptools-backed PEP 621 metadata in pyproject.toml, preserving the distribution name, versioning, extras, and dependency versions while tightening package discovery and resource inclusion. The change also makes Python 3.10 the minimum supported version, explicitly declares typing_extensions, relocates tool configuration, and updates Docker and CI to use the new packaging flow. Flow diagram for Docker installation from the source treeflowchart LR
Docker[Docker build]
Inputs[pyproject.toml and foca source]
Pip[pip install .]
Image[Runtime image with FOCA and dependencies]
Docker --> Inputs
Inputs --> Pip
Pip --> Image
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #264 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 1113 1113
=========================================
Hits 1113 1113
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
No blocking issues were identified in the packaging migration or its Docker and CI integration.
No open issues 🎉
What changed in this PR
Migrates FOCA packaging to setuptools-backed pyproject.toml, preserving the distribution name and extras while requiring Python 3.10+.
Changes:
- Consolidates package metadata, dependencies, and tool configuration.
- Limits installed packages to
focaand includes typing and access-control data. - Updates Docker installation and removes Python 3.9 from CI.
| File | Description |
|---|---|
setup.py |
Removes legacy packaging configuration. |
setup.cfg |
Retains only flake8 configuration. |
requirements.txt |
Moves runtime dependencies to project metadata. |
requirements_docs.txt |
Moves retained documentation dependencies to extras. |
requirements_dev.txt |
Moves retained development dependencies to extras. |
pyproject.toml |
Defines packaging, dependencies, and tool settings. |
MANIFEST.in |
Explicitly includes source-distribution test assets. |
foca/py.typed |
Places the typing marker inside the package. |
docker/Dockerfile |
Installs FOCA directly from source. |
.github/workflows/checks.yml |
Removes Python 3.9 matrix entries. |
Review effort: Balanced
Resolve conflicts with the squash-merged #264, #265 and #266: - CI workflow: keep linting and format checks with ruff from this branch, take the commit-timestamp Docker tags from dev. - Release workflow: take the release commit check and skip-existing uploads from dev. - pyproject.toml: keep ruff and pre-commit instead of flake8 in the dev extra. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
First PR of the v0.14.0 maintenance series: move packaging from
setup.py+requirements*.txtto PEP 621 metadata inpyproject.toml(setuptools backend). Dependency versions are unchanged here; they are updated in the next PR.pyproject.tomlwith static metadata; version still read fromfoca/version.pyrequires-python = ">=3.10"(Python 3.9 is EOL); Python 3.9 removed from the CI matricespy.typedmoved into the package, so it is actually shipped (previously the "Typing :: Typed" classifier was not true)foca*is packaged:testsis no longer installed as a top-level package into site-packages; pytest getspythonpath = ["."]so the test suite still importstests.*typing_extensionsdeclared as runtime dependency (imported infoca/models/config.py, previously only pulled in via pydantic)typingbackport, unusedtoml; unused dev/docs deps (mypy-extensions,types-urllib3,types-setuptools,pylint(not run in CI),python-semantic-release,readthedocs-sphinx-ext);setup_requires; setuptools-git basedMANIFEST.in; stale[semantic_release]config (pointed atmasterand a non-existent version variable)pyproject.toml; flake8 config stays insetup.cfguntil ruff replaces flake8 (later PR)Distribution name, import package and the
dev/docsextras are unchanged, sopip install foca[dev]keeps working (unlike the Poetry approach in #251, whose ideas this supersedes; thanks @JaeAeich).Closes #232
Verification
Locally (Python 3.12, uv):
uv build: sdist and wheel build; wheel containsfoca/py.typedand access-control package data,top_level.txtis onlyfoca, metadata hasRequires-Python: >=3.10and the same runtime requirements as before (minustyping/toml, plustyping_extensions)pip install -e .[dev,docs], thenflake8: clean;mypy foca: no issues in 32 filespytest(unit tests without MongoDB): 246 passedsphinx-build docs/api: succeedsNot run locally (no MongoDB/Docker access in my environment): MongoDB-dependent tests (
test_adapter.py,test_access_control_server.py,test_check_permission_*), Docker image build and petstore integration test; these are covered by CI.CI: all checks pass (run): lint, mypy and unit tests incl. MongoDB-dependent tests on Python 3.10–3.12 × MongoDB 4.4–7.0, petstore integration tests, Docker builds (3.10–3.12), Codecov, Read the Docs.
Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Migrate project packaging and dependency management to a modern setuptools-based
pyproject.tomlconfiguration while dropping Python 3.9 support.New Features:
pyproject.toml.Bug Fixes:
typing_extensionsas an explicit runtime dependency and ensure only thefocapackage is installed.Enhancements:
pyproject.tomlwhile preserving existing development and documentation installation extras.Build:
setup.pyand requirements files with a setuptools-basedpyproject.tomlbuild configuration.Chores: