From adf5f969ca85ab959047354ac48f92597c042921 Mon Sep 17 00:00:00 2001 From: nate stemen Date: Wed, 26 Jun 2024 12:16:19 -0700 Subject: [PATCH] Support python 3.12 and drop 3.9 (#2066) * add python 3.12 to CI * use python 3.12 on RTD * remove python 3.9 support/tests --- .github/workflows/build.yml | 10 +++++----- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/publish-testpypi.yml | 2 +- .readthedocs.yml | 2 +- CONTRIBUTING.md | 2 +- pyproject.toml | 1 + requirements/requirements-pennylane.txt | 4 +--- setup.py | 2 +- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 587122f822..f4445af8aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install Python dependencies run: | python -m pip install --upgrade pip @@ -43,7 +43,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install Python dependencies run: | @@ -91,7 +91,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install Mitiq # Since requirements.txt includes cirq, which in turn has pyquil as dependency, # we explicitly remove pyquil from the installed packages after installing mitiq @@ -110,7 +110,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }} steps: - name: Check out mitiq @@ -135,7 +135,7 @@ jobs: run: ${{ matrix.os == 'ubuntu-latest' && 'make test-all' || 'make test' }} - name: Submit coverage report to Codecov # Only submit to Codecov once. - if: ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'}} + if: ${{ matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'}} uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 77fe5f9423..e5c593959f 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -21,7 +21,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install Python dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/publish-testpypi.yml b/.github/workflows/publish-testpypi.yml index 76e5c51629..fad0019396 100644 --- a/.github/workflows/publish-testpypi.yml +++ b/.github/workflows/publish-testpypi.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install Python dependencies run: | python -m pip install --upgrade pip diff --git a/.readthedocs.yml b/.readthedocs.yml index f91e870862..aba2bf8c34 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.11" + python: "3.12" # Build documentation in the docs/ directory with Sphinx sphinx: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index efe9ec988f..92ed250bcd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,7 +12,7 @@ The rest of this document describes the technical details of getting set up to d ## Development environment -1. Ensure you have python 3.9 or greater installed. If not, you can find the downloads [here](https://www.python.org/downloads/). +1. Ensure you have python 3.10 or greater installed. If not, you can find the downloads [here](https://www.python.org/downloads/). 2. Set up a virtual environment to isolate dependencies. This can be done with many different tools including [Virtualenv](https://virtualenv.pypa.io/en/latest/), [Pipenv](https://pypi.org/project/pipenv/), [Poetry](https://python-poetry.org/), and [Anaconda](https://www.anaconda.com/download). In what follows we will use Anaconda, but if you're familiar with other tools feel free to use those. 3. Set up a local version of the [Mitiq repository](https://github.com/unitaryfund/mitiq). To do this you will need to use `git` which is a version control system. If you're unfamiliar, check out the [docs](https://git-scm.com/), and learn about what the typical [`git` workflow](https://www.asmeurer.com/git-workflow/) looks like. 4. Inside the Mitiq repository (`cd mitiq`), activate a virtual environment. With conda this is done using the following command. diff --git a/pyproject.toml b/pyproject.toml index 4c79f8e840..8e93f06baa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [tool.ruff] exclude = ["__init__.py"] line-length = 79 +target-version = 'py312' [tool.ruff.lint] select = [ diff --git a/requirements/requirements-pennylane.txt b/requirements/requirements-pennylane.txt index e43860ee2d..e42f642706 100644 --- a/requirements/requirements-pennylane.txt +++ b/requirements/requirements-pennylane.txt @@ -1,4 +1,2 @@ pennylane-qiskit~=0.36.0 -pennylane~=0.36.0 -# TODO: Remove qiskit-ibm-provider when upgrading qiskit-ibm-runtime in requirements-qiskit -qiskit-ibm-provider~=0.11.0; python_version == '3.9' \ No newline at end of file +pennylane~=0.36.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 2d500d2270..db01d4f775 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,7 @@ def load_requirements(filename): "Documentation": "https://mitiq.readthedocs.io/en/stable/", "Source": "https://github.com/unitaryfund/mitiq/", }, - python_requires=">=3.9,<3.12", + python_requires=">=3.10,<3.13", ) # restore _version.py to its previous state