From 064ac45c726a3d8e0f601591f798c7e5146162e5 Mon Sep 17 00:00:00 2001
From: Aliaksei Urbanski <aliaksei.urbanski@gmail.com>
Date: Fri, 10 Nov 2023 00:27:45 +0300
Subject: [PATCH] Add support for Python 3.11/3.12

These changes:
  * enable testing for Python 3.11/3.12
  * update classifiers at setup.py
  * remove pyright from tox.ini since there's
    no corresponding testenv configuration
---
 .github/workflows/ci.yml | 4 ++++
 pyproject.toml           | 2 ++
 requirements.txt         | 2 ++
 setup.py                 | 6 ++++--
 tox.ini                  | 7 ++++---
 5 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1097ec40c..ddbf3cf6d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -74,8 +74,12 @@ jobs:
             "3.8",
             "3.9",
             "3.10",
+            "3.11",
+            "3.12",
             "pypy-3.7",
             "pypy-3.8",
+            "pypy-3.9",
+            "pypy-3.10",
           ]
 
     steps:
diff --git a/pyproject.toml b/pyproject.toml
index 9f868c507..9a1fe8b0a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,6 +7,8 @@ target-version = [
   "py38",
   "py39",
   "py310",
+#   "py311",  # black 21.12b0 doesn't
+#   "py312",  # support these targets
 ]
 exclude = '''
 /(
diff --git a/requirements.txt b/requirements.txt
index 294d65862..b94f2a788 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -7,6 +7,8 @@ pytest-cov >= 2.8.1, < 2.11.0
 pytest-mock >= 2.0.0
 pytest-xdist >= 1.31.0
 pytest >= 6.0.0
+# black==23.11.0 supports py311/py312 targets,
+# but it's keen to reformat way too many files
 black==21.12b0
 click==8.0.4 # Version 8.1 breaks black
 flake8
diff --git a/setup.py b/setup.py
index 7464eb739..e8a1f49d5 100644
--- a/setup.py
+++ b/setup.py
@@ -51,13 +51,15 @@
         "Operating System :: OS Independent",
         "Programming Language :: Python",
         "Programming Language :: Python :: 3",
-        "Programming Language :: Python :: 3.4",
-        "Programming Language :: Python :: 3.5",
+        "Programming Language :: Python :: 3 :: Only",
         "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "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",
         "Programming Language :: Python :: Implementation :: PyPy",
         "Topic :: Software Development :: Libraries :: Python Modules",
     ],
diff --git a/tox.ini b/tox.ini
index c8190d5a8..c37452d52 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,12 +7,13 @@
 envlist =
     fmt
     lint
-    pyright
-    py{310,39,38,37,36,py3}
+    py{312,311,310,39,38,37,36,py3}
 skip_missing_interpreters = true
 
 [gh-actions]
 python =
+    3.12: py312
+    3.11: py311
     3.10: py310
     3.9: py39
     3.8: py38
@@ -63,4 +64,4 @@ passenv = GITHUB_*
 commands =
     coverage combine
     coveralls --service=github
-depends = py{310,39,38,37,36,py3}
+depends = py{312,311,310,39,38,37,36,py3}