Skip to content

Commit

Permalink
Add python 3.12 support (#139)
Browse files Browse the repository at this point in the history
* Add python 3.12 support

* Deprecation warning for python3.9

* update changelog

* Updated Github actions to use python 3.12

* Improved changelog

---------

Co-authored-by: Arianne Meijer <[email protected]>
  • Loading branch information
Aerylia and Arianne Meijer authored Jan 7, 2025
1 parent 5bfc177 commit a14c5c9
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ '3.9', '3.10', '3.11' ]
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
steps:
- uses: actions/checkout@v4
- name: Setup Python
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -57,7 +57,7 @@ jobs:
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ '3.9', '3.10', '3.11' ]
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
steps:
- uses: actions/checkout@v4
- name: Setup Python
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changelog
=========

Version 15.6
============

* Added python 3.12 support. `#139 <https://github.com/iqm-finland/qiskit-on-iqm/pull/139>`
* Python 3.9 support is deprecated and will be removed in the future.

Version 15.5
============

Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License"
]
requires-python = ">=3.9, <3.12"
requires-python = ">=3.9, <3.13"
dependencies = [
"numpy",
"qiskit >= 0.45, < 1.2",
"qiskit-aer >= 0.13.1, < 0.15",
"iqm-client >= 20.0, < 21.0"
"iqm-client >= 20.9, < 21.0"
]

[project.urls]
Expand Down Expand Up @@ -146,7 +146,8 @@ disable = [
"invalid-name",
"protected-access",
"too-few-public-methods",
"too-many-locals"
"too-many-locals",
"too-many-positional-arguments" # To be removed when dropping Python 3.11 support.
]
extension-pkg-whitelist = ["pydantic"]

Expand Down
4 changes: 4 additions & 0 deletions src/iqm/qiskit_iqm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
"""Qiskit adapter for IQM's quantum computers.
"""
import sys
from warnings import warn

from qiskit import __version__ as qiskit_version
Expand All @@ -34,3 +35,6 @@
+ "Support for older versions will be dropped in a future major release."
)
)

if sys.version_info < (3, 10):
warn(DeprecationWarning("Python 3.9 will no longer be supported in a later release of qiskit-iqm."))
4 changes: 2 additions & 2 deletions src/iqm/qiskit_iqm/iqm_transpilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def _validate_ops(self, dag: DAGCircuit):
for node in dag.op_nodes():
if node.name not in valid_ops:
raise ValueError(
f"""Invalid operation '{node.name}' found in IQMOptimize1QbDecomposition pass,
expected operations {valid_ops}"""
f'Invalid operation \'{node.name}\' found in IQMOptimize1QbDecomposition pass, '
+ f'expected operations {valid_ops}'
)


Expand Down
1 change: 1 addition & 0 deletions tests/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ disable=
fixme,
duplicate-code,
redefined-outer-name, # fixtures violate this
too-many-positional-arguments, # To be removed when dropping Python 3.11 support.

[FORMAT]
max-line-length=120
Expand Down
3 changes: 2 additions & 1 deletion tests/test_iqm_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def test_client_signature(adonis_architecture):
'http://some_url/api/v1/calibration/default/gates', headers=matchers.ANY, timeout=matchers.ANY
).thenReturn(get_mock_ok_response(adonis_architecture.model_dump()))
backend = provider.get_backend()
assert f'qiskit-iqm {version("qiskit-iqm")}' in backend.client._signature
version_string = version('qiskit-iqm')
assert f'qiskit-iqm {version_string}' in backend.client._signature


def test_get_facade_backend(adonis_architecture, adonis_coupling_map):
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[tox]
minversion = 4.11
envlist = py39, py310, py311, qiskit-{v0.45,v0.46,v1.0,v1.1}
envlist = py39, py310, py311, py312, qiskit-{v0.45,v0.46,v1.0,v1.1}
skip_missing_interpreters = True

[gh-actions]
python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
package = editable
setenv =
TOXINIDIR = {toxinidir}
VIRTUALENV_PIP=23.3.2

[testenv:py{39,310,311}]
[testenv:py{39,310,311,312}]
description =
Invoke pytest to run automated tests.
extras =
Expand Down

0 comments on commit a14c5c9

Please sign in to comment.