• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / qiskit / 8838638365
88%

Build:
DEFAULT BRANCH: main
Ran 25 Apr 2024 08:17PM UTC
Jobs 1
Files 825
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

25 Apr 2024 07:27PM UTC coverage: 89.44% (-0.02%) from 89.455%
8838638365

push

github

web-flow
Finalise support for Numpy 2.0 (#11999)

* Finalise support for Numpy 2.0

This commit brings the Qiskit test suite to a passing state (with all
optionals installed) with Numpy 2.0.0b1, building on previous commits
that handled much of the rest of the changing requirements:

- gh-10890
- gh-10891
- gh-10892
- gh-10897
- gh-11023

Notably, this commit did not actually require a rebuild of Qiskit,
despite us compiling against Numpy; it seems to happen that the C API
stuff we use via `rust-numpy` (which loads the Numpy C extensions
dynamically during module initialisation) hasn't changed.

The main changes are:

- adapting to the changed `copy=None` and `copy=False` semantics in
  `array` and `asarray`.
- making sure all our implementers of `__array__` accept both `dtype`
  and `copy` arguments.

Co-authored-by: Lev S. Bishop <18673315+levbishop@users.noreply.github.com>

* Update `__array__` methods for Numpy 2.0 compatibility

As of Numpy 2.0, implementers of `__array__` are expected and required
to have a signature

    def __array__(self, dtype=None, copy=None): ...

In Numpys before 2.0, the `copy` argument will never be passed, and the
expected signature was

    def __array__(self, dtype=None): ...

Because of this, we have latitude to set `copy` in our implementations
to anything we like if we're running against Numpy 1.x, but we should
default to `copy=None` if we're running against Numpy 2.0.

The semantics of the `copy` argument to `np.array` changed in Numpy 2.0.
Now, `copy=False` means "raise a `ValueError` if a copy is required" and
`copy=None` means "copy only if required".  In Numpy 1.x, `copy=False`
meant "copy only if required".  In _both_ Numpy 1.x and 2.0,
`ndarray.astype` takes a `copy` argument, and in both, `copy=False`
means "copy only if required".  In Numpy 2.0 only, `np.asarray` gained a
`copy` argument with the same semantics as the `np.array` copy argument
from Numpy 2.0.

Further, the semantics of the `__array__` method chan... (continued)

179 of 233 new or added lines in 42 files covered. (76.82%)

4 existing lines in 1 file now uncovered.

60510 of 67654 relevant lines covered (89.44%)

219091.18 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
90.48
-0.43% qiskit/circuit/_utils.py
1
93.1
-1.54% qiskit/circuit/library/generalized_gates/permutation.py
1
83.33
0.0% qiskit/circuit/library/hamiltonian_gate.py
1
92.31
-3.53% qiskit/circuit/library/standard_gates/global_phase.py
1
97.62
-2.38% qiskit/circuit/library/standard_gates/r.py
1
97.44
-2.56% qiskit/circuit/library/standard_gates/rxx.py
1
94.87
-2.43% qiskit/circuit/library/standard_gates/ryy.py
1
97.44
-2.56% qiskit/circuit/library/standard_gates/rzx.py
1
94.44
-2.61% qiskit/circuit/library/standard_gates/rzz.py
1
96.67
-3.33% qiskit/circuit/library/standard_gates/u2.py
1
95.56
-2.12% qiskit/circuit/library/standard_gates/xx_minus_yy.py
1
95.56
-2.12% qiskit/circuit/library/standard_gates/xx_plus_yy.py
1
89.8
0.0% qiskit/primitives/containers/shape.py
1
92.12
0.05% qiskit/quantum_info/operators/symplectic/clifford.py
1
84.7
0.06% qiskit/quantum_info/operators/symplectic/pauli.py
1
92.0
0.04% qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py
2
85.71
qiskit/_numpy_compat.py
2
96.46
-1.7% qiskit/circuit/library/standard_gates/p.py
2
95.89
-2.66% qiskit/circuit/library/standard_gates/rx.py
2
95.77
-2.73% qiskit/circuit/library/standard_gates/ry.py
2
95.65
-2.81% qiskit/circuit/library/standard_gates/rz.py
2
95.79
-2.01% qiskit/circuit/library/standard_gates/u.py
2
94.74
-1.97% qiskit/circuit/library/standard_gates/u1.py
2
96.84
-2.06% qiskit/circuit/library/standard_gates/u3.py
2
91.76
1.18% qiskit/quantum_info/operators/channel/chi.py
2
95.96
1.01% qiskit/quantum_info/operators/channel/choi.py
2
95.4
1.15% qiskit/quantum_info/operators/channel/ptm.py
2
92.66
0.56% qiskit/quantum_info/operators/channel/superop.py
3
82.85
-0.44% qiskit/quantum_info/operators/symplectic/pauli_list.py
3
87.73
0.36% qiskit/quantum_info/states/densitymatrix.py
4
78.88
-0.32% qiskit/quantum_info/operators/dihedral/dihedral.py
4
86.24
-0.8% qiskit/quantum_info/operators/scalar_op.py

Uncovered Existing Lines

Lines Coverage ∆ File
4
92.62
0.0% crates/qasm2/src/lex.rs
Jobs
ID Job ID Ran Files Coverage
1 8838638365.1 25 Apr 2024 08:17PM UTC 825
89.44
GitHub Action Run
Source Files on build 8838638365
  • Tree
  • List 825
  • Changed 65
  • Source Changed 0
  • Coverage Changed 39
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 686ff139 on github
  • Prev Build on main (#8838198368)
  • Next Build on main (#8840197637)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc