From dd4a243588a79aedde84b4fe43a4570d84b8a6ec Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 20 Mar 2024 12:48:40 -0500 Subject: [PATCH] ci: Add Python 3.12 to testing to CI as default (#2460) * Add Python 3.12 to testing in CI. * Default to using Python 3.12 in GitHub Actions where possible. * Add ignore of DeprecationWarning for protobuf * Add Python 3.12 trove classifier to PyPI metadata. --- .github/workflows/bump-version.yml | 4 ++-- .github/workflows/ci-windows.yml | 2 +- .github/workflows/ci.yml | 16 ++++++++-------- .github/workflows/dependencies-head.yml | 12 ++++++------ .github/workflows/docs.yml | 2 +- .github/workflows/notebooks.yml | 2 +- .github/workflows/publish-package.yml | 4 ++-- .github/workflows/release_tests.yml | 4 ++-- pyproject.toml | 4 +++- 9 files changed, 26 insertions(+), 24 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 3f4d4cb074..8083fa8a43 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -196,11 +196,11 @@ jobs: echo "steps.script.outputs.old_tag=v${current_tag}" echo "old_tag=v${current_tag}" >> $GITHUB_OUTPUT - - name: Set up Python 3.11 + - name: Set up Python 3.12 if: success() uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - name: Install Python dependencies run: | diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index d2d7f3c792..c9f3e8e68b 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: os: [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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 218b0ebc55..65d7e656dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,13 +27,13 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] include: - os: macos-latest - python-version: '3.11' + python-version: '3.12' # Apple silicon runner - os: macos-14 - python-version: '3.11' + python-version: '3.12' steps: - uses: actions/checkout@v4 @@ -86,7 +86,7 @@ jobs: coverage xml - name: Report contrib coverage with Codecov - if: github.event_name != 'schedule' && matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' + if: github.event_name != 'schedule' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v4 with: fail_ci_if_error: true @@ -96,17 +96,17 @@ jobs: - name: Test docstring examples with doctest # TODO: Don't currently try to match amd64 and arm64 floating point for docs, but will in the future. - if: matrix.python-version == '3.11' && matrix.os != 'macos-14' + if: matrix.python-version == '3.12' && matrix.os != 'macos-14' run: coverage run --data-file=.coverage-doctest --module pytest src/ README.rst - name: Coverage report for doctest only - if: matrix.python-version == '3.11' && matrix.os != 'macos-14' + if: matrix.python-version == '3.12' && matrix.os != 'macos-14' run: | coverage report --data-file=.coverage-doctest coverage xml --data-file=.coverage-doctest -o doctest-coverage.xml - name: Report doctest coverage with Codecov - if: github.event_name != 'schedule' && matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' + if: github.event_name != 'schedule' && matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v4 with: fail_ci_if_error: true @@ -115,6 +115,6 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} - name: Run benchmarks - if: github.event_name == 'schedule' && matrix.python-version == '3.11' + if: github.event_name == 'schedule' && matrix.python-version == '3.12' run: | pytest --benchmark-sort=mean tests/benchmarks/test_benchmark.py diff --git a/.github/workflows/dependencies-head.yml b/.github/workflows/dependencies-head.yml index fc5e16c1f3..1e4651251f 100644 --- a/.github/workflows/dependencies-head.yml +++ b/.github/workflows/dependencies-head.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - python-version: ['3.11'] + python-version: ['3.12'] steps: - uses: actions/checkout@v4 @@ -47,7 +47,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.11'] + python-version: ['3.12'] steps: - uses: actions/checkout@v4 @@ -77,7 +77,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.11'] + python-version: ['3.12'] steps: - uses: actions/checkout@v4 @@ -103,7 +103,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.11'] + python-version: ['3.12'] steps: - uses: actions/checkout@v4 @@ -128,7 +128,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.11'] + python-version: ['3.12'] steps: - uses: actions/checkout@v4 @@ -165,7 +165,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.11'] + python-version: ['3.12'] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5af25f1632..f040b74ccc 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -24,7 +24,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: | diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index e961de6f56..7ab2b048f8 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.11'] + python-version: ['3.12'] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 786f410998..cd5d4a9ba7 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -36,10 +36,10 @@ jobs: with: fetch-depth: 0 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - name: Install python-build and twine run: | diff --git a/.github/workflows/release_tests.yml b/.github/workflows/release_tests.yml index 85034114c9..b149d22d11 100644 --- a/.github/workflows/release_tests.yml +++ b/.github/workflows/release_tests.yml @@ -18,10 +18,10 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] include: - os: macos-latest - python-version: '3.11' + python-version: '3.12' steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index fbc4f47d4d..6383e1b6b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Physics", @@ -106,7 +107,7 @@ test = [ "pytest-mpl", "ipympl>=0.3.0", "pydocstyle", - "papermill~=2.3.4", + "papermill~=2.5.0", "scrapbook~=0.5.0", "jupyter", "graphviz", @@ -225,6 +226,7 @@ filterwarnings = [ "ignore:ml_dtypes.float8_e4m3b11 is deprecated.", #FIXME: Can remove when jaxlib>=0.4.12 "ignore:jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the:DeprecationWarning", # Issue #2139 "ignore:Skipping device Apple Paravirtual device that does not support Metal 2.0:UserWarning", # Can't fix given hardware/virtualized device + 'ignore:Type google._upb._message.[A-Z]+ uses PyType_Spec with a metaclass that has custom:DeprecationWarning', # protobuf via tensorflow ] [tool.coverage.run]