Skip to content

chore: Migrate to numpy 2.x, pydantic 2.13, and target Python 3.12-3.14#143

Merged
tlambert03 merged 19 commits into
mainfrom
numpy2-py312-modernization
Jun 24, 2026
Merged

chore: Migrate to numpy 2.x, pydantic 2.13, and target Python 3.12-3.14#143
tlambert03 merged 19 commits into
mainfrom
numpy2-py312-modernization

Conversation

@tlambert03

@tlambert03 tlambert03 commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Closes #133
Closes #136
Closes #137

numpy 2.x compatibility:

  • _simple_psf: cast 0-d xarray bounds to float before np.linspace (numpy>=2 array_wrap rewraps into a mismatched Variable)
  • fft/convolve: accept (and ignore) the xp arg scipy>=1.15 added to _apply_conv_mode
  • _data_array/simulation: coerce jax arrays to contiguous numpy before zarr write (numcodecs uses np.array(copy=False), strict on numpy>=2)
  • spectrum: np.trapz -> np.trapezoid (removed in numpy 2.0)
  • mypy-under-numpy-2 cleanups; ignore xarray's import-time timedelta warning

pydantic 2.13:

  • space: convert deprecated classmethod-style model_validator(mode="after") to an instance method

Python 3.12-3.14:

  • requires-python >=3.12; CI matrix -> 3.12/3.13/3.14; classifiers updated
  • drop dm-tree (replace its sole tree.map_structure use in vendored xarray_jax with a local helper, mirroring upstream)
  • per-python min pins for compiled deps (numpy/scipy/tensorstore/pydantic/ matplotlib) reflecting first cp31x wheels; pyopengl-accelerate gated <3.14
  • test_docs: give exec() a shared namespace (PEP 667 ended locals leak on 3.13)
  • skip matplotlib plotting on 3.14 (upstream ax.plot deepcopy recursion)

dependabot Bot and others added 4 commits April 1, 2026 14:46
Bumps the actions group with 2 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/download-artifact](https://github.com/actions/download-artifact).


Updates `actions/upload-artifact` from 6 to 7
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v6...v7)

Updates `actions/download-artifact` from 7 to 8
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v7...v8)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
updates:
- [github.com/abravalheri/validate-pyproject: v0.24.1 → v0.25](abravalheri/validate-pyproject@v0.24.1...v0.25)
- [github.com/adhtruong/mirrors-typos: v1.41.0 → v1.47.0](adhtruong/mirrors-typos@v1.41.0...v1.47.0)
- [github.com/astral-sh/ruff-pre-commit: v0.14.10 → v0.15.15](astral-sh/ruff-pre-commit@v0.14.10...v0.15.15)
- [github.com/pre-commit/mirrors-mypy: v1.19.1 → v2.1.0](pre-commit/mirrors-mypy@v1.19.1...v2.1.0)
numpy 2.x compatibility:
- _simple_psf: cast 0-d xarray bounds to float before np.linspace
  (numpy>=2 __array_wrap__ rewraps into a mismatched Variable)
- fft/convolve: accept (and ignore) the `xp` arg scipy>=1.15 added to
  _apply_conv_mode
- _data_array/simulation: coerce jax arrays to contiguous numpy before
  zarr write (numcodecs uses np.array(copy=False), strict on numpy>=2)
- spectrum: np.trapz -> np.trapezoid (removed in numpy 2.0)
- mypy-under-numpy-2 cleanups; ignore xarray's import-time timedelta warning

pydantic 2.13:
- space: convert deprecated classmethod-style model_validator(mode="after")
  to an instance method

Python 3.12-3.14:
- requires-python >=3.12; CI matrix -> 3.12/3.13/3.14; classifiers updated
- drop dm-tree (replace its sole tree.map_structure use in vendored
  xarray_jax with a local helper, mirroring upstream)
- per-python min pins for compiled deps (numpy/scipy/tensorstore/pydantic/
  matplotlib) reflecting first cp31x wheels; pyopengl-accelerate gated <3.14
- test_docs: give exec() a shared namespace (PEP 667 ended locals leak on 3.13)
- skip matplotlib plotting on 3.14 (upstream ax.plot deepcopy recursion)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.66%. Comparing base (9ce8041) to head (2c65537).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/microsim/schema/spectrum.py 50.00% 1 Missing ⚠️
src/microsim/util.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #143      +/-   ##
==========================================
+ Coverage   83.57%   83.66%   +0.08%     
==========================================
  Files          47       47              
  Lines        3026     3036      +10     
==========================================
+ Hits         2529     2540      +11     
+ Misses        497      496       -1     

☔ 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.

tlambert03 and others added 10 commits June 22, 2026 08:53
- Added a constraint for pillow to require version >=11.3.0 for Python 3.14 and above in pyproject.toml.
- Updated uv.lock to reflect the new pillow versioning, including separate entries for versions 11.2.1 and 12.2.0 based on Python version.
- Modified _client.py to handle HTTPError properly when fetching Supabase URL and key.
- uv.lock: full upgrade so transitive deps (pandas, etc.) move to versions
  shipping cp314 wheels (old pins source-built and failed on linux/windows 3.14)
- pyproject: ignore ResourceWarning / PytestUnraisableExceptionWarning — py3.14's
  GC surfaces unclosed sockets from third-party network clients (supabase/s3fs)
  as fatal warnings under filterwarnings=error
- tests/_util: close the internet-check socket (another leaked-socket source)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nned 0.45.3)

The full lock upgrade bumped griffe-fieldz to 0.5.0, which imports DocstringAttribute
from griffe (only in newer griffe), breaking the strict mkdocs build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
supabase>=2.31 passes now-deprecated timeout/verify/proxy params to its postgrest
client, which filterwarnings=error promoted to fatal errors in every COSEM test
(the query itself works fine outside pytest).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Hypothesis: coverage's C tracer exits non-zero at interpreter teardown on
Windows with the bumped C-extensions (jax/torch/tensorstore), despite all
tests passing. sys.monitoring avoids the C tracer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The culprit was identified as tensorstore's S3/HTTP transport crashing at
interpreter shutdown on Windows (google/tensorstore#275), now handled by the
version pin + matrix exclude. The diagnostic backend-import step is no longer
needed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/ci.yml Outdated
@tlambert03
tlambert03 merged commit 7d6775b into main Jun 24, 2026
18 checks passed
@tlambert03
tlambert03 deleted the numpy2-py312-modernization branch June 24, 2026 18:25
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