zarr-developers / zarr-python

An implementation of chunked, compressed, N-dimensional arrays for Python.
https://zarr.readthedocs.io
MIT License
1.45k stars 273 forks source link

[v2] Fix doctests with numpy 2.0 #2073

Closed dstansby closed 4 weeks ago

dstansby commented 1 month ago

This fixes doctests to run with numpy 2.0, and skips them if numpy is < 2. This isn't a very elegant solution to these values changing with a new version of numpy, but I think it's a pragmatic solution to getting CI working again for v2.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.98%. Comparing base (0855bd6) to head (0ae89d5). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2073 +/- ## ======================================= Coverage 99.98% 99.98% ======================================= Files 38 38 Lines 14703 14703 ======================================= Hits 14701 14701 Misses 2 2 ``` | [Files](https://app.codecov.io/gh/zarr-developers/zarr-python/pull/2073?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zarr-developers) | Coverage Δ | | |---|---|---| | [zarr/core.py](https://app.codecov.io/gh/zarr-developers/zarr-python/pull/2073?src=pr&el=tree&filepath=zarr%2Fcore.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zarr-developers#diff-emFyci9jb3JlLnB5) | `100.00% <ø> (ø)` | | | [zarr/creation.py](https://app.codecov.io/gh/zarr-developers/zarr-python/pull/2073?src=pr&el=tree&filepath=zarr%2Fcreation.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zarr-developers#diff-emFyci9jcmVhdGlvbi5weQ==) | `100.00% <ø> (ø)` | |
jhamman commented 1 month ago

I support the concept here but I do wonder if there is a way to achieve this behavior without injecting __doctest_skip__ into the namespace of these modules. Can we skip at the CI level or something like that?

dstansby commented 1 month ago

Turns out there is a way to specify which files should be skipped with specific versions of dependendcies in the pytest config 👍