mirror of https://github.com/Qiskit/qiskit.git
Add support for Python 3.11 (#9028)
* Add support for Python 3.11
Python 3.11.0 was released on 10-24-2022, this commit marks the start of
support for Python 3.11 in qiskit. It adds the supported Python version in
the package metadata and updates the CI configuration to run test jobs
on Python 3.11 and build Python 3.11 wheels on release.
* Fix inspect.Parameter usage for API change in 3.11
Per the Python 3.11.0 release notes inspect.Parameter now raises a
ValueError if the name argument is a Python identifier. This was causing a
test failure in one case where a parameter named `lambda` was used.
This commit adjusts the parameter name in the tests to be lam to avoid
this issue.
* Set a version cap on the jax dev requirement
Currently jax doesn't publish Python 3.11 wheels which is blocking test
runs with python 3.11. Since jax is an optional package only used for
the gradient package we can just skip it as isn't a full blocker for
using python 3.11. This commit sets an environment marker on the jax
dev requirements to only try to install it on Python < 3.11.
* Set python version cap on cplex in CI
* DNM: Test wheel builds work
* Skip tests on i686/win32 wheel buids with python 3.11
* Revert "DNM: Test wheel builds work"
This reverts commit 725c21b465
.
* Run QPY backwards compat tests on trailing edge Python version
This commit moves the qpy backwards compatibility testing from the
leading edge python version, which in this PR branch is Python 3.11, to
the trailing edge Python version which is currently 3.7. Trying to add
support for a new Python version has demonstrated that we can't use the
leading edge version as historical versions of Qiskit used to generate
old QPY payloads are not going to be generally installable with newer
Python versions. So by using the trailing edge version instead we can
install all the older versions of Qiskit as there is Python
compatibility for those Qiskit versions. Eventually we will need to
raise the minimum Qiskit version we use in the QPY tests, when Python
3.9 goes EoL in October 2025 and Qiskit Terra 0.18.0 no longer has any
supported versions of Python it was released for. We probably could
get by another year until Python 3.10 goes EoL in 2026 it just means
we're building 0.18.x and 0.19.x from source for the testing, but when
Python 3.11 becomes our oldest supported version we'll likely have to
bump the minimum version.
This does go a bit counter to the intent of the test matrix to make the
first stage return fast and do a more through check in the second stage.
But, in this case the extra runtime is worth the longer term stability
in the tests.
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
94bccd55a5
commit
75d66dd8ba
|
@ -80,7 +80,7 @@ jobs:
|
|||
- bash: |
|
||||
set -e
|
||||
source test-job/bin/activate
|
||||
pip install -U "cplex" "qiskit-aer" "z3-solver" -c constraints.txt
|
||||
pip install -U "cplex;python_version < '3.11'" "qiskit-aer" "z3-solver" -c constraints.txt
|
||||
mkdir -p /tmp/terra-tests
|
||||
cp -r test /tmp/terra-tests/.
|
||||
cp .stestr.conf /tmp/terra-tests/.
|
||||
|
|
|
@ -4,7 +4,7 @@ parameters:
|
|||
|
||||
- name: pool
|
||||
type: object
|
||||
|
||||
|
||||
- name: env
|
||||
type: object
|
||||
default: {}
|
||||
|
@ -25,7 +25,7 @@ jobs:
|
|||
- bash: |
|
||||
set -e
|
||||
python -m pip install --upgrade pip
|
||||
pip install cibuildwheel==2.3.1
|
||||
pip install cibuildwheel==2.11.2
|
||||
pip install -U twine
|
||||
cibuildwheel --output-dir wheelhouse .
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ jobs:
|
|||
with:
|
||||
platforms: all
|
||||
- name: Build wheels
|
||||
uses: pypa/cibuildwheel@v2.3.1
|
||||
uses: pypa/cibuildwheel@v2.11.2
|
||||
env:
|
||||
CIBW_ARCHS_LINUX: s390x
|
||||
CIBW_TEST_SKIP: "cp*"
|
||||
|
@ -61,7 +61,7 @@ jobs:
|
|||
with:
|
||||
platforms: all
|
||||
- name: Build wheels
|
||||
uses: pypa/cibuildwheel@v2.3.1
|
||||
uses: pypa/cibuildwheel@v2.11.2
|
||||
env:
|
||||
CIBW_ARCHS_LINUX: ppc64le
|
||||
CIBW_TEST_SKIP: "cp*"
|
||||
|
@ -96,7 +96,7 @@ jobs:
|
|||
with:
|
||||
platforms: all
|
||||
- name: Build wheels
|
||||
uses: pypa/cibuildwheel@v2.3.1
|
||||
uses: pypa/cibuildwheel@v2.11.2
|
||||
env:
|
||||
CIBW_ARCHS_LINUX: aarch64
|
||||
- uses: actions/upload-artifact@v2
|
||||
|
|
|
@ -33,7 +33,7 @@ parameters:
|
|||
- name: "supportedPythonVersions"
|
||||
displayName: "All supported versions of Python"
|
||||
type: object
|
||||
default: ["3.7", "3.8", "3.9", "3.10"]
|
||||
default: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
||||
|
||||
- name: "minimumPythonVersion"
|
||||
displayName: "Minimum supported version of Python"
|
||||
|
@ -43,7 +43,7 @@ parameters:
|
|||
- name: "maximumPythonVersion"
|
||||
displayName: "Maximum supported version of Python"
|
||||
type: string
|
||||
default: "3.10"
|
||||
default: "3.11"
|
||||
|
||||
- name: "minimumRustVersion"
|
||||
displayName: "Minimum supported version of Rust"
|
||||
|
@ -151,7 +151,7 @@ stages:
|
|||
- template: ".azure/test-linux.yml"
|
||||
parameters:
|
||||
pythonVersion: ${{ parameters.minimumPythonVersion }}
|
||||
testQPY: false
|
||||
testQPY: true
|
||||
testImages: false
|
||||
rustVersion: ${{ parameters.minimumRustVersion }}
|
||||
|
||||
|
@ -171,7 +171,7 @@ stages:
|
|||
- template: ".azure/test-linux.yml"
|
||||
parameters:
|
||||
pythonVersion: ${{ parameters.maximumPythonVersion }}
|
||||
testQPY: true
|
||||
testQPY: false
|
||||
testImages: true
|
||||
installFromSdist: true
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ target-version = ['py37', 'py38', 'py39', 'py310']
|
|||
manylinux-x86_64-image = "manylinux2014"
|
||||
manylinux-i686-image = "manylinux2014"
|
||||
skip = "pp* cp36-* *musllinux*"
|
||||
test-skip = "cp310-win32 cp310-manylinux_i686"
|
||||
test-skip = "cp310-win32 cp310-manylinux_i686 cp311-win32 cp311-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
|
||||
|
|
|
@ -281,7 +281,7 @@ class InstructionScheduleMap:
|
|||
parameters = []
|
||||
for argname in ordered_names:
|
||||
param_signature = inspect.Parameter(
|
||||
name=argname,
|
||||
argname,
|
||||
kind=inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
||||
)
|
||||
parameters.append(param_signature)
|
||||
|
|
|
@ -24,6 +24,6 @@ sphinx-design>=0.2.0
|
|||
pygments>=2.4
|
||||
scikit-learn>=0.20.0
|
||||
scikit-quant<=0.7;platform_system != 'Windows'
|
||||
jax;platform_system != 'Windows'
|
||||
jaxlib;platform_system != 'Windows'
|
||||
jax;platform_system != 'Windows' and python_version < '3.11'
|
||||
jaxlib;platform_system != 'Windows' and python_version < '3.11'
|
||||
docplex
|
||||
|
|
1
setup.py
1
setup.py
|
@ -72,6 +72,7 @@ setup(
|
|||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Topic :: Scientific/Engineering",
|
||||
],
|
||||
keywords="qiskit sdk quantum",
|
||||
|
|
|
@ -393,7 +393,7 @@ class TestInstructionScheduleMap(QiskitTestCase):
|
|||
"""Test adding and getting schedule with non obvious parameter ordering."""
|
||||
theta = Parameter("theta")
|
||||
phi = Parameter("phi")
|
||||
lamb = Parameter("lambda")
|
||||
lamb = Parameter("lam")
|
||||
|
||||
target_sched = Schedule()
|
||||
target_sched.insert(0, ShiftPhase(theta, DriveChannel(0)), inplace=True)
|
||||
|
@ -401,7 +401,7 @@ class TestInstructionScheduleMap(QiskitTestCase):
|
|||
target_sched.insert(20, ShiftPhase(lamb, DriveChannel(0)), inplace=True)
|
||||
|
||||
inst_map = InstructionScheduleMap()
|
||||
inst_map.add("target_sched", (0,), target_sched, arguments=["theta", "phi", "lambda"])
|
||||
inst_map.add("target_sched", (0,), target_sched, arguments=["theta", "phi", "lam"])
|
||||
|
||||
ref_sched = Schedule()
|
||||
ref_sched.insert(0, ShiftPhase(0, DriveChannel(0)), inplace=True)
|
||||
|
|
Loading…
Reference in New Issue