From ce576f1e463c6d43a58186d18139baba58f3e890 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Wed, 3 Jan 2024 14:14:36 -0800 Subject: [PATCH] Switch to Python 3.12 Require Python 3.12 as the minimum version, update GitHub Actions accordingly, and remove an old workaround for Python 3.10. --- .github/workflows/ci.yaml | 8 ++++---- .github/workflows/dependencies.yaml | 2 +- .github/workflows/periodic-ci.yaml | 4 ++-- pyproject.toml | 8 ++++++-- requirements/dev.txt | 2 +- requirements/main.txt | 6 +----- tests/support/kubernetes.py | 6 +----- 7 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3c94dbd19..bea362930 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -58,7 +58,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" # This has to happen after installing Node modules because we run # eslint and it wants react to be already installed. We therefore @@ -89,7 +89,7 @@ jobs: strategy: matrix: python: - - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 @@ -137,7 +137,7 @@ jobs: - uses: lsst-sqre/run-tox@v1 with: - python-version: "3.11" + python-version: "3.12" tox-envs: "docs" cache-key-prefix: "docs" @@ -172,7 +172,7 @@ jobs: - name: Check links uses: lsst-sqre/run-tox@v1 with: - python-version: "3.11" + python-version: "3.12" tox-envs: "docs-linkcheck" build: diff --git a/.github/workflows/dependencies.yaml b/.github/workflows/dependencies.yaml index f7525cedb..acc55ebe8 100644 --- a/.github/workflows/dependencies.yaml +++ b/.github/workflows/dependencies.yaml @@ -15,7 +15,7 @@ jobs: - uses: lsst-sqre/run-neophile@v1 with: - python-version: "3.11" + python-version: "3.12" mode: pr types: pre-commit app-id: ${{ secrets.NEOPHILE_APP_ID }} diff --git a/.github/workflows/periodic-ci.yaml b/.github/workflows/periodic-ci.yaml index e94a949c3..93494199f 100644 --- a/.github/workflows/periodic-ci.yaml +++ b/.github/workflows/periodic-ci.yaml @@ -17,7 +17,7 @@ jobs: strategy: matrix: python: - - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 @@ -27,7 +27,7 @@ jobs: # how dependencies should later be updated. - uses: lsst-sqre/run-neophile@v1 with: - python-version: "3.11" + python-version: "3.12" mode: update - name: Set up Node diff --git a/pyproject.toml b/pyproject.toml index 103d778aa..99e9d063d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,12 +14,12 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Natural Language :: English", "Operating System :: POSIX", "Typing :: Typed", ] -requires-python = ">=3.11" +requires-python = ">=3.12" dependencies = [] dynamic = ["version"] @@ -114,6 +114,10 @@ filterwarnings = [ # Google modules call a deprecated pkg_resources API. "ignore:pkg_resources is deprecated as an API:DeprecationWarning", "ignore:.*pkg_resources\\.declare_namespace:DeprecationWarning", + # Google modules use PyType_Spec in a deprecated way. + "ignore:Type google\\..*metaclass.* custom tp_new:DeprecationWarning", + # dateutil uses a deprecated datetime function. + "ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning:dateutil.*", # Bug in kopf "ignore:.*require all values to be sortable:DeprecationWarning:kopf.*", ] diff --git a/requirements/dev.txt b/requirements/dev.txt index 7a89e8e43..0ed72c5e5 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --generate-hashes --output-file=requirements/dev.txt requirements/dev.in diff --git a/requirements/main.txt b/requirements/main.txt index 447aa1d7a..40d082c42 100644 --- a/requirements/main.txt +++ b/requirements/main.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --generate-hashes --output-file=requirements/main.txt requirements/main.in @@ -99,10 +99,6 @@ anyio==4.2.0 \ # httpx # starlette # watchfiles -async-timeout==4.0.3 \ - --hash=sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f \ - --hash=sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028 - # via asyncpg asyncpg==0.29.0 \ --hash=sha256:0009a300cae37b8c525e5b449233d59cd9868fd35431abc470a3e364d2b85cb9 \ --hash=sha256:000c996c53c04770798053e1730d34e30cb645ad95a63265aec82da9093d88e7 \ diff --git a/tests/support/kubernetes.py b/tests/support/kubernetes.py index 0f2b017a9..46aecb658 100644 --- a/tests/support/kubernetes.py +++ b/tests/support/kubernetes.py @@ -184,11 +184,7 @@ async def assert_custom_resource_status_is( } transition_str = seen["status"]["create"]["lastTransitionTime"] assert transition_str.endswith("Z") - - # Python 3.11 can parse the string as-is, but Python 3.10 and earlier - # doesn't like the Z. - transition = datetime.fromisoformat(transition_str.replace("Z", "+00:00")) - + transition = datetime.fromisoformat(transition_str) now = current_datetime() assert now - timedelta(seconds=30) <= transition <= now