Skip to content

Drop Python 3.11 support; use PEP 695 type parameters - #91

Merged
timmens merged 3 commits into
boilerplate-update-py315from
drop-py311
Nov 19, 2026
Merged

timmens merged 3 commits into
boilerplate-update-py315from
drop-py311

Conversation

@hmgaudecker

Copy link
Copy Markdown
Member

Stacked on #90.

Why

numpy requires Python >=3.12 from 2.5 on; 2.4 was the last line to allow 3.11. networkx 3.7 and jax 0.12 require >=3.12 as well. The py311 environment could therefore only ever resolve networkx 3.6.1 and numpy 2.4, so that CI job tested a frozen dependency set.

What

  • requires-python = ">=3.12"; the py311 pixi feature, environment, classifier and CI matrix entry are gone.
  • Generic functions declare their type parameters with PEP 695 syntax (def with_signature[**P, R](...)). The module-level ParamSpec, TypeVar and TypeVarTuple objects are no longer needed, so dags.typing is removed and dags.tree.typing loses T.

dags.typing only held those four type variables. ttsim, gettsim, gettsim-personas and pylcm do not import it.

Checks

Hooks (including ty) pass; 172 tests pass on each of py312, py313, py314 and py315.

https://claude.ai/code/session_01K77bhqW4p5VmpnXm4hkZ77

hmgaudecker and others added 3 commits November 17, 2026 17:59
Follows numpy, which requires Python >=3.12 from 2.5 on (2.4 was the last
line to allow 3.11). networkx 3.7 and jax 0.12 require >=3.12 as well, so
the py311 environment could only ever resolve networkx 3.6.1 and numpy 2.4.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K77bhqW4p5VmpnXm4hkZ77
Generic functions name their type parameters in the signature, so the
module-level ParamSpec, TypeVar and TypeVarTuple objects in dags.typing
and dags.tree.typing are no longer needed. dags.typing is removed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K77bhqW4p5VmpnXm4hkZ77
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K77bhqW4p5VmpnXm4hkZ77
@hmgaudecker
hmgaudecker requested a review from timmens November 17, 2026 17:00
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.52%. Comparing base (8c680cc) to head (fec62bf).

Additional details and impacted files
@@                     Coverage Diff                      @@
##           boilerplate-update-py315      #91      +/-   ##
============================================================
- Coverage                     96.54%   96.52%   -0.03%     
============================================================
  Files                            27       26       -1     
  Lines                          1391     1382       -9     
============================================================
- Hits                           1343     1334       -9     
  Misses                           48       48              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

MImmesberger pushed a commit to ttsim-dev/ttsim that referenced this pull request Nov 17, 2026
## Why

numpy requires Python >=3.12 from 2.5 on; 2.4 was the last line to allow
3.11. networkx 3.7 and jax 0.12 require >=3.12 as well, so the `py311`
environment could only resolve an ageing dependency set. dags drops 3.11
in OpenSourceEconomics/dags#91.

## What

- `requires-python = ">=3.12"`; the `py311` pixi feature, environment
and classifier are gone.
- CI: the `py311` job is gone, and the `exclude` list is replaced by a
shorter `include` list. Job names are unchanged.
- `RoundingSpec.apply_rounding` and `cast_ttsim_unit` declare their type
parameters with PEP 695 syntax.
- The generic classes (`InterfaceFunction`, `ColumnFunction`,
`ParamFunction`) keep `Generic[...]` and their `@no_type_check` on
`__call__`. I tried the PEP 695 form: beartype cannot resolve class type
parameters in stringified annotations, so the package fails at import.
`_set_single_field` keeps its `TypeVar` because its forward-referenced
bound fails under beartype on 3.12 and 3.13. The ruff ignores for UP046
and UP047 stay, with these reasons.
- `test_python_version` is removed; `requires-python` enforces the
floor.
- `pixi.lock` is regenerated. Besides losing the `py311` environments,
the changed `requires-python` re-resolved the PyPI packages, so several
move forward (for example networkx 3.7).

## Checks

Hooks pass. Tests pass on py312, py313 and py314 (1742 passed, 58
skipped) and on py314-jax (1770 passed, 30 skipped).

https://claude.ai/code/session_01K77bhqW4p5VmpnXm4hkZ77

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
MImmesberger pushed a commit to ttsim-dev/gettsim that referenced this pull request Nov 18, 2026
## Why

