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

Raise minimum python version to 3.9 #12910

Merged
merged 7 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.8'
python-version: '3.11'

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/randomized_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.8'
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# Normally we test min and max version but we can't run python 3.8 or
# Normally we test min and max version but we can't run python
# 3.9 on arm64 until actions/setup-python#808 is resolved
python-version: ["3.10", "3.12"]
Comment on lines +21 to 23
Copy link
Contributor

Choose a reason for hiding this comment

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

This issue appears to be closed now actions/setup-python#808, are we planning on making any updates?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can fix this in a follow-up. There isn't a super big motivation to change it as using 3.10 works fine, but if we could get 3.9 running instead of 3.10 that would at least make everything consistent. But I think we can also look at doing it as part of #12807 too

steps:
Expand Down
31 changes: 1 addition & 30 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,6 @@ jobs:
with:
path: ./wheelhouse/*.whl
name: wheels-${{ matrix.os }}
build_wheels_macos_arm_py38:
name: Build wheels on macOS arm
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-12]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Build wheels
uses: pypa/cibuildwheel@v2.19.2
env:
CIBW_BEFORE_ALL: rustup target add aarch64-apple-darwin
CIBW_BUILD: cp38-macosx_universal2 cp38-macosx_arm64
CIBW_ARCHS_MACOS: arm64 universal2
CIBW_ENVIRONMENT: >-
CARGO_BUILD_TARGET="aarch64-apple-darwin"
PYO3_CROSS_LIB_DIR="/Library/Frameworks/Python.framework/Versions/$(python -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')/lib/python$(python -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')"
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: wheels-${{ matrix.os }}-arm
build_wheels_32bit:
name: Build wheels 32bit
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -100,7 +71,7 @@ jobs:
environment: release
permissions:
id-token: write
needs: ["build_wheels", "build_wheels_32bit", "build_wheels_macos_arm_py38"]
needs: ["build_wheels", "build_wheels_32bit"]
steps:
- uses: actions/download-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ thiserror = "1.0"
# distributions). We only activate that feature when building the C extension module; we still need
# it disabled for Rust-only tests to avoid linker errors with it not being loaded. See
# https://pyo3.rs/main/features#extension-module for more.
pyo3 = { version = "0.21.2", features = ["abi3-py38"] }
pyo3 = { version = "0.21.2", features = ["abi3-py39"] }

# These are our own crates.
qiskit-accelerate = { path = "crates/accelerate" }
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ parameters:
- name: "supportedPythonVersions"
displayName: "All supported versions of Python"
type: object
default: ["3.8", "3.9", "3.10", "3.11", "3.12"]
default: ["3.9", "3.10", "3.11", "3.12"]

- name: "minimumPythonVersion"
displayName: "Minimum supported version of Python"
type: string
default: "3.8"
default: "3.9"

- name: "maximumPythonVersion"
displayName: "Maximum supported version of Python"
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "qiskit"
description = "An open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives."
requires-python = ">=3.8"
requires-python = ">=3.9"
license = {text = "Apache 2.0"}
authors = [
{ name = "Qiskit Development Team", email = "qiskit@us.ibm.com" },
Expand All @@ -27,7 +27,6 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -134,12 +133,12 @@ include = ["qiskit", "qiskit.*"]

[tool.black]
line-length = 100
target-version = ['py38', 'py39', 'py310', 'py311']
target-version = ['py39', 'py310', 'py311']

[tool.cibuildwheel]
manylinux-x86_64-image = "manylinux2014"
manylinux-i686-image = "manylinux2014"
skip = "pp* cp36-* cp37-* *musllinux* *win32 *i686 cp38-macosx_arm64"
skip = "pp* cp36-* cp37-* cp38-* *musllinux* *win32 *i686 cp38-macosx_arm64"
test-skip = "*win32 *linux_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
Expand Down Expand Up @@ -191,7 +190,7 @@ extension-pkg-allow-list = [
"tweedledum",
]
load-plugins = ["pylint.extensions.docparams", "pylint.extensions.docstyle"]
py-version = "3.8" # update it when bumping minimum supported python version
py-version = "3.9" # update it when bumping minimum supported python version

[tool.pylint.basic]
good-names = ["a", "b", "i", "j", "k", "d", "n", "m", "ex", "v", "w", "x", "y", "z", "Run", "_", "logger", "q", "c", "r", "qr", "cr", "qc", "nd", "pi", "op", "b", "ar", "br", "p", "cp", "ax", "dt", "__unittest", "iSwapGate", "mu"]
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/py3.9-min-now-c9781484a0eb288e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
upgrade:
- |
The minimum supported version of Python is now 3.9, this has been raised
from the previous minimum support version of 3.8. This change was necessary
because the upstream cPython project no longer supports Python 3.8.
12 changes: 8 additions & 4 deletions test/python/circuit/test_circuit_load_from_qpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1948,8 +1948,11 @@ def test_pre_v12_rejects_standalone_var(self, version):
"""Test that dumping to older QPY versions rejects standalone vars."""
a = expr.Var.new("a", types.Bool())
qc = QuantumCircuit(inputs=[a])
with io.BytesIO() as fptr, self.assertRaisesRegex(
UnsupportedFeatureForVersion, "version 12 is required.*realtime variables"
with (
io.BytesIO() as fptr,
self.assertRaisesRegex(
UnsupportedFeatureForVersion, "version 12 is required.*realtime variables"
),
):
dump(qc, fptr, version=version)

Expand All @@ -1959,8 +1962,9 @@ def test_pre_v12_rejects_index(self, version):
# Be sure to use a register, since standalone vars would be rejected for other reasons.
qc = QuantumCircuit(ClassicalRegister(2, "cr"))
qc.store(expr.index(qc.cregs[0], 0), False)
with io.BytesIO() as fptr, self.assertRaisesRegex(
UnsupportedFeatureForVersion, "version 12 is required.*Index"
with (
io.BytesIO() as fptr,
self.assertRaisesRegex(UnsupportedFeatureForVersion, "version 12 is required.*Index"),
):
dump(qc, fptr, version=version)

Expand Down
9 changes: 6 additions & 3 deletions test/python/circuit/test_control_flow_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -3464,9 +3464,12 @@ def test_switch_rejects_entering_case_after_close(self):
def test_switch_rejects_reentering_case(self):
"""It shouldn't be possible to enter a case within another case."""
circuit = QuantumCircuit(1, 1)
with circuit.switch(0) as case, case(0), self.assertRaisesRegex(
CircuitError, r"Cannot enter more than one case at once"
), case(1):
with (
circuit.switch(0) as case,
case(0),
self.assertRaisesRegex(CircuitError, r"Cannot enter more than one case at once"),
case(1),
):
pass

@ddt.data("1", 1.0, None, (1, 2))
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
minversion = 4.0
envlist = py38, py39, py310, py311, py312, lint-incr
envlist = py39, py310, py311, py312, lint-incr
isolated_build = true

[testenv]
Expand All @@ -15,7 +15,7 @@ setenv =
QISKIT_SUPRESS_PACKAGING_WARNINGS=Y
QISKIT_TEST_CAPTURE_STREAMS=1
QISKIT_PARALLEL=FALSE
passenv =
passenv =
RUSTUP_TOOLCHAIN
RAYON_NUM_THREADS
OMP_NUM_THREADS
Expand Down
Loading