Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.11 #9028

Merged
merged 14 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .azure/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/.
Expand Down
4 changes: 2 additions & 2 deletions .azure/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:

- name: pool
type: object

- name: env
type: object
default: {}
Expand All @@ -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 .

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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*"
Expand Down Expand Up @@ -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*"
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -151,7 +151,7 @@ stages:
- template: ".azure/test-linux.yml"
parameters:
pythonVersion: ${{ parameters.minimumPythonVersion }}
testQPY: false
testQPY: true
testImages: false
rustVersion: ${{ parameters.minimumRustVersion }}

Expand All @@ -171,7 +171,7 @@ stages:
- template: ".azure/test-linux.yml"
parameters:
pythonVersion: ${{ parameters.maximumPythonVersion }}
testQPY: true
testQPY: false
testImages: true
installFromSdist: true

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 = ['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
Expand Down
2 changes: 1 addition & 1 deletion qiskit/pulse/instruction_schedule_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def add(
parameters = []
for argname in ordered_names:
param_signature = inspect.Parameter(
name=argname,
argname,
kind=inspect.Parameter.POSITIONAL_OR_KEYWORD,
)
parameters.append(param_signature)
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"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",
Expand Down
4 changes: 2 additions & 2 deletions test/python/pulse/test_instruction_schedule_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,15 @@ def test_schedule_with_non_alphanumeric_ordering(self):
"""Test adding and getting schedule with non obvious parameter ordering."""
theta = Parameter("theta")
phi = Parameter("phi")
lamb = Parameter("lambda")
lamb = Parameter("lam")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. python/cpython#92062 is what is requiring the change here. If I understand correctly, InstrumentScheduleMap is using inspect.signature and inspect.Parameter for convenience internally but the schedule parameters do not need to form a valid Python signature (I don't see the signature being returned out of InstructionScheduleMap). So we could change the internals if we wanted to allow lambda as a parameter. lambda seems like a common name to want to use, but I think with BackendV2 we want to move away from InstructionScheduleMap any way, so it's probably not worth changing for Python 3.11.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all Alonzo Church's fault


target_sched = Schedule()
target_sched.insert(0, ShiftPhase(theta, DriveChannel(0)), inplace=True)
target_sched.insert(10, ShiftPhase(phi, DriveChannel(0)), inplace=True)
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)
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 = py37, py38, py39, py310, lint-incr
envlist = py37, py38, py39, py310, py311, lint-incr
isolated_build = true

[testenv]
Expand Down