Skip to content

Conversation

pavoljuhas
Copy link
Collaborator

Fixes #7657

@pavoljuhas pavoljuhas requested review from vtomole and a team as code owners September 22, 2025 23:45
@github-actions github-actions bot added the size: S 10< lines changed <50 label Sep 22, 2025
@pavoljuhas pavoljuhas requested a review from mhucka September 22, 2025 23:49
Copy link

codecov bot commented Sep 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.37%. Comparing base (dbde273) to head (40da96a).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7661   +/-   ##
=======================================
  Coverage   99.37%   99.37%           
=======================================
  Files        1082     1082           
  Lines       96700    96700           
=======================================
  Hits        96097    96097           
  Misses        603      603           

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@mhucka mhucka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check/mypy fails for me locally for one of the files.

Comment on lines +291 to +294
copy.M = self.M[axes][:, axes]
copy.gamma = self.gamma[axes]
copy.v = self.v[axes]
copy.s = self.s[axes]
Copy link
Contributor

@mhucka mhucka Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These fail for me locally with Python 3.11, Numpy 2.2.6, and mypy 1.17.1.

# ./check/mypy
cirq-core/cirq/sim/clifford/stabilizer_state_ch_form.py:291: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, ...], dtype[Any]]", variable has type "ndarray[tuple[int, int], dtype[Any]]")  [assignment]
cirq-core/cirq/sim/clifford/stabilizer_state_ch_form.py:292: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, ...], dtype[Any]]", variable has type "ndarray[tuple[int], dtype[Any]]")  [assignment]
cirq-core/cirq/sim/clifford/stabilizer_state_ch_form.py:293: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, ...], dtype[Any]]", variable has type "ndarray[tuple[int], dtype[Any]]")  [assignment]
cirq-core/cirq/sim/clifford/stabilizer_state_ch_form.py:294: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, ...], dtype[Any]]", variable has type "ndarray[tuple[int], dtype[Any]]")  [assignment]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack. Please update to numpy>=2.3 in your development environment. These lines were decorated with # type: ignore comments which became unnecessary after typing enhancements in numpy-2.3. Testing with numpy-2.2 exposes the ignored errors.

For type checking we can require the latest numpy version (as installed in the CI job) so that type checks have the most up-to-date numpy annotations.

@pavoljuhas pavoljuhas added this pull request to the merge queue Sep 24, 2025
Merged via the queue into quantumlib:main with commit 23afd92 Sep 24, 2025
35 checks passed
@pavoljuhas pavoljuhas deleted the fix-type-check-with-np-2.3.3 branch September 24, 2025 00:39
@mhucka
Copy link
Contributor

mhucka commented Sep 24, 2025

Cross-referencing #7656 where someone ran into the mypy failure with numpy 2.2.6. Presumably this PR now will have fixed #7656 too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI - type check fails for numpy-2.3
3 participants