From c9000b525007699ea0a5d7b8dad9718120b22fa7 Mon Sep 17 00:00:00 2001 From: Jim Garrison Date: Mon, 2 Oct 2023 13:03:17 -0400 Subject: [PATCH 1/2] WIP: Add support for Python 3.12 --- .github/workflows/test_latest_versions.yml | 6 +++++- INSTALL.rst | 3 ++- pyproject.toml | 5 +++-- tox.ini | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_latest_versions.yml b/.github/workflows/test_latest_versions.yml index abacaa444..8d749e708 100644 --- a/.github/workflows/test_latest_versions.yml +++ b/.github/workflows/test_latest_versions.yml @@ -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" @@ -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 + 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" + 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" diff --git a/INSTALL.rst b/INSTALL.rst index f6dd121c7..c81f44dab 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 83555b270..a12393f3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", "Topic :: Scientific/Engineering :: Physics", ] @@ -41,8 +42,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'", diff --git a/tox.ini b/tox.ini index 6a2b05d6b..caf6c8dd8 100644 --- a/tox.ini +++ b/tox.ini @@ -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] @@ -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 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 docs/ -[testenv:{,py-,py3-,py38-,py39-,py310-,py311-}notebook] +[testenv:{,py-,py3-,py38-,py39-,py310-,py311-,py312-}notebook] extras = nbtest notebook-dependencies From fd1a0501e777b746ed38b206c95d7552377cee56 Mon Sep 17 00:00:00 2001 From: Jim Garrison Date: Wed, 29 Nov 2023 14:24:28 -0500 Subject: [PATCH 2/2] Disable tests using quantum-serverless ... which does not yet work on Python 3.12 --- .github/workflows/test_latest_versions.yml | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_latest_versions.yml b/.github/workflows/test_latest_versions.yml index 8d749e708..3d2e4e3b4 100644 --- a/.github/workflows/test_latest_versions.yml +++ b/.github/workflows/test_latest_versions.yml @@ -48,8 +48,8 @@ jobs: tox -epy${pver/./} -- --run-slow notebook_flags="" if [ "$pver" = "3.12" ]; then - echo Skipping tutorials that require cplex - 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" + 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 diff --git a/pyproject.toml b/pyproject.toml index 5313c5497..25abaee97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,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",