chore: add .python-version so Snyk resolves deps correctly#11
chore: add .python-version so Snyk resolves deps correctly#11ryanmcmillan merged 1 commit intomainfrom
Conversation
Snyk resolves deps as Python 3.7.17 by default, causing importlib-metadata backport to be included in the dep tree. This pins Python 3.14 so Snyk resolves correctly using stdlib importlib.metadata (no zipp transitive).
Greptile SummaryThis PR adds a
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Snyk scans repo] --> B{.python-version present?}
B -- No --> C[Snyk assumes Python 3.7.17]
B -- Yes --> D[Snyk uses Python 3.14]
C --> E[importlib-metadata backport required for pydantic and sqlalchemy]
D --> F[stdlib importlib.metadata used - no backport needed]
E --> G[zipp 3.15.0 pulled in as transitive dep]
F --> H[zipp never pulled in]
G --> I[CVE-2024-5569 flagged]
H --> J[No CVE - clean scan]
Last reviewed commit: "chore: add .python-v..." |
| @@ -0,0 +1 @@ | |||
| 3.14 No newline at end of file | |||
There was a problem hiding this comment.
CI matrix does not include Python 3.14
The .python-version file pins local development (and Snyk resolution) to Python 3.14, which correctly matches the Dockerfile (python:3.14.3-slim). However, the CI workflow in .github/workflows/ci.yml only tests against ['3.10', '3.11', '3.12'].
This means:
- Developers using
pyenvwill run Python 3.14 locally based on this file. - CI validates a different set of Python versions (3.10–3.12), none of which match the production runtime.
If Python 3.14-specific behaviour (e.g. deprecations, removed APIs) causes a regression, it won't be caught by CI. Consider adding 3.14 to the CI matrix to keep local dev, CI, and production in sync:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.14']
Root Cause
Snyk is resolving dependencies as Python 3.7.17 (visible in project settings). At Python 3.7, packages like pydantic and sqlalchemy need the
importlib-metadatabackport, which pullszipp@3.15.0(CVE-2024-5569).On Python 3.9+, these packages use stdlib
importlib.metadataand never touch zipp.Fix
Add
.python-versionfile set to3.14so Snyk resolves the dependency tree with the correct Python version. Our Dockerfile runspython:3.14.3-slim.