Skip to content

Commit

Permalink
Add Python 3.9 support (Qiskit#1071)
Browse files Browse the repository at this point in the history
* 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 Qiskit#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#5189 in
Qiskit/qiskit@ed5155b).
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>
  • Loading branch information
2 people authored and chriseclectic committed Jan 25, 2021
1 parent d516e23 commit 2c13f68
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
]
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions releasenotes/notes/add-python3.9-83b3b4e5c3d59571.yaml
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"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",
Expand Down
34 changes: 0 additions & 34 deletions test/terra/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@ def _get_resource_path(filename, path=Path.TEST):
"""
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)
Expand Down Expand Up @@ -312,32 +304,6 @@ def assertDictAlmostEqual(self, dict1, dict2, delta=None, msg=None,
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
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 = 2.1
envlist = py36, py37, py38, lint
envlist = py36, py37, py38, py39, lint
skipsdist = True

[testenv]
Expand Down

0 comments on commit 2c13f68

Please sign in to comment.