From db67210ec76007db1a5b6818644fe721662d5249 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Wed, 20 Mar 2024 13:06:03 -0500 Subject: [PATCH] chore: Update services and docs to Python 3.12 as default (#2461) * Update to using Python 3.12 in linting and validation tools. * Update Binder runtime Python to Python 3.12. * Update Dockerfile base image to python:3.12-slim-bullseye. * Update the docs to advocate using Python 3.12 for development. --- .pre-commit-config.yaml | 4 ++-- .readthedocs.yaml | 2 +- binder/runtime.txt | 2 +- codemeta.json | 1 + docker/Dockerfile | 2 +- docs/development.rst | 6 +++--- noxfile.py | 12 ++++++------ pyproject.toml | 2 +- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 92d2a4223b..047103c327 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -64,8 +64,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.11 - args: ["--python-version=3.11"] + name: mypy with Python 3.12 + args: ["--python-version=3.12"] - repo: https://github.com/codespell-project/codespell rev: v2.2.6 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index bdab4e8207..bd5f4ea9cd 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.11" + python: "3.12" apt_packages: - curl - jq diff --git a/binder/runtime.txt b/binder/runtime.txt index 67ebc4e9a6..d2aca3a7e1 100644 --- a/binder/runtime.txt +++ b/binder/runtime.txt @@ -1 +1 @@ -python-3.11 +python-3.12 diff --git a/codemeta.json b/codemeta.json index 67ffefec40..1b9ca9c817 100644 --- a/codemeta.json +++ b/codemeta.json @@ -50,6 +50,7 @@ "runtimePlatform": [ "Python 3", "Python 3 Only", + "Python 3.12", "Python 3.11", "Python 3.10", "Python 3.8", diff --git a/docker/Dockerfile b/docker/Dockerfile index 50c2f31e95..154d279e35 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE_IMAGE=python:3.11-slim-bullseye +ARG BASE_IMAGE=python:3.12-slim-bullseye # hadolint ignore=DL3006 FROM ${BASE_IMAGE} as base diff --git a/docs/development.rst b/docs/development.rst index 324b8110bf..fa6149a8a9 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.11 + nox --session tests --python 3.12 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.11 -- contrib + nox --session tests --python 3.12 -- 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.11 -- coverage + nox --session tests --python 3.12 -- coverage Coverage Report ^^^^^^^^^^^^^^^ diff --git a/noxfile.py b/noxfile.py index 8104dbd28b..1828383486 100644 --- a/noxfile.py +++ b/noxfile.py @@ -4,10 +4,10 @@ import nox -ALL_PYTHONS = ["3.8", "3.9", "3.10", "3.11"] +ALL_PYTHONS = ["3.8", "3.9", "3.10", "3.11", "3.12"] # Default sessions to run if no session handles are passed -nox.options.sessions = ["lint", "tests-3.11"] +nox.options.sessions = ["lint", "tests-3.12"] DIR = Path(__file__).parent.resolve() @@ -30,10 +30,10 @@ def tests(session): Examples: - $ 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 + $ nox --session tests --python 3.12 + $ nox --session tests --python 3.12 -- contrib # run the contrib module tests + $ nox --session tests --python 3.12 -- tests/test_tensor.py # run specific tests + $ nox --session tests --python 3.12 -- coverage # run with coverage but slower """ session.install("--upgrade", "--editable", ".[all,test]") session.install("--upgrade", "pytest") diff --git a/pyproject.toml b/pyproject.toml index 6383e1b6b7..f113ca1fed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -244,7 +244,7 @@ exclude_also = [ [tool.mypy] files = "src" -python_version = "3.11" +python_version = "3.12" warn_unused_configs = true strict = true enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]