Skip to content

Commit

Permalink
ci: Add Python 3.12 to testing to CI as default (#2460)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
matthewfeickert authored Mar 20, 2024
1 parent a0d94b9 commit dd4a243
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
12 changes: 6 additions & 6 deletions .github/workflows/dependencies-head.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
python-version: ['3.12']

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
python-version: ['3.12']

steps:
- uses: actions/checkout@v4
Expand All @@ -103,7 +103,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
python-version: ['3.12']

steps:
- uses: actions/checkout@v4
Expand All @@ -128,7 +128,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
python-version: ['3.12']

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -165,7 +165,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
python-version: ['3.12']

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
python-version: ['3.12']

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit dd4a243

Please sign in to comment.