Add support for Python 3.10 (#7102)

* Add support for Python 3.10

Python 3.10.0 was released on 10-04-2021, this commit marks the support
of Python 3.10 in qiskit-terra. It adds the supported python version in
the package metadata and updates the CI configuration to run test jobs
on Python 3.10 and build Python 3.10 wheels.

* Fix typo

* Update default envlist in tox.ini to include 3.10

* Bump cibuildwheel to the latest version

This also takes the opportunity to deduplicate the cibuildwheel
configuration using the pyproject.toml support in newer versions of
cibuildwheel. The common options for all builds are put there and per
build overrides (which are only for cross compiling arm wheels) are left
as environment variables in the CI configuration.

* Add missing cibuildwheel config to pyproject.toml

* Ignore internal deprecation warning emitted by jupyter in ci

* Fix black

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Matthew Treinish 2022-01-19 19:38:28 -05:00 committed by GitHub
parent 185df89030
commit 9a743fb2ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 21 deletions

View File

@ -27,14 +27,11 @@ jobs:
platforms: all
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.0.1 twine
python -m pip install cibuildwheel==2.2.2 twine
- name: Build wheels
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: cp27-* cp34-* cp35-* pp*
CIBW_BEFORE_BUILD: pip install -U Cython
CIBW_TEST_COMMAND: python {project}/examples/python/stochastic_swap.py
CIBW_ARCHS_LINUX: aarch64
- uses: actions/upload-artifact@v2
with:

View File

@ -27,16 +27,13 @@ stages:
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
variables:
python.version: '3.7'
CIBW_BEFORE_BUILD: pip install -U Cython
CIBW_SKIP: cp27-* cp34-* cp35-* cp36-* pp*
TWINE_USERNAME: qiskit
CIBW_TEST_COMMAND: python {project}/examples/python/stochastic_swap.py
steps:
- task: UsePythonVersion@0
- bash: |
set -e
python -m pip install --upgrade pip
pip install cibuildwheel==1.11.0
pip install cibuildwheel==2.2.2
pip install -U twine
cibuildwheel --output-dir wheelhouse .
- task: PublishBuildArtifacts@1
@ -71,16 +68,13 @@ stages:
pool: {vmImage: 'macOS-10.15'}
variables:
python.version: '3.7'
CIBW_BEFORE_BUILD: pip install -U Cython
CIBW_SKIP: cp27-* cp34-* cp35-* cp36-* pp*
TWINE_USERNAME: qiskit
CIBW_TEST_COMMAND: python {project}/examples/python/stochastic_swap.py
steps:
- task: UsePythonVersion@0
- bash: |
set -e
python -m pip install --upgrade pip
pip install cibuildwheel==1.11.0
pip install cibuildwheel==2.2.2
pip install -U twine
cibuildwheel --output-dir wheelhouse .
- task: PublishBuildArtifacts@1
@ -95,17 +89,14 @@ stages:
pool: {vmImage: 'macOS-10.15'}
variables:
python.version: '3.7'
CIBW_BEFORE_BUILD: pip install -U Cython
CIBW_SKIP: cp27-* cp34-* cp35-* cp36-* pp*
CIBW_ARCHS_MACOS: universal2
TWINE_USERNAME: qiskit
CIBW_TEST_COMMAND: python {project}/examples/python/stochastic_swap.py
steps:
- task: UsePythonVersion@0
- bash: |
set -e
python -m pip install --upgrade pip
pip install cibuildwheel==1.11.0
pip install cibuildwheel==2.2.2
pip install -U twine
cibuildwheel --output-dir wheelhouse .
- task: PublishBuildArtifacts@1
@ -119,10 +110,7 @@ stages:
pool: {vmImage: 'vs2017-win2016'}
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
variables:
CIBW_BEFORE_BUILD: pip install -U Cython
CIBW_SKIP: cp27-* cp34-* cp35-* cp36-* pp*
TWINE_USERNAME: qiskit
CIBW_TEST_COMMAND: python {project}\examples\python\stochastic_swap.py
steps:
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.7', architecture: x86}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.7', architecture: x64}}
@ -130,10 +118,12 @@ stages:
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.8', architecture: x64}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.9', architecture: x86}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.9', architecture: x64}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.10', architecture: x86}}
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.10', architecture: x64}}
- bash: |
set -e
python -m pip install --upgrade pip
pip install cibuildwheel==1.11.0
pip install cibuildwheel==2.2.2
pip install -U twine
cibuildwheel --output-dir wheelhouse
- task: PublishBuildArtifacts@1
@ -508,6 +498,8 @@ stages:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
variables:
QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y
QISKIT_TEST_CAPTURE_STREAMS: 1
@ -587,6 +579,8 @@ stages:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
variables:
QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
@ -669,6 +663,8 @@ stages:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
variables:
QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip

View File

@ -4,3 +4,9 @@ requires = ["Cython>=0.27.1", "setuptools", "wheel"]
[tool.black]
line-length = 100
target-version = ['py36', 'py37', 'py38', 'py39']
[tool.cibuildwheel]
manylinux-x86_64-image = "manylinux2010"
manylinux-i686-image = "manylinux2010"
skip = "pp* cp36-*"
test-command = "python {project}/examples/python/stochastic_swap.py"

View File

@ -215,6 +215,9 @@ class QiskitTestCase(BaseQiskitTestCase):
r"The pauli_basis function with PauliTable.*",
# TODO: remove the following ignore after seaborn 0.12.0 releases
r"distutils Version classes are deprecated. Use packaging\.version",
# Internal deprecation warning emitted by jupyter client when
# calling nbconvert in python 3.10
r"There is no current event loop",
]
for msg in allow_DeprecationWarning_message:
warnings.filterwarnings("default", category=DeprecationWarning, message=msg)

View File

@ -115,6 +115,7 @@ setup(
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering",
],
keywords="qiskit sdk quantum",

View File

@ -1,6 +1,6 @@
[tox]
minversion = 2.1
envlist = py37, py38, py39, lint-incr
envlist = py37, py38, py39, py310, lint-incr
skipsdist = True
[testenv]