Add Python 3.9 support (#1071)

* Add Python 3.9 support

This commit adds official python 3.9 support to qiskit-aer. This
includes CI, release notes, and package metadata.

Fixes #1067

* Remove wheel job 3.9 skip

* Remove unused assertNoLogs method

The assertNoLogs methods was built using a private class from python's
stdlib unittest library. This should never have been done as it's
explicitly marked as private. Accordingly in Python 3.9 this private
class has been removed and no longer exists. It turns out this method
was not used anywhere in all of qiskit (the same identical code was
removed from terra as part of Qiskit/qiskit-terra#5189 in
ed5155b95c).
Since the implementation is not sound and nothing uses it this commit
just removes the class and method.

* Fix azure pipelines job matrix typo

Co-authored-by: Victor Villar <vvilpas@gmail.com>
This commit is contained in:
Matthew Treinish 2020-12-10 10:14:30 -05:00 committed by GitHub
parent 5c3a2d61b1
commit 1dbb97e217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 25 additions and 44 deletions

View File

@ -70,12 +70,12 @@ jobs:
with:
python-version: 3.8
- name: Install deps
run: python -m pip install -U cibuildwheel==1.7.0
run: python -m pip install -U cibuildwheel==1.7.1
- name: Build Wheels
env:
CIBW_BEFORE_ALL_LINUX: "yum install -y https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm && yum install -y openblas-devel"
CIBW_BEFORE_BUILD: "pip install -U virtualenv pybind11"
CIBW_SKIP: "cp27-* cp34-* cp35-* cp39-* pp*"
CIBW_SKIP: "cp27-* cp34-* cp35-* pp*"
CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux2010_x86_64:2020-12-03-912b0de"
CIBW_MANYLINUX_I686_IMAGE: "quay.io/pypa/manylinux2010_i686:2020-12-03-912b0de"
CIBW_TEST_COMMAND: "python3 {project}/tools/verify_wheels.py"

View File

@ -18,7 +18,7 @@ jobs:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==1.5.5
python -m pip install cibuildwheel==1.7.1
- name: Build wheels
env:
CIBW_BEFORE_ALL_LINUX: "yum install -y https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm && yum install -y openblas-devel"
@ -74,7 +74,7 @@ jobs:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==1.5.5
python -m pip install cibuildwheel==1.7.1
- name: Build wheels
env:
CIBW_BEFORE_ALL: "yum install -y yum-utils wget && wget https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-rhel6-10-1-local-10.1.243-418.87.00-1.0-1.x86_64.rpm && rpm -i cuda-repo-rhel6-10-1-local-10.1.243-418.87.00-1.0-1.x86_64.rpm && yum clean all && yum -y install cuda-10-1 && yum install -y https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm"

View File

@ -42,7 +42,7 @@ jobs:
needs: ["lint"]
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
platform: [
{ os: "ubuntu-latest", python-architecture: "x64" },
]
@ -86,7 +86,7 @@ jobs:
timeout-minutes: 25
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
os: ["ubuntu-latest"]
env:
AER_THRUST_BACKEND: OMP

View File

@ -42,7 +42,7 @@ jobs:
needs: ["lint"]
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
platform: [
{ os: "macOS-latest", python-architecture: "x64"},
]
@ -80,7 +80,7 @@ jobs:
timeout-minutes: 25
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
os: ["macOS-latest"]
env:
AER_THRUST_BACKEND: OMP

View File

@ -43,7 +43,7 @@ jobs:
timeout-minutes: 25
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
os: ["windows-latest"]
env:
AER_THRUST_BACKEND: OMP

View File

@ -140,6 +140,8 @@ stages:
python.version: '3.7'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
variables:
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
steps:
@ -229,6 +231,8 @@ stages:
python.version: '3.7'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
variables:
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
steps:

View File

@ -0,0 +1,10 @@
---
features:
- |
Python 3.9 support has been added in this release. You can now run Qiskit
Aer using Python 3.9 without building from source.
deprecations:
- |
Python 3.6 support has been deprecated and will be removed in a future
release. When support is removed you will need to upgrade the Python
version you're using to Python 3.7 or above.

View File

@ -108,6 +108,7 @@ setup(
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Scientific/Engineering",
],
python_requires=">=3.6",

View File

@ -86,14 +86,6 @@ class QiskitAerTestCase(QiskitTestCase):
"""
return os.path.normpath(os.path.join(path.value, filename))
def assertNoLogs(self, logger=None, level=None):
"""
Context manager to test that no message is sent to the specified
logger and level (the opposite of TestCase.assertLogs()).
"""
# pylint: disable=invalid-name
return _AssertNoLogsContext(self, logger, level)
def assertSuccess(self, result):
"""Assert that simulation executed without errors"""
success = getattr(result, 'success', False)
@ -329,32 +321,6 @@ class QiskitAerTestCase(QiskitTestCase):
raise self.failureException(msg)
class _AssertNoLogsContext(unittest.case._AssertLogsContext):
"""A context manager used to implement TestCase.assertNoLogs()."""
# pylint: disable=inconsistent-return-statements
def __exit__(self, exc_type, exc_value, tb):
"""
This is a modified version of TestCase._AssertLogsContext.__exit__(...)
"""
self.logger.handlers = self.old_handlers
self.logger.propagate = self.old_propagate
self.logger.setLevel(self.old_level)
if exc_type is not None:
# let unexpected exceptions pass through
return False
if self.watcher.records:
msg = 'logs of level {} or higher triggered on {}:\n'.format(
logging.getLevelName(self.level), self.logger.name)
for record in self.watcher.records:
msg += 'logger %s %s:%i: %s\n' % (record.name, record.pathname,
record.lineno,
record.getMessage())
self._raiseFailure(msg)
def _is_ci_fork_pull_request():
"""
Check if the tests are being run in a CI environment and if it is a pull

View File

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