Skip to content

Support Python 3.11–3.15 with current mypy and stubtest - #224

Merged
altendky merged 5 commits into
masterfrom
python-311-315-support
Nov 26, 2026
Merged

altendky merged 5 commits into
masterfrom
python-311-315-support

Conversation

@altendky

@altendky altendky commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Require Python 3.11 or newer and test Python 3.11–3.15 on Linux, macOS, and Windows. Upgrade mypy from 0.930 to 2.4.1 and remove the pytest restriction needed by the old checker.

Address current stubtest's repeated discrepancies within the existing per-module stubs and QFlags generation structure:

  • Model the shared SIP wrapper metaclass and a private, type-check-only enum metaclass. Mark runtime enums final while retaining subclassable QFlags wrappers.
  • Declare extension-type layout restrictions and the required typing_extensions dependency.
  • Correct positional-only operator arguments across overloads and preserve those signatures in the existing generator.
  • Make stub-only typing helpers private, correct property callback types and constructor/signal declarations, and add supported reflected geometry operators.
  • Update the QFlags template and 182 generated tests to use exception contexts while retaining their invalid-operator assertions and specialized variants.

Keep coverage boundaries explicit in README and the existing allowlist: unsupported aggregate/tooling modules and four SIP reverse-division slots that return NotImplemented. One exact optional entry handles Python 3.13+ reporting a spurious self parameter for SIP's one-argument dump helper; runtime probes and regression tests verify the real signature. Remove two obsolete allowlist entries. No blanket stubtest suppression is added.

Regression coverage checks subclassability, extension-layout conflicts, enum inference, positional-only arguments, the pointer constructor's keyword, and reflected geometry operations.

Validation:

  • Package type checking and stubtest pass across Python 3.11–3.15 on all three platforms.
  • Each CI matrix job passes stubtest across 87 discovered modules and all 410 tests.
  • Generated QFlags checks independently pass strict mypy (183 sources including the slot example) and runtime tests (363 tests).
  • Diff whitespace checks pass.

The updated CI run passed all 15 matrix jobs and the aggregate check.

Follow-up issues for remaining workarounds and coverage gaps:

@altendky altendky changed the title Support maintained Python versions 3.11 through 3.15 Support Python 3.11–3.15 with current mypy Nov 26, 2026
@altendky altendky changed the title Support Python 3.11–3.15 with current mypy Support Python 3.11–3.15 with current mypy and stubtest Nov 26, 2026
@altendky
altendky merged commit bbb9ce6 into master Nov 26, 2026
16 checks passed
@altendky
altendky deleted the python-311-315-support branch November 26, 2026 01:56
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