Skip to content

chore: remove the Python 3.10 Self shims and use tomllib in a test - #261

Merged
petercorke merged 3 commits into
mainfrom
chore/drop-python310-shims
Nov 23, 2026
Merged

petercorke merged 3 commits into
mainfrom
chore/drop-python310-shims

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Python 3.10 was dropped in PR 174 (requires-python = ">=3.11"), but the code still carried the shims for it. No behaviour change.

  • Seven modules (ImageColor, ImageIO, ImageMorph, ImageMultiview, ImageReshape, ImageTensor and _image_typing) chose between typing.Self and typing_extensions.Self: six with if sys.version_info >= (3, 11), and ImageReshape with try/except ImportError. They now from typing import Self, and the import sys lines that this leaves unused are gone.
  • tests/test_entry_points.py parsed pyproject.toml with a regex, and its docstring said why: tomllib is only in the standard library from Python 3.11 and the package supported 3.10. It now uses tomllib.

I left the typing_extensions entry in the JupyterLite bootstrap package list (docs/notebooks/_mvtb_nb_bootstrap.py). That is installed for Pyodide and is not this shim.

Stacked on PR 260 (annotate ImageIO), since both change the import lines at the top of ImageIO.py, so PR 260 has to merge first.

mypy reports no issues, ruff format is clean, and the full suite passes (2158 passed, 33 skipped).

AI-assisted: written with Claude Code (Claude Sonnet 5.5) and reviewed by the maintainer.

🤖 Generated with Claude Code

petercorke and others added 2 commits November 23, 2026 18:37
Part of Issue 60. Types showwindow(h, ax), the Window helper class and the
stereo Cursor class, and gives the mixin a docstring. Drops a :type: line that
the signature now gives.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Python 3.10 was dropped in PR 174, but seven modules still chose between
typing.Self and typing_extensions.Self (six with sys.version_info, ImageReshape
with try/except ImportError). They import Self from typing. The entry-points
test parsed pyproject.toml with a regex because tomllib was missing in 3.10,
and now uses tomllib.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke
petercorke merged commit 173cbc5 into main Nov 23, 2026
32 checks passed
@petercorke
petercorke deleted the chore/drop-python310-shims branch November 23, 2026 09:47
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