Skip to content

Fix #583: typing issues with numpy 2.5 - #585

Open
thierry-martinez wants to merge 1 commit into
TeamGraphix:masterfrom
thierry-martinez:fix/583-numpy-2.5
Open

Fix #583: typing issues with numpy 2.5#585
thierry-martinez wants to merge 1 commit into
TeamGraphix:masterfrom
thierry-martinez:fix/583-numpy-2.5

Conversation

@thierry-martinez

Copy link
Copy Markdown
Collaborator

This commit fixes the typing issues introduced by numpy 2.5, making the codebase compatible with newer versions of numpy while preserving compatibility with older versions (from numpy 2).

numpy 2.5 uses the type alias syntax to define NDArray, so we can no longer use NDArray as a base type.

The issue numpy/numpy#31513 has been fixed, so we can stop ignoring the argument types of np.einsum.

rng.choice is now typed as signedinteger[_32Bit | _64Bit] instead of Any, so rng.choice([0, 1]) is no longer a valid Outcome value. This commit introduces rand_outcome to generate a random Outcome value.

This commit fixes the typing issues introduced by numpy 2.5, making the
codebase compatible with newer versions of numpy while preserving
compatibility with older versions (from numpy 2).

numpy 2.5 uses the type alias syntax to define `NDArray`, so we can no
longer use `NDArray` as a base type.

The issue numpy/numpy#31513 has been fixed, so
we can stop ignoring the argument types of `np.einsum`.

`rng.choice` is now typed as `signedinteger[_32Bit | _64Bit]` instead of
`Any`, so `rng.choice([0, 1])` is no longer a valid `Outcome` value.
This commit introduces `rand_outcome` to generate a random `Outcome`
value.
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.27%. Comparing base (92fee82) to head (942241f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #585   +/-   ##
=======================================
  Coverage   89.26%   89.27%           
=======================================
  Files          49       49           
  Lines        7791     7795    +4     
=======================================
+ Hits         6955     6959    +4     
  Misses        836      836           

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

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