Skip to content

Drop Python 3.9 - #165

Merged
martin-s-a merged 3 commits into
mainfrom
drop-python-3.9
Oct 9, 2026
Merged

martin-s-a merged 3 commits into
mainfrom
drop-python-3.9

Conversation

@martin-s-a

Copy link
Copy Markdown
Contributor

Python 3.9 reached its end of life a year ago. The package now requires 3.10.

Three commits, each passing ruff on its own:

  • Require Python 3.10: requires-python, the classifiers, and the pins that existed only for 3.9 (numpy 2.0.2; pytest 8.4.2, which leaves one pytest pin with no marker). The Renovate rules that capped those two pins, the 3.9 entries of the test matrix, and 3.9 in Sonar's analysed versions go with them. cibuildwheel reads requires-python, so it stops building cp39 wheels without any change to deploy.yml.
  • Write the code for Python 3.10: ruff targets py310. DeviceSpec, a union built at import time rather than an annotation, becomes X | Y instead of typing.Union. The numpy_speaks_dlpack_1 mark goes: it skipped tests where numpy predates 2.1, and the oldest numpy left is 2.2.6. zip() in check_wheels_agree.py gains strict=True, which ruff now asks for; the lengths are compared just before.
  • Stop describing the project as built for Python 3.9: AGENTS.md. The rule for from __future__ import annotations keeps the import but gives its actual reason: annotations are never evaluated at import, so em/image/_functions.py can name numpy, which it imports only under TYPE_CHECKING.

DeviceSpec is evaluated when the package is imported, so the test matrix is what proves the union builds on pybind11's classes.

🤖 Generated with Claude Code

martin-s-a and others added 3 commits October 9, 2026 21:20
Python 3.9 reached its end of life a year ago and is no longer supported.
The package now asks for 3.10 or later, which also stops cibuildwheel from
building cp39 wheels, since it reads requires-python.

The pins that existed only for 3.9 go with it: numpy 2.0.2, and pytest 8.4.2,
which leaves a single pytest pin with no marker. So do the Renovate rules that
capped those two pins, the 3.9 entries of the test matrix, and 3.9 in the
versions Sonar analyses for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ruff now targets py310, and the two things written that way only for 3.9 go:

- DeviceSpec is a union built at import time rather than an annotation, which
  3.9 could only spell with typing.Union. It is now X | Y.
- The numpy_speaks_dlpack_1 mark skipped three tests where numpy predates 2.1.
  The oldest numpy left is 2.2.6, for 3.10, so the mark never skipped anything.

zip() in check_wheels_agree.py gains strict=True, which 3.10 introduced and
ruff now asks for. The lengths are compared just before, so it states what the
loop already relies on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The rule for `from __future__ import annotations` gave 3.9 as its reason.
  The import is still needed, now for what it actually does: no annotation is
  evaluated at import, so a module can name what it imports only for type
  checking, as em/image/_functions.py does with numpy.
- The numpy pins start at 2.2 now, all of which speak versioned DLPack, so the
  mark that skipped tests on 3.9 is gone from the description too.
- The test matrix runs 3.10 through 3.14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@martin-s-a martin-s-a added the enhancement New feature or request label Oct 9, 2026
@martin-s-a martin-s-a self-assigned this Oct 9, 2026
@martin-s-a
martin-s-a enabled auto-merge (squash) October 9, 2026 19:30

@ratolon ratolon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, no 3.9

@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@martin-s-a
martin-s-a merged commit 661ebc4 into main Oct 9, 2026
43 checks passed
@martin-s-a
martin-s-a deleted the drop-python-3.9 branch October 9, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants