From cd55d824f8c6c00f8d1d20f510b69a70068868a0 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 22 Mar 2023 17:23:40 -0500 Subject: [PATCH 01/11] ci: Add Python 3.11 to testing --- .github/workflows/bump-version.yml | 4 ++-- .github/workflows/ci.yml | 14 +++++++------- .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 ++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 326df4c9b1..11980b0444 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -177,11 +177,11 @@ jobs: echo ::set-output name=old_tag::v${current_tag} - - name: Set up Python 3.10 + - name: Set up Python 3.11 if: success() uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install Python dependencies run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e73b869818..95ba8cd694 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,10 +26,10 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11'] include: - os: macos-latest - python-version: '3.10' + python-version: '3.11' steps: - uses: actions/checkout@v3 @@ -80,30 +80,30 @@ jobs: coverage xml - name: Report contrib coverage with Codecov - if: github.event_name != 'schedule' && matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' + if: github.event_name != 'schedule' && matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v3 with: files: ./coverage.xml flags: contrib - name: Test docstring examples with doctest - if: matrix.python-version == '3.10' + if: matrix.python-version == '3.11' run: coverage run --data-file=.coverage-doctest --module pytest src/ README.rst - name: Coverage report for doctest only - if: matrix.python-version == '3.10' + if: matrix.python-version == '3.11' 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.10' && matrix.os == 'ubuntu-latest' + if: github.event_name != 'schedule' && matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v3 with: files: doctest-coverage.xml flags: doctest - name: Run benchmarks - if: github.event_name == 'schedule' && matrix.python-version == '3.10' + if: github.event_name == 'schedule' && matrix.python-version == '3.11' 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 7b3a0c38eb..1b69121271 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.10'] + python-version: ['3.11'] steps: - uses: actions/checkout@v3 @@ -47,7 +47,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.10'] + python-version: ['3.11'] steps: - uses: actions/checkout@v3 @@ -77,7 +77,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.10'] + python-version: ['3.11'] steps: - uses: actions/checkout@v3 @@ -103,7 +103,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.10'] + python-version: ['3.11'] steps: - uses: actions/checkout@v3 @@ -128,7 +128,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.10'] + python-version: ['3.11'] steps: - uses: actions/checkout@v3 @@ -164,7 +164,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.10'] + python-version: ['3.11'] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d4d5173906..65a49e5039 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -24,7 +24,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install Python dependencies run: | diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index cb20d80020..baaceeba92 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.10'] + python-version: ['3.11'] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 8b0df860b2..61f0dc0834 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -32,10 +32,10 @@ jobs: with: fetch-depth: 0 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install python-build and twine run: | diff --git a/.github/workflows/release_tests.yml b/.github/workflows/release_tests.yml index 6a71e36e96..411645c18d 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'] + python-version: ['3.8', '3.9', '3.10', '3.11'] include: - os: macos-latest - python-version: '3.10' + python-version: '3.11' steps: - uses: actions/checkout@v3 From f99e2ab9eb927a54bb02ff6ee00eb74e35188407 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 22 Mar 2023 17:28:55 -0500 Subject: [PATCH 02/11] Update mypy in pre-commit to Python 3.11 --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 88acb35976..d5cbaa2040 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -55,8 +55,8 @@ repos: ['numpy', 'types-tqdm', 'click', 'types-jsonpatch', 'types-pyyaml', 'types-jsonschema', 'importlib_metadata', 'packaging'] args: ["--python-version=3.8"] - <<: *mypy - name: mypy with Python 3.10 - args: ["--python-version=3.10"] + name: mypy with Python 3.11 + args: ["--python-version=3.11"] - repo: https://github.com/nbQA-dev/nbQA rev: 1.6.3 From e0506bfda33d2b1249850b1fcbca69cc6f76ff21 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 22 Mar 2023 17:29:38 -0500 Subject: [PATCH 03/11] Update RTD config to 3.11 --- .readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 59d96f9489..7c786083a9 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.10" + python: "3.11" apt_packages: - curl - jq From c6029b27cd3d48580353a909aebc0d9117324f1f Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 22 Mar 2023 17:30:12 -0500 Subject: [PATCH 04/11] Update Binder runtime to 3.11 --- CHECK THAT THIS IS VALID --- binder/runtime.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binder/runtime.txt b/binder/runtime.txt index 55090899d0..67ebc4e9a6 100644 --- a/binder/runtime.txt +++ b/binder/runtime.txt @@ -1 +1 @@ -python-3.10 +python-3.11 From bb3e5955f85b209c70466e946454db65e0bc1465 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 22 Mar 2023 17:31:30 -0500 Subject: [PATCH 05/11] docs: Add Python 3.11 to classifiers and codemeta --- codemeta.json | 1 + pyproject.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/codemeta.json b/codemeta.json index 7e8c018995..81f82e37e8 100644 --- a/codemeta.json +++ b/codemeta.json @@ -50,6 +50,7 @@ "runtimePlatform": [ "Python 3", "Python 3 Only", + "Python 3.11", "Python 3.10", "Python 3.8", "Python 3.9", diff --git a/pyproject.toml b/pyproject.toml index 0081464a4e..f1a383f819 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Physics", From 98c7ddd92c2bd9239c83c475dce80a02f40cd7fa Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 22 Mar 2023 17:32:46 -0500 Subject: [PATCH 06/11] Update docs to show Python 3.11 for dev --- docs/development.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/development.rst b/docs/development.rst index 0936538d6e..a35b2cba96 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -97,7 +97,7 @@ contrib module, or notebooks, and so instead to test the core codebase a develop .. code-block:: console - nox --session tests --python 3.10 + nox --session tests --python 3.11 Contrib module matplotlib image tests ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -107,7 +107,7 @@ To run the visualization tests for the ``contrib`` module with the ``pytest-mpl` .. code-block:: console - nox --session tests --python 3.10 -- contrib + nox --session tests --python 3.11 -- contrib If the image files need to be regenerated, run the tests with the ``--mpl-generate-path=tests/contrib/baseline`` option or just run @@ -141,7 +141,7 @@ or pass ``coverage`` as a positional argument to the ``nox`` ``tests`` session .. code-block:: console - nox --session tests --python 3.10 -- coverage + nox --session tests --python 3.11 -- coverage Coverage Report ^^^^^^^^^^^^^^^ From 92e1751dea194a35177fb6ba36bb56a28a41cdd0 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 22 Mar 2023 17:33:56 -0500 Subject: [PATCH 07/11] Add Python 3.11 to nox --- noxfile.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/noxfile.py b/noxfile.py index c7f814f3e2..a01049cbfc 100644 --- a/noxfile.py +++ b/noxfile.py @@ -4,10 +4,10 @@ import nox -ALL_PYTHONS = ["3.8", "3.9", "3.10"] +ALL_PYTHONS = ["3.8", "3.9", "3.10", "3.11"] # Default sessions to run if no session handles are passed -nox.options.sessions = ["lint", "tests-3.10"] +nox.options.sessions = ["lint", "tests-3.11"] DIR = Path(__file__).parent.resolve() @@ -30,10 +30,10 @@ def tests(session): Examples: - $ nox --session tests --python 3.10 - $ nox --session tests --python 3.10 -- contrib # run the contrib module tests - $ nox --session tests --python 3.10 -- tests/test_tensor.py # run specific tests - $ nox --session tests --python 3.10 -- coverage # run with coverage but slower + $ nox --session tests --python 3.11 + $ nox --session tests --python 3.11 -- contrib # run the contrib module tests + $ nox --session tests --python 3.11 -- tests/test_tensor.py # run specific tests + $ nox --session tests --python 3.11 -- coverage # run with coverage but slower """ session.install("--upgrade", "--editable", ".[test]") session.install("--upgrade", "pytest") From a220106a9f7b5e32b6fc956ce6f49448789f044f Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 22 Mar 2023 17:34:31 -0500 Subject: [PATCH 08/11] Update Dockerfile to use Python 3.11 --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 0c017e0a57..93b4751711 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE_IMAGE=python:3.10-slim-bullseye +ARG BASE_IMAGE=python:3.11-slim-bullseye # hadolint ignore=DL3006 FROM ${BASE_IMAGE} as base From 04a845be0438d83fb2b81af97e485870581b579d Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 22 Mar 2023 17:35:56 -0500 Subject: [PATCH 09/11] Add Python 3.11 to linting tool configs --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f1a383f819..d08338ae00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -151,7 +151,7 @@ packages = ["src/pyhf"] [tool.black] line-length = 88 -target-version = ['py38', 'py39', 'py310'] +target-version = ['py38', 'py39', 'py310', 'py311'] skip-string-normalization = true include = '\.pyi?$' exclude = ''' @@ -225,7 +225,7 @@ show_missing = true [tool.mypy] files = "src" -python_version = "3.10" +python_version = "3.11" warn_unused_configs = true strict = true show_error_codes = true From 414ea4b2bd6079289f04688ae83871a3940d90ac Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 22 Mar 2023 19:16:19 -0500 Subject: [PATCH 10/11] Ignore deprecation warning RE: sre_constants from tensorflow --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index d08338ae00..8b98f2920c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -211,6 +211,7 @@ filterwarnings = [ 'ignore:[A-Z]+ is deprecated and will be removed in Pillow 10:DeprecationWarning', # keras 'ignore:Call to deprecated create function:DeprecationWarning', # protobuf via tensorflow 'ignore:`np.bool8` is a deprecated alias for `np.bool_`:DeprecationWarning', # numpy via tensorflow + "ignore:module 'sre_constants' is deprecated:DeprecationWarning", # tensorflow v2.12.0+ ] [tool.coverage.run] From aaef56bbff3f82a672255806d7df3cd642e2ec00 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 23 Mar 2023 10:24:21 -0500 Subject: [PATCH 11/11] Note for Python 3.11+ --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8b98f2920c..ba5659fe6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -211,7 +211,7 @@ filterwarnings = [ 'ignore:[A-Z]+ is deprecated and will be removed in Pillow 10:DeprecationWarning', # keras 'ignore:Call to deprecated create function:DeprecationWarning', # protobuf via tensorflow 'ignore:`np.bool8` is a deprecated alias for `np.bool_`:DeprecationWarning', # numpy via tensorflow - "ignore:module 'sre_constants' is deprecated:DeprecationWarning", # tensorflow v2.12.0+ + "ignore:module 'sre_constants' is deprecated:DeprecationWarning", # tensorflow v2.12.0+ for Python 3.11+ ] [tool.coverage.run]