Skip to content

Commit

Permalink
Add support for Python 3.12
Browse files Browse the repository at this point in the history
Python 3.12.0 was released on 10-02-2023, this commit marks the start of
support for Python 3.12 in Qiskit. It adds the supported Pythonv ersion
in the package metadata and updates the CI configuration to run test
jobs on Python 3.12 and build Python 3.12 wheels on release.

Fixes: Qiskit#10887
  • Loading branch information
mtreinish committed Nov 16, 2023
1 parent a54b4c0 commit 2b48374
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
python-version: '3.10'
- uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.0
uses: pypa/cibuildwheel@v2.16.2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
Expand All @@ -42,7 +42,7 @@ jobs:
python-version: '3.10'
- uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.0
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_BEFORE_ALL: rustup target add aarch64-apple-darwin
CIBW_ARCHS_MACOS: arm64 universal2
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.0
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_ARCHS_LINUX: s390x
CIBW_TEST_SKIP: "cp*"
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.0
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_ARCHS_LINUX: ppc64le
CIBW_TEST_SKIP: "cp*"
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.0
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_ARCHS_LINUX: aarch64
- uses: actions/upload-artifact@v3
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ parameters:
- name: "supportedPythonVersions"
displayName: "All supported versions of Python"
type: object
default: ["3.8", "3.9", "3.10", "3.11"]
default: ["3.8", "3.9", "3.10", "3.11", "3.12"]

- name: "minimumPythonVersion"
displayName: "Minimum supported version of Python"
Expand All @@ -41,7 +41,7 @@ parameters:
- name: "maximumPythonVersion"
displayName: "Maximum supported version of Python"
type: string
default: "3.11"
default: "3.12"

# These two versions of Python can be chosen somewhat arbitrarily, but we get
# slightly better coverage per PR if they're neither the maximum nor minimum
Expand Down
4 changes: 2 additions & 2 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ jsonschema==3.2.0
# Numpy 1.25 deprecated some behaviours that we used, and caused the isometry
# tests to flake. See https://github.com/Qiskit/qiskit-terra/issues/10305,
# remove pin when resolving that.
numpy<1.25
numpy<1.25; python_version<'3.12'

# Scipy 1.11 seems to have caused an instability in the Weyl coordinates
# eigensystem code for one of the test cases. See
# https://github.com/Qiskit/qiskit-terra/issues/10345 for current details.
scipy<1.11
scipy<1.11; python_version<'3.12'

# Aer 0.13 causes several randomised tests to begin failing, and some
# `QuantumInstance` use of noise models to raise exceptions. These need fixes
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ target-version = ['py38', 'py39', 'py310', 'py311']
manylinux-x86_64-image = "manylinux2014"
manylinux-i686-image = "manylinux2014"
skip = "pp* cp36-* cp37-* *musllinux*"
test-skip = "cp310-win32 cp310-manylinux_i686 cp311-win32 cp311-manylinux_i686"
test-skip = "cp310-win32 cp310-manylinux_i686 cp311-win32 cp311-manylinux_i686 cp312-win32 cp312-manylinux_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
# tendency to crash if they're installed from source by `pip install`, and since
Expand Down
1 change: 1 addition & 0 deletions qiskit_pkg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
],
keywords="qiskit sdk quantum",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ typing-extensions; python_version<'3.11'
# symengine pinning needed due lowered precision handling complex
# multiplication in version 0.10 wich breaks parameter assignment test
# (can be removed once issue is fix)
symengine>=0.9, <0.10; platform_machine == 'x86_64' or platform_machine == 'aarch64' or platform_machine == 'ppc64le' or platform_machine == 'amd64' or platform_machine == 'arm64'
symengine>=0.9,!=0.10.0; platform_machine == 'x86_64' or platform_machine == 'aarch64' or platform_machine == 'ppc64le' or platform_machine == 'amd64' or platform_machine == 'arm64'
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
],
keywords="qiskit sdk quantum",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
minversion = 3.3.0
envlist = py38, py39, py310, py311, lint-incr
envlist = py38, py39, py310, py311, py312, lint-incr
isolated_build = true

[testenv]
Expand Down

0 comments on commit 2b48374

Please sign in to comment.