diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 95a0bda5d421..625ea9bc1f50 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.8' + python-version: '3.11' - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/randomized_tests.yml b/.github/workflows/randomized_tests.yml index f807656a84ce..1cc39893c5ec 100644 --- a/.github/workflows/randomized_tests.yml +++ b/.github/workflows/randomized_tests.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.8' + python-version: '3.11' - name: Install dependencies run: | python -m pip install -U pip setuptools wheel diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 20e40dec9824..20c40dc38321 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - # Normally we test min and max version but we can't run python 3.8 or + # Normally we test min and max version but we can't run python # 3.9 on arm64 until actions/setup-python#808 is resolved python-version: ["3.10", "3.12"] steps: diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d7c2b8c3f783..3314bae05d5b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -41,35 +41,6 @@ jobs: with: path: ./wheelhouse/*.whl name: wheels-${{ matrix.os }} - build_wheels_macos_arm_py38: - name: Build wheels on macOS arm - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macos-12] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: '3.10' - - uses: dtolnay/rust-toolchain@stable - with: - components: llvm-tools-preview - - name: Build wheels - uses: pypa/cibuildwheel@v2.19.2 - env: - CIBW_BEFORE_ALL: rustup target add aarch64-apple-darwin - CIBW_BUILD: cp38-macosx_universal2 cp38-macosx_arm64 - CIBW_ARCHS_MACOS: arm64 universal2 - CIBW_ENVIRONMENT: >- - CARGO_BUILD_TARGET="aarch64-apple-darwin" - PYO3_CROSS_LIB_DIR="/Library/Frameworks/Python.framework/Versions/$(python -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')/lib/python$(python -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')" - - uses: actions/upload-artifact@v4 - with: - path: ./wheelhouse/*.whl - name: wheels-${{ matrix.os }}-arm build_wheels_32bit: name: Build wheels 32bit runs-on: ${{ matrix.os }} @@ -100,7 +71,7 @@ jobs: environment: release permissions: id-token: write - needs: ["build_wheels", "build_wheels_32bit", "build_wheels_macos_arm_py38"] + needs: ["build_wheels", "build_wheels_32bit"] steps: - uses: actions/download-artifact@v4 with: diff --git a/Cargo.toml b/Cargo.toml index 2f5fd8ce077b..15f34603c61e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ rayon = "1.10" # distributions). We only activate that feature when building the C extension module; we still need # it disabled for Rust-only tests to avoid linker errors with it not being loaded. See # https://pyo3.rs/main/features#extension-module for more. -pyo3 = { version = "0.21.2", features = ["abi3-py38"] } +pyo3 = { version = "0.21.2", features = ["abi3-py39"] } # These are our own crates. qiskit-accelerate = { path = "crates/accelerate" } diff --git a/asv.conf.json b/asv.conf.json index 70dd3b760e2c..a75bc0c59c3a 100644 --- a/asv.conf.json +++ b/asv.conf.json @@ -17,7 +17,7 @@ "dvcs": "git", "environment_type": "virtualenv", "show_commit_url": "http://github.com/Qiskit/qiskit/commit/", - "pythons": ["3.8", "3.9", "3.10", "3.11", "3.12"], + "pythons": ["3.9", "3.10", "3.11", "3.12"], "benchmark_dir": "test/benchmarks", "env_dir": ".asv/env", "results_dir": ".asv/results" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c3154abf412c..49df19808498 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,12 +37,12 @@ parameters: - name: "supportedPythonVersions" displayName: "All supported versions of Python" type: object - default: ["3.8", "3.9", "3.10", "3.11", "3.12"] + default: ["3.9", "3.10", "3.11", "3.12"] - name: "minimumPythonVersion" displayName: "Minimum supported version of Python" type: string - default: "3.8" + default: "3.9" - name: "maximumPythonVersion" displayName: "Maximum supported version of Python" diff --git a/pyproject.toml b/pyproject.toml index 9a16fc6e0ac3..689bf473e2f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "qiskit" description = "An open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives." -requires-python = ">=3.8" +requires-python = ">=3.9" license = {text = "Apache 2.0"} authors = [ { name = "Qiskit Development Team", email = "qiskit@us.ibm.com" }, @@ -27,7 +27,6 @@ classifiers = [ "Operating System :: Microsoft :: Windows", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -140,12 +139,12 @@ include = ["qiskit", "qiskit.*"] [tool.black] line-length = 100 -target-version = ['py38', 'py39', 'py310', 'py311'] +target-version = ['py39', 'py310', 'py311'] [tool.cibuildwheel] manylinux-x86_64-image = "manylinux2014" manylinux-i686-image = "manylinux2014" -skip = "pp* cp36-* cp37-* *musllinux* *win32 *i686 cp38-macosx_arm64" +skip = "pp* cp36-* cp37-* cp38-* *musllinux* *win32 *i686 cp38-macosx_arm64" test-skip = "*win32 *linux_i686" test-command = "python {project}/examples/python/stochastic_swap.py" # We need to use pre-built versions of Numpy and Scipy in the tests; they have a @@ -197,7 +196,7 @@ extension-pkg-allow-list = [ "tweedledum", ] load-plugins = ["pylint.extensions.docparams", "pylint.extensions.docstyle"] -py-version = "3.8" # update it when bumping minimum supported python version +py-version = "3.9" # update it when bumping minimum supported python version [tool.pylint.basic] good-names = ["a", "b", "i", "j", "k", "d", "n", "m", "ex", "v", "w", "x", "y", "z", "Run", "_", "logger", "q", "c", "r", "qr", "cr", "qc", "nd", "pi", "op", "b", "ar", "br", "p", "cp", "ax", "dt", "__unittest", "iSwapGate", "mu"] diff --git a/qiskit/__init__.py b/qiskit/__init__.py index 41f9d9eba1b9..25137d7a5918 100644 --- a/qiskit/__init__.py +++ b/qiskit/__init__.py @@ -43,14 +43,6 @@ " Qiskit unfortunately cannot enforce this requirement during environment resolution." " See https://qisk.it/packaging-1-0 for more detail." ) -if sys.version_info < (3, 9): - warnings.warn( - "Using Qiskit with Python 3.8 is deprecated as of the 1.1.0 release. " - "Support for running Qiskit with Python 3.8 will be removed in the " - "1.3.0 release, which coincides with when Python 3.8 goes end of life.", - DeprecationWarning, - ) - from . import _accelerate import qiskit._numpy_compat diff --git a/releasenotes/notes/py3.9-min-now-c9781484a0eb288e.yaml b/releasenotes/notes/py3.9-min-now-c9781484a0eb288e.yaml new file mode 100644 index 000000000000..a58dc69f9e4a --- /dev/null +++ b/releasenotes/notes/py3.9-min-now-c9781484a0eb288e.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + The minimum supported version of Python is now 3.9, this has been raised + from the previous minimum support version of 3.8. This change was necessary + because the upstream cPython project no longer supports Python 3.8. diff --git a/test/python/circuit/test_circuit_load_from_qpy.py b/test/python/circuit/test_circuit_load_from_qpy.py index 04e71a0dd4d7..db8663ace558 100644 --- a/test/python/circuit/test_circuit_load_from_qpy.py +++ b/test/python/circuit/test_circuit_load_from_qpy.py @@ -1948,8 +1948,11 @@ def test_pre_v12_rejects_standalone_var(self, version): """Test that dumping to older QPY versions rejects standalone vars.""" a = expr.Var.new("a", types.Bool()) qc = QuantumCircuit(inputs=[a]) - with io.BytesIO() as fptr, self.assertRaisesRegex( - UnsupportedFeatureForVersion, "version 12 is required.*realtime variables" + with ( + io.BytesIO() as fptr, + self.assertRaisesRegex( + UnsupportedFeatureForVersion, "version 12 is required.*realtime variables" + ), ): dump(qc, fptr, version=version) @@ -1959,8 +1962,9 @@ def test_pre_v12_rejects_index(self, version): # Be sure to use a register, since standalone vars would be rejected for other reasons. qc = QuantumCircuit(ClassicalRegister(2, "cr")) qc.store(expr.index(qc.cregs[0], 0), False) - with io.BytesIO() as fptr, self.assertRaisesRegex( - UnsupportedFeatureForVersion, "version 12 is required.*Index" + with ( + io.BytesIO() as fptr, + self.assertRaisesRegex(UnsupportedFeatureForVersion, "version 12 is required.*Index"), ): dump(qc, fptr, version=version) diff --git a/test/python/circuit/test_control_flow_builders.py b/test/python/circuit/test_control_flow_builders.py index e41b5c1f9f31..7a3a0873ae77 100644 --- a/test/python/circuit/test_control_flow_builders.py +++ b/test/python/circuit/test_control_flow_builders.py @@ -3464,9 +3464,12 @@ def test_switch_rejects_entering_case_after_close(self): def test_switch_rejects_reentering_case(self): """It shouldn't be possible to enter a case within another case.""" circuit = QuantumCircuit(1, 1) - with circuit.switch(0) as case, case(0), self.assertRaisesRegex( - CircuitError, r"Cannot enter more than one case at once" - ), case(1): + with ( + circuit.switch(0) as case, + case(0), + self.assertRaisesRegex(CircuitError, r"Cannot enter more than one case at once"), + case(1), + ): pass @ddt.data("1", 1.0, None, (1, 2)) diff --git a/test/qpy_compat/process_version.sh b/test/qpy_compat/process_version.sh index 56743c613316..3fc34557b69e 100755 --- a/test/qpy_compat/process_version.sh +++ b/test/qpy_compat/process_version.sh @@ -45,9 +45,9 @@ if [[ ! -d qpy_$version ]] ; then echo "Building venv for qiskit-terra $version" python -m venv $version if [[ ${parts[0]} -eq 0 ]] ; then - ./$version/bin/pip install "qiskit-terra==$version" + ./$version/bin/pip install -c qpy_test_constraints.txt "qiskit-terra==$version" else - ./$version/bin/pip install "qiskit==$version" + ./$version/bin/pip install -c qpy_test_constraints.txt "qiskit==$version" fi mkdir qpy_$version pushd qpy_$version diff --git a/test/qpy_compat/qpy_test_constraints.txt b/test/qpy_compat/qpy_test_constraints.txt new file mode 100644 index 000000000000..03f798b3c01a --- /dev/null +++ b/test/qpy_compat/qpy_test_constraints.txt @@ -0,0 +1,2 @@ +numpy===1.24.4 +scipy===1.10.1 diff --git a/test/qpy_compat/run_tests.sh b/test/qpy_compat/run_tests.sh index 4fc6bc5b91fd..3810773ec0f3 100755 --- a/test/qpy_compat/run_tests.sh +++ b/test/qpy_compat/run_tests.sh @@ -20,7 +20,7 @@ export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 429 echo "PYTHONHASHSEED=$PYTHONHASHSEED" python -m venv qiskit_venv -qiskit_venv/bin/pip install ../.. +qiskit_venv/bin/pip install -c ../../constraints.txt ../.. parallel bash ./process_version.sh ::: `git tag --sort=-creatordate` diff --git a/test/visual/mpl/graph/references/bloch_multivector.png b/test/visual/mpl/graph/references/bloch_multivector.png index 896e513ef368..e3036bc2ccb9 100644 Binary files a/test/visual/mpl/graph/references/bloch_multivector.png and b/test/visual/mpl/graph/references/bloch_multivector.png differ diff --git a/test/visual/mpl/graph/references/bloch_multivector_figsize_improvements.png b/test/visual/mpl/graph/references/bloch_multivector_figsize_improvements.png index 5f5ba75d9428..c5a082e8039a 100644 Binary files a/test/visual/mpl/graph/references/bloch_multivector_figsize_improvements.png and b/test/visual/mpl/graph/references/bloch_multivector_figsize_improvements.png differ diff --git a/test/visual/mpl/graph/references/state_city.png b/test/visual/mpl/graph/references/state_city.png index a9af6d8b87f2..ecbdb3c3d2bc 100644 Binary files a/test/visual/mpl/graph/references/state_city.png and b/test/visual/mpl/graph/references/state_city.png differ diff --git a/tox.ini b/tox.ini index 89dc84d1758a..a0c5665695d2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 4.0 -envlist = py38, py39, py310, py311, py312, lint-incr +envlist = py39, py310, py311, py312, lint-incr isolated_build = true [testenv] @@ -15,7 +15,7 @@ setenv = QISKIT_SUPRESS_PACKAGING_WARNINGS=Y QISKIT_TEST_CAPTURE_STREAMS=1 QISKIT_PARALLEL=FALSE -passenv = +passenv = RUSTUP_TOOLCHAIN RAYON_NUM_THREADS OMP_NUM_THREADS