Skip to content

Commit 7b4e131

Browse files
committed
Raise minimum python version to 3.9
Qiskit 1.2.0 was the final minor version release of qiskit with Python 3.8 support. As Python 3.8 is going EoL before the next Qiskit minor release 1.3.0 we can drop support for running with 3.8 on the main branch now. This commit makes that change and updates everything using python 3.8 currently to use our new minimum instead.
1 parent 1fdd527 commit 7b4e131

File tree

10 files changed

+38
-43
lines changed

10 files changed

+38
-43
lines changed

.github/workflows/coverage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/setup-python@v5
2323
name: Install Python
2424
with:
25-
python-version: '3.8'
25+
python-version: '3.11'
2626

2727
- name: Install Rust toolchain
2828
uses: dtolnay/rust-toolchain@stable

.github/workflows/randomized_tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/setup-python@v5
1414
name: Install Python
1515
with:
16-
python-version: '3.8'
16+
python-version: '3.11'
1717
- name: Install dependencies
1818
run: |
1919
python -m pip install -U pip setuptools wheel

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
# Normally we test min and max version but we can't run python 3.8 or
21+
# Normally we test min and max version but we can't run python
2222
# 3.9 on arm64 until actions/setup-python#808 is resolved
2323
python-version: ["3.10", "3.12"]
2424
steps:

.github/workflows/wheels.yml

