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

Add support for Python 3.12 #429

Merged
merged 7 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
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
6 changes: 5 additions & 1 deletion .github/workflows/test_latest_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.11"]
python-version: ["3.8", "3.12"]
include:
- os: macos-latest
python-version: "3.8"
Expand All @@ -47,6 +47,10 @@ jobs:
pver=${{ matrix.python-version }}
tox -epy${pver/./} -- --run-slow
notebook_flags=""
if [ "$pver" = "3.12" ]; then
echo Skipping tutorials that require cplex or quantum-serverless
notebook_flags="${notebook_flags} --ignore=docs/circuit_cutting/cutqc/tutorials/tutorial_1_automatic_cut_finding.ipynb --ignore=docs/circuit_cutting/cutqc/tutorials/tutorial_3_cutting_with_quantum_serverless.ipynb --ignore=docs/entanglement_forging/tutorials/tutorial_2_forging_with_quantum_serverless.ipynb"
fi
if [ "$RUNNER_OS" = "Windows" ]; then
echo Skipping tutorials \& how-tos that require pyscf
notebook_flags="${notebook_flags} --ignore=docs/entanglement_forging --ignore=docs/_build/jupyter_execute/entanglement_forging/how-tos"
Expand Down
3 changes: 2 additions & 1 deletion INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ take care when installing the toolbox, depending on which tools they
intend to use.

- The automatic wire cut search in the ``cutqc`` package depends
on CPLEX, which is only available on Intel chips.
on CPLEX, which is only available on Intel chips and is not yet available
for Python 3.12.
- The entanglement forging tool requires PySCF, which does not support Windows.

In each case, one method that is guaranteed to work is to :ref:`use
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Copy link
Collaborator

@caleb-johnson caleb-johnson Feb 2, 2024

Choose a reason for hiding this comment

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

So we report that we support it in the package description, but you do not want to add a README shield?

I wonder if we should not report that we support 3.12 at all until CPLEX catches up or we remove it in favor of a replacement cut-finding package

Copy link
Member Author

Choose a reason for hiding this comment

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

So we report that we support it in the package description, but you do not want to add a README shield?

Actually, the README shield is generated these days by querying the latest released version on pypi, so this PR (plus a release) will result in the shield being updated:

https://github.com/Qiskit-Extensions/circuit-knitting-toolbox/blob/a666e696486b58798084b231eb4ccc76640b5a64/README.md#L7

I wonder if we should not report that we support 3.12 at all until CPLEX catches up or we remove it in favor of a replacement cut-finding package

I think it's fine to say we support it in terms of the Trove classifiers, because we do. Partial functionality works, and full functionality will work once there are cplex wheels. But yeah, reasonable people could have different takes on this. I do think it's worth pointing out that one should currently expect only partial functionality under Python 3.12, and this is what the note in INSTALL.rst is for.

Long term it'd of course be nice to remove the current cplex stuff in favor of #471.

"Topic :: Scientific/Engineering :: Physics",
]

Expand All @@ -40,8 +41,8 @@ dependencies = [
cplex = [
# We use the same restrictions in both of the following lines, as there
# is no reason for us to install docplex without cplex.
"docplex>=2.23.222; platform_machine != 'arm64'",
"cplex>=22.1.0.0; platform_machine != 'arm64'",
"docplex>=2.23.222; python_version < '3.12' and platform_machine != 'arm64'",
"cplex>=22.1.0.0; python_version < '3.12' and platform_machine != 'arm64'",
]
pyscf = [
"pyscf>=2.0.1; sys_platform != 'win32'",
Expand Down Expand Up @@ -91,7 +92,7 @@ docs = [
]
notebook-dependencies = [
"circuit-knitting-toolbox[cplex,pyscf]",
"quantum-serverless>=0.0.7",
"quantum-serverless>=0.0.7; python_version < '3.12'",
"matplotlib",
"ipywidgets",
"pylatexenc",
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 = 3.25
envlist = py{38,39,310,311}{,-notebook}, lint, coverage, docs
envlist = py{38,39,310,311,312}{,-notebook}, lint, coverage, docs
isolated_build = True

[testenv]
Expand Down Expand Up @@ -34,7 +34,7 @@ commands =
pylint -rn --py-version=3.8 --disable=all --enable=reimported,no-self-use,no-else-raise,redefined-argument-from-local,redefined-builtin,raise-missing-from,cyclic-import,unused-argument circuit_knitting/ test/ tools/
nbqa pylint -rn --py-version=3.8 --disable=all --enable=reimported,no-self-use,no-else-raise,redefined-argument-from-local,redefined-builtin,raise-missing-from,cyclic-import,unused-argument docs/

[testenv:{,py-,py3-,py38-,py39-,py310-,py311-}notebook]
[testenv:{,py-,py3-,py38-,py39-,py310-,py311-,py312-}notebook]
extras =
nbtest
notebook-dependencies
Expand Down