diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index f2393be..b2a85fd 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.10', '3.11', '3.12'] + python-version: ['3.10', '3.11', '3.12', '3.13'] os: [ubuntu-latest, macos-latest, windows-latest] steps: diff --git a/pyproject.toml b/pyproject.toml index 90b79f1..da688dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,16 +43,16 @@ classifiers = [ dependencies = [ - "typing_extensions >= 4.1.1", - "numpy <2.0", - "scipy ", # v1.10 breaks tests - "sympy >= 1.6", + "typing_extensions >= 4.1.1", + "numpy >= 1.21", + "scipy >= 1.9", + "sympy >= 1.6", "networkx", - "decorator < 5.0.0", # 5.0 breaks networkx dependancy + "decorator !=5.0", # 5.0 breaks networkx dependancy "opt_einsum", - "pillow != 9.1.0", # 9.1.0 has problems on some versions of MacOS - # https://github.com/python-pillow/Pillow/issues/6179 - "matplotlib", + "pillow != 9.1.0", # 9.1.0 has problems on some versions of MacOS + # https://github.com/python-pillow/Pillow/issues/6179 + "matplotlib >= 3.5", ] @@ -85,14 +85,13 @@ docs = [ ] dev = [ "cirq >= 0.8.0", - "qiskit >= 0.24.0", - "qiskit-aer", - "ruamel.yaml", # Additional requirement for pyquil - "pyquil >= 2.28.0", - "qsimcirq >= 0.10.2 ; python_version < '3.11'", # PEP508 environment marker + "qiskit >= 0.24.0 ", + "qiskit-aer ; python_version < '3.14'", # 2026-01-01 qiskit-aer won't install on python 3.14 + "pyquil ; python_version < '3.13'", # 2026-01-01 Pyquil won't install on python 3.13 or 3.14 + "qsimcirq >= 0.10.2", "qutip", "qutip-qip", - "amazon-braket-sdk", + "amazon-braket-sdk ; python_version < '3.14'", # 2026-01-01 braket tests failing on python 3.14 "sphinx", "sphinxcontrib-bibtex", @@ -174,6 +173,7 @@ exclude_lines = [ # Suppresses error about unresolved imports (i.e. from numpy) ignore_missing_imports = true + # Disallows functions without type annotations # disallow_untyped_defs = true diff --git a/quantumflow/decompositions.py b/quantumflow/decompositions.py index 578b806..9d12d40 100644 --- a/quantumflow/decompositions.py +++ b/quantumflow/decompositions.py @@ -186,9 +186,9 @@ def kronecker_decomposition(gate: Gate, euler: str = "ZYZ") -> Circuit: R = U.reshape(2, 2, 2, 2) R = R.transpose(0, 2, 1, 3) - R = R.reshape(4, 4) + R44 = R.reshape(4, 4) - u, s, vh = np.linalg.svd(R) + u, s, vh = np.linalg.svd(R44) A = np.sqrt(s[0]) * u[:, 0].reshape(2, 2) B = np.sqrt(s[0]) * vh[0, :].reshape(2, 2) diff --git a/quantumflow/xcirq.py b/quantumflow/xcirq.py index 562bcce..dc283cd 100644 --- a/quantumflow/xcirq.py +++ b/quantumflow/xcirq.py @@ -100,8 +100,7 @@ def run(self, ket: Optional[State] = None) -> State: qubits = self.qubits ket = zero_state(qubits=qubits) - tensor = ket.tensor.flatten() - tensor = np.asarray(tensor, dtype=np.complex64) + tensor = np.asarray(ket.tensor.flatten(), dtype=np.complex64) sim = cirq.Simulator() res = sim.simulate(self._cqc, initial_state=tensor) tensor = res.state_vector() # type:ignore # Needed for cirq <0.10.0 diff --git a/quantumflow/xqiskit_test.py b/quantumflow/xqiskit_test.py index 36473da..dd73fed 100644 --- a/quantumflow/xqiskit_test.py +++ b/quantumflow/xqiskit_test.py @@ -155,6 +155,7 @@ def test_circuit_to_qiskit() -> None: def test_qiskitsimulator() -> None: + pytest.importorskip("qiskit-aer") circ = qf.Circuit() circ += qf.H(1) circ += qf.X(0)