+1-30
Original file line numberDiff line numberDiff line change
@@ -41,35 +41,6 @@ jobs:
4141
with:
4242
path: ./wheelhouse/*.whl
4343
name: wheels-${{ matrix.os }}
44-
build_wheels_macos_arm_py38:
45-
name: Build wheels on macOS arm
46-
runs-on: ${{ matrix.os }}
47-
strategy:
48-
fail-fast: false
49-
matrix:
50-
os: [macos-12]
51-
steps:
52-
- uses: actions/checkout@v4
53-
- uses: actions/setup-python@v5
54-
name: Install Python
55-
with:
56-
python-version: '3.10'
57-
- uses: dtolnay/rust-toolchain@stable
58-
with:
59-
components: llvm-tools-preview
60-
- name: Build wheels
61-
uses: pypa/[email protected]
62-
env:
63-
CIBW_BEFORE_ALL: rustup target add aarch64-apple-darwin
64-
CIBW_BUILD: cp38-macosx_universal2 cp38-macosx_arm64
65-
CIBW_ARCHS_MACOS: arm64 universal2
66-
CIBW_ENVIRONMENT: >-
67-
CARGO_BUILD_TARGET="aarch64-apple-darwin"
68-
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]))')"
69-
- uses: actions/upload-artifact@v4
70-
with:
71-
path: ./wheelhouse/*.whl
72-
name: wheels-${{ matrix.os }}-arm
7344
build_wheels_32bit:
7445
name: Build wheels 32bit
7546
runs-on: ${{ matrix.os }}
@@ -100,7 +71,7 @@ jobs:
10071
environment: release
10172
permissions:
10273
id-token: write
103-
needs: ["build_wheels", "build_wheels_32bit", "build_wheels_macos_arm_py38"]
74+
needs: ["build_wheels", "build_wheels_32bit"]
10475
steps:
10576
- uses: actions/download-artifact@v4
10677
with:

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ thiserror = "1.0"
2929
# distributions). We only activate that feature when building the C extension module; we still need
3030
# it disabled for Rust-only tests to avoid linker errors with it not being loaded. See
3131
# https://pyo3.rs/main/features#extension-module for more.
32-
pyo3 = { version = "0.21.2", features = ["abi3-py38"] }
32+
pyo3 = { version = "0.21.2", features = ["abi3-py39"] }
3333

3434
# These are our own crates.
3535
qiskit-accelerate = { path = "crates/accelerate" }

azure-pipelines.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ parameters:
3737
- name: "supportedPythonVersions"
3838
displayName: "All supported versions of Python"
3939
type: object
40-
default: ["3.8", "3.9", "3.10", "3.11", "3.12"]
40+
default: ["3.9", "3.10", "3.11", "3.12"]
4141

4242
- name: "minimumPythonVersion"
4343
displayName: "Minimum supported version of Python"
4444
type: string
45-
default: "3.8"
45+
default: "3.9"
4646

4747
- name: "maximumPythonVersion"
4848
displayName: "Maximum supported version of Python"

pyproject.toml

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55
[project]
66
name = "qiskit"
77
description = "An open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives."
8-
requires-python = ">=3.8"
8+
requires-python = ">=3.9"
99
license = {text = "Apache 2.0"}
1010
authors = [
1111
{ name = "Qiskit Development Team", email = "[email protected]" },
@@ -27,7 +27,6 @@ classifiers = [
2727
"Operating System :: Microsoft :: Windows",
2828
"Operating System :: POSIX :: Linux",
2929
"Programming Language :: Python :: 3 :: Only",
30-
"Programming Language :: Python :: 3.8",
3130
"Programming Language :: Python :: 3.9",
3231
"Programming Language :: Python :: 3.10",
3332
"Programming Language :: Python :: 3.11",
@@ -134,12 +133,12 @@ include = ["qiskit", "qiskit.*"]
134133

135134
[tool.black]
136135
line-length = 100
137-
target-version = ['py38', 'py39', 'py310', 'py311']
136+
target-version = ['py39', 'py310', 'py311']
138137

139138
[tool.cibuildwheel]
140139
manylinux-x86_64-image = "manylinux2014"
141140
manylinux-i686-image = "manylinux2014"
142-
skip = "pp* cp36-* cp37-* *musllinux* *win32 *i686 cp38-macosx_arm64"
141+
skip = "pp* cp36-* cp37-* cp38-* *musllinux* *win32 *i686 cp38-macosx_arm64"
143142
test-skip = "*win32 *linux_i686"
144143
test-command = "python {project}/examples/python/stochastic_swap.py"
145144
# We need to use pre-built versions of Numpy and Scipy in the tests; they have a
@@ -191,7 +190,7 @@ extension-pkg-allow-list = [
191190
"tweedledum",
192191
]
193192
load-plugins = ["pylint.extensions.docparams", "pylint.extensions.docstyle"]
194-
py-version = "3.8" # update it when bumping minimum supported python version
193+
py-version = "3.9" # update it when bumping minimum supported python version
195194

196195
[tool.pylint.basic]
197196
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"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
upgrade:
3+
- |
4+
The minimum supported version of Python is now 3.9, this has been raised
5+
from the previous minimum support version of 3.8. This change was necessary
6+
because the upstream cPython project no longer supports Python 3.8.

test/python/circuit/test_gate_definitions.py

+19
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,25 @@ def test_inverse(self, class_name, gate_class):
250250
from qiskit.quantum_info.operators.predicates import is_identity_matrix
251251

252252
self.assertTrue(is_identity_matrix(Operator(gate).dot(gate.inverse()).data))
253+
print(gate_class)
254+
print(gate)
255+
import pprint
256+
print("Forward")
257+
for inst in gate.definition:
258+
if inst.matrix is None:
259+
print(inst.operation.definition)
260+
pprint.pprint([inst.matrix for inst in gate.definition])
261+
for inst in gate.definition.inverse():
262+
if inst.matrix is None:
263+
print(inst.operation.definition)
264+
print("Inverse")
265+
pprint.pprint([inst.operation for inst in gate.definition.inverse()])
266+
267+
print("Converted")
268+
from qiskit.converters import circuit_to_instruction
269+
pprint.pprint([inst.operation for inst in circuit_to_instruction(gate.definition).definition])
270+
print("inverse")
271+
pprint.pprint([inst.operation for inst in circuit_to_instruction(gate.definition.inverse()).definition])
253272

254273
if gate.definition is not None:
255274
self.assertTrue(is_identity_matrix(Operator(gate).dot(gate.definition.inverse()).data))

tox.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
minversion = 4.0
3-
envlist = py38, py39, py310, py311, py312, lint-incr
3+
envlist = py39, py310, py311, py312, lint-incr
44
isolated_build = true
55

66
[testenv]
@@ -15,7 +15,7 @@ setenv =
1515
QISKIT_SUPRESS_PACKAGING_WARNINGS=Y
1616
QISKIT_TEST_CAPTURE_STREAMS=1
1717
QISKIT_PARALLEL=FALSE
18-
passenv =
18+
passenv =
1919
RUSTUP_TOOLCHAIN
2020
RAYON_NUM_THREADS
2121
OMP_NUM_THREADS

0 commit comments

Comments
 (0)