numpy requires Python >=3.12 from 2.5 on; 2.4 was the last line to allow
3.11. networkx 3.7 and jax 0.12 require >=3.12 as well, so the `py311`
environment could only resolve an ageing dependency set. dags drops 3.11
in OpenSourceEconomics/dags#91.

## What

- `requires-python = ">=3.12"`; the `py311` pixi feature, environment
and classifier are gone.
- CI: the `py311` job is gone, and the `exclude` list is replaced by a
shorter `include` list. Job names are unchanged.
- `test_python_version` is removed; `requires-python` enforces the
floor.
- GEP 9 names 3.12–3.13 as the versions that still need `from __future__
import annotations`.
- `pixi.lock` is regenerated. Besides losing the `py311` environments,
the changed `requires-python` re-resolved the PyPI packages, so several
move forward (for example networkx 3.7).

## Checks

Hooks pass. Tests pass on py312 and py314 (1341 passed, 568 skipped
each).

https://claude.ai/code/session_01K77bhqW4p5VmpnXm4hkZ77

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
MImmesberger added a commit to ttsim-dev/gettsim-personas that referenced this pull request Nov 18, 2026
## Why

numpy requires Python >=3.12 from 2.5 on; 2.4 was the last line to allow
3.11. networkx 3.7 and jax 0.12 require >=3.12 as well, so the `py311`
environment could only resolve an ageing dependency set. dags drops 3.11
in OpenSourceEconomics/dags#91.

## What

- `requires-python = ">=3.12"`; the `py311` pixi feature, environment
and classifier are gone.
- `AGENTS.md` lists the remaining environments.
- `pixi.lock` is regenerated. Besides losing the `py311` environments,
the changed `requires-python` re-resolved the PyPI packages, so several
move forward (for example networkx 3.7).

## Checks

Hooks pass. Tests pass on py312 and py314 (545 passed, 4 skipped each).

https://claude.ai/code/session_01K77bhqW4p5VmpnXm4hkZ77

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: MImmesberger <74215010+MImmesberger@users.noreply.github.com>
@timmens
timmens merged commit 4f09265 into boilerplate-update-py315 Nov 19, 2026
22 checks passed
@timmens
timmens deleted the drop-py311 branch November 19, 2026 00:01
hmgaudecker added a commit that referenced this pull request Nov 23, 2026
…-code hook (#90)

* Update boilerplate, add Python 3.15, run ty as a prek hook

- Python 3.15: py315 environment, CI matrix entry, classifier, requires-python
  bound, max_supported_python; pixi.lock regenerated (lock format v7).
- ty runs as the ty-pre-commit hook against the py314 pixi env; the
  type-checking environment and ty task are gone.
- Hook and action versions refreshed; template hooks added (codespell,
  pixi-lock-check, pre-push-hooks-installed, notebook-cell-source-format,
  no-hardcoded-user-paths, no-section-separator-comments,
  no-internal-references).
- CLAUDE.md and GEMINI.md removed; AGENTS.md is the only instruction file.
- .ai-instructions bumped, and excluded from ty.
- Fixes the new hook versions demanded: a doubly unpacked TypeVarTuple in
  output.py, renamed ty rules, RUF036 union order, a README typo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Adopt the dead-code hook; drop test-only _is_python_identifier

Adds the vulture-based dead-code hook from .ai-instructions, its
[tool.dead-code] table (src/dags/ as public API), its ci.skip entry and a
run-ty CI step with the submodule checked out.

Its first run reported _is_python_identifier in tree_utils.py as used only by
tests. Nothing in dags or the gettsim workspace calls it, so it goes, with its
regex constant and its test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Require prek>=0.5.9 so CI can install the ty hook

The lock held prek 0.3.4, whose bundled uv 0.10.2 cannot parse
ty-pre-commit's pyproject.toml (dependency tables with hashes), so the
run-ty job failed while installing the hook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Require jupyter-book>=2.1.7 and mystmd>=1.13.0 for the docs build

The build fetches the newest MyST book theme, which no longer supports
mystmd 1.8.2; the old engine reports the mismatch and then hangs, so Read the
Docs kills the build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Drop Python 3.11 support; use PEP 695 type parameters (#91)

* Clarify code analysis checks and consolidate changelog entry

* Bump pyproject-fmt, ruff, ty and nbstripout hooks

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K77bhqW4p5VmpnXm4hkZ77

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: timmens <mensingertim@gmail.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.

2 participants