Skip to content

Support Python 3.11 as well as 3.12 - #38

Open
shaunr0b wants to merge 1 commit into
RSNA:masterfrom
shaunr0b:python-3.11-support
Open

Support Python 3.11 as well as 3.12#38
shaunr0b wants to merge 1 commit into
RSNA:masterfrom
shaunr0b:python-3.11-support

Conversation

@shaunr0b

Copy link
Copy Markdown

What

Widens the supported Python range from >=3.12.0,<3.13.0 to >=3.11.0,<3.13.0.

Why

Nothing in src/ requires 3.12. Every file in the tree parses under the 3.10 grammar, and the newest stdlib feature used anywhere is enum.StrEnum (3.11) in src/anonymizer/view/series.py. There is no 3.12-only syntax or API in use — no itertools.batched, typing.override, TypeAliasType, Path.walk, or sys.monitoring. The floor is simply tighter than the code needs, which keeps 3.11 users off the package for no reason.

Changes

  • pyproject.tomlpython = ">=3.11.0,<3.13.0", and ruff target-version = "py311" so linting matches the real minimum.
  • poetry.lock — regenerated. No runtime dependency versions change. The only additions are three dev-group backports gated on markers = "python_version == \"3.11\"" (importlib-metadata, zipp, backports-tarfile), so a 3.12 install resolves exactly as it did before.
  • .github/workflows/tests.yaml — matrix over 3.11 and 3.12, so both stay verified.
  • readme.md — states the supported range, and corrects the 3.13 note (see below).

Verification

Every one of the 133 locked packages was audited against 3.11: each either declares a compatible requires-python and ships a usable wheel (pure-python, abi3, or cp311), or is sdist-only. Zero blockers. The decompression stack is at exact parity — numpy 1.26.4, pylibjpeg-libjpeg, pylibjpeg-openjpeg and pylibjpeg-rle all ship the same number of cp311 and cp312 wheels.

Full suite green on both legs (147 passed, 6 skipped on 3.11).

Pre-existing test flakiness, noted in passing

My first matrix run failed on the 3.11 leg — test_export_4_patients_to_test_pacs, assert len(dirlist) == 4 returning 2. Re-running the same commit passed, and I don't believe it's version-related: the assertion sits behind a hardcoded time.sleep(1) after asynchronous SCP writes, so the last sends are the ones a slow runner loses.

For what it's worth, master's own CI run at f5fadcc shows the same class of failure on 3.12 — test_send_ct_Archibald_Doe_mr_Peter_Doe_then_delete_studies, assert Totals(..., instances=3) == (1, 1, 1, 4), 1 failed, 146 passed, 6 skipped. Different test, same shape: an expected-count assertion coming up short. Happy to open a separate issue if that's useful.

On the readme's 3.13 note

The readme currently attributes the 3.13 exclusion to pytorch. That is no longer the binding constraint — torch has shipped cp313 wheels since 2.5, and the locked 2.7.1 has them. The actual blocker is the numpy = "<2.0.0" pin: the last release under 2.0 is 1.26.4, which has no cp313 wheels. I've updated the readme to say so, and left the numpy pin alone — lifting it is a bigger question than this PR.

Not included

  • V19 carries the same requires-python = ">=3.12.0,<3.13.0" under its uv/PEP 621 setup. Glad to port this there as well if you'd like it.
  • The de/es/fr readmes still say 3.12; I left the translations to whoever maintains them.

🤖 Generated with Claude Code

Nothing in src/ requires 3.12: every file parses under the 3.10 grammar, and
the newest stdlib feature used is enum.StrEnum (3.11). The floor was tighter
than the code needs, which keeps 3.11 users off the package for no reason.

- pyproject: python = ">=3.11.0,<3.13.0"; ruff target-version = "py311" so
  linting matches the real minimum
- poetry.lock: regenerated. No runtime dependency version changes; the only
  additions are three dev-group backports gated on python_version == "3.11"
- tests.yaml: matrix over 3.11 and 3.12 so both stay verified
- readme: state the supported range, and correct the 3.13 note — the blocker
  is the pinned numpy <2.0.0 (last release 1.26.4, no cp313 wheels), not
  pytorch, which has shipped cp313 wheels since 2.5

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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