From 044824af4adae54576c701fd62d12f99dd036c40 Mon Sep 17 00:00:00 2001 From: Andreas Maier Date: Sun, 22 Oct 2023 09:33:39 +0200 Subject: [PATCH] Added support for Python 3.12 Details: * Added Python 3.12 to test workflow, setup.py and tox.ini. * Had to increase the minimum versions of setuptools to 66.1.0 and pip to 23.1.2 in order to address removal of the long deprecated pkgutils.ImpImporter in Python 3.12. Signed-off-by: Andreas Maier --- .github/workflows/test.yml | 15 ++++++++++----- dev-requirements.txt | 22 +++++++++++++--------- docs/changes.rst | 6 ++++++ minimum-constraints.txt | 36 ++++++++++++++++++++++-------------- requirements.txt | 4 +++- setup.py | 1 + tox.ini | 19 +++++++++++++++++++ 7 files changed, 74 insertions(+), 29 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf755194..a9bafaa3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: if [[ "${{ github.event_name }}" == "schedule" || "${{ github.head_ref }}" =~ ^release_ ]]; then \ echo "matrix={ \ \"os\": [ \"ubuntu-latest\", \"macos-latest\", \"windows-latest\" ], \ - \"python-version\": [ \"3.6\", \"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\" ], \ + \"python-version\": [ \"3.6\", \"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"3.12\" ], \ \"package_level\": [ \"minimum\", \"latest\" ], \ \"exclude\": [ \ { \ @@ -65,7 +65,7 @@ jobs: else \ echo "matrix={ \ \"os\": [ \"ubuntu-latest\" ], \ - \"python-version\": [ \"3.11\" ], \ + \"python-version\": [ \"3.12\" ], \ \"package_level\": [ \"minimum\", \"latest\" ], \ \"include\": [ \ { \ @@ -80,7 +80,12 @@ jobs: }, \ { \ \"os\": \"macos-latest\", \ - \"python-version\": \"3.11\", \ + \"python-version\": \"3.12\", \ + \"package_level\": \"minimum\" \ + }, \ + { \ + \"os\": \"macos-latest\", \ + \"python-version\": \"3.12\", \ \"package_level\": \"latest\" \ }, \ { \ @@ -90,12 +95,12 @@ jobs: }, \ { \ \"os\": \"windows-latest\", \ - \"python-version\": \"3.11\", \ + \"python-version\": \"3.12\", \ \"package_level\": \"minimum\" \ }, \ { \ \"os\": \"windows-latest\", \ - \"python-version\": \"3.11\", \ + \"python-version\": \"3.12\", \ \"package_level\": \"latest\" \ } \ ] \ diff --git a/dev-requirements.txt b/dev-requirements.txt index 92b8468b..ac79c9d9 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -25,7 +25,8 @@ tox>=2.5.0 # Virtualenv # build requires virtualenv.cli_run which was added in 20.1 -virtualenv>=20.1.0 +virtualenv>=20.1.0; python_version <= '3.11' +virtualenv>=20.23.0; python_version >= '3.12' # PEP517 package builder, used in Makefile build>=0.5.0 @@ -41,8 +42,8 @@ dparse>=0.6.2 pytest>=4.6.11; python_version <= '3.9' pytest>=6.2.5; python_version >= '3.10' # flake8 up to 6.0.0 has not yet adjusted to the removed interfaces of importlib-metadata 5.0 -importlib-metadata>=0.22,<4.3; python_version == '3.6' -importlib-metadata>=1.1.0,<4.3; python_version >= '3.7' +importlib-metadata>=2.1.3,<5; python_version == '3.6' +importlib-metadata>=4.8.3,<5; python_version >= '3.7' # packaging is used by pytest, pip-check-reqs, sphinx # packaging>=20.5 is needed by pip-check-reqs 2.4.3 but it requires only packaging>=16.0 @@ -88,7 +89,8 @@ lazy-object-proxy>=1.4.3 wrapt>=1.11.2; python_version <= '3.10' wrapt>=1.14; python_version >= '3.11' # platformdirs is used by pylint starting with its 2.10 -platformdirs>=2.2.0 +platformdirs>=2.2.0; python_version <= '3.11' +platformdirs>=3.2.0; python_version >= '3.12' # isort 4.2.8 fixes a pylint issue with false positive on import order of ssl on Windows # isort 4.3.8 fixes an issue with py310 and works on py310 (Note that isort 5.10.0 has official support for py310) isort>=4.3.8 @@ -101,12 +103,13 @@ dill>=0.3.6; python_version >= '3.11' # Flake8 and dependents (no imports, invoked via flake8 script): # flake8 4.0.0 fixes an AttributeError on Python 3.10. flake8>=3.8.0; python_version <= '3.9' -flake8>=4.0.0; python_version >= '3.10' -mccabe>=0.6.0 +flake8>=5.0.0; python_version >= '3.10' +mccabe>=0.6.0; python_version <= '3.9' +mccabe>=0.7.0; python_version >= '3.10' pycodestyle>=2.6.0; python_version <= '3.9' -pycodestyle>=2.8.0; python_version >= '3.10' +pycodestyle>=2.9.0; python_version >= '3.10' pyflakes>=2.2.0; python_version <= '3.9' -pyflakes>=2.4.0; python_version >= '3.10' +pyflakes>=2.5.0; python_version >= '3.10' entrypoints>=0.3.0 # Twine (no imports, invoked via twine script): @@ -126,4 +129,5 @@ pipdeptree>=2.2.0 # pip-check-reqs 2.4.3 fixes a speed issue on Python 3.11 and requires pip>=21.2.4 # pip-check-reqs 2.5.0 has issue https://github.com/r1chardj0n3s/pip-check-reqs/issues/143 pip-check-reqs>=2.3.2; python_version <= '3.7' -pip-check-reqs>=2.4.3,!=2.5.0; python_version >= '3.8' +pip-check-reqs>=2.4.3,!=2.5.0; python_version >= '3.8' and python_version <= '3.11' +pip-check-reqs>=2.5.1; python_version >= '3.12' diff --git a/docs/changes.rst b/docs/changes.rst index 3a936779..f59dfdb3 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -44,6 +44,12 @@ Released: not yet **Enhancements:** +* Added support for Python 3.12. Had to increase the minimum versions of + setuptools to 66.1.0 and pip to 23.1.2 in order to address removal of the + long deprecated pkgutils.ImpImporter in Python 3.12, as well as the + minimum version of click-spinner to 0.1.10, as well as several + packages used only for development. (issue #497) + **Cleanup:** **Known issues:** diff --git a/minimum-constraints.txt b/minimum-constraints.txt index d3691c67..365329ce 100644 --- a/minimum-constraints.txt +++ b/minimum-constraints.txt @@ -26,10 +26,12 @@ # Pip 20.2 introduced a new resolver whose backtracking had issues that were resolved only in 21.2.2. # pip>=21.0 is needed for the cryptography package on Windows on GitHub Actions. pip==21.2.4; python_version >= '3.6' and python_version <= '3.9' -pip==23.0.1; python_version >= '3.10' +pip==23.0.1; python_version >= '3.10' and python_version <= '3.11' +pip==23.2.0; python_version >= '3.12' # setuptools 59.7.0 removed support for py36 setuptools==59.6.0; python_version == '3.6' -setuptools==65.5.1; python_version >= '3.7' +setuptools==65.5.1; python_version >= '3.7' and python_version <= '3.11' +setuptools==66.1.0; python_version >= '3.12' wheel==0.30.0; python_version == '3.6' wheel==0.38.1; python_version >= '3.7' @@ -40,7 +42,8 @@ zhmcclient==1.10.0 click==8.0.2 click-repl==0.2 -click-spinner==0.1.6 +click-spinner==0.1.6; python_version <= '3.11' +click-spinner==0.1.10; python_version >= '3.12' progressbar2==3.12.0 tabulate==0.8.2; python_version <= '3.9' tabulate==0.8.8; python_version >= '3.10' @@ -87,7 +90,8 @@ six==1.16.0; python_version >= '3.10' tox==2.5.0 # Virtualenv -virtualenv==20.1.0 +virtualenv==20.1.0; python_version <= '3.11' +virtualenv==20.23.0; python_version >= '3.12' # PEP517 package builder, used in Makefile build==0.5.0 @@ -102,8 +106,8 @@ dparse==0.6.2 # pytest 4.3.1 solves an issue on Python 3 with minimum package levels pytest==4.6.11; python_version >= '3.6' and python_version <= '3.9' pytest==6.2.5; python_version >= '3.10' -importlib-metadata==0.22; python_version == '3.6' -importlib-metadata==1.1.0; python_version >= '3.7' +importlib-metadata==2.1.3; python_version == '3.6' +importlib-metadata==4.8.3; python_version >= '3.7' packaging==21.0 @@ -136,7 +140,8 @@ typed-ast==1.4.0; python_version >= '3.6' and python_version <= '3.7' and implem lazy-object-proxy==1.4.3 wrapt==1.12; python_version >= '3.6' and python_version <= '3.10' wrapt==1.14; python_version >= '3.11' -platformdirs==2.2.0 +platformdirs==2.2.0; python_version >= '3.6' and python_version <= '3.11' +platformdirs==3.2.0; python_version >= '3.12' isort==4.3.8 tomlkit==0.10.1; python_version >= '3.7' dill==0.2; python_version >= '3.6' and python_version <= '3.10' @@ -144,12 +149,13 @@ dill==0.3.6; python_version >= '3.11' # Flake8 (no imports, invoked via flake8 script): flake8==3.8.0; python_version <= '3.9' -flake8==4.0.0; python_version >= '3.10' -mccabe==0.6.0 +flake8==5.0.0; python_version >= '3.10' +mccabe==0.6.0; python_version <= '3.9' +mccabe==0.7.0; python_version >= '3.10' pycodestyle==2.6.0; python_version <= '3.9' -pycodestyle==2.8.0; python_version >= '3.10' +pycodestyle==2.9.0; python_version >= '3.10' pyflakes==2.2.0; python_version <= '3.9' -pyflakes==2.4.0; python_version >= '3.10' +pyflakes==2.5.0; python_version >= '3.10' entrypoints==0.3.0 # Twine (no imports, invoked via twine script): @@ -165,7 +171,8 @@ pluggy==0.13.1 # Package dependency management tools (not used by any make rules) pipdeptree==2.2.0 pip-check-reqs==2.3.2; python_version >= '3.6' and python_version <= '3.7' -pip-check-reqs==2.4.3; python_version >= '3.8' +pip-check-reqs==2.4.3; python_version >= '3.8' and python_version <= '3.11' +pip-check-reqs==2.5.1; python_version >= '3.12' # Indirect dependencies for development (must be consistent with dev-requirements.txt) @@ -180,8 +187,9 @@ clint==0.5.1 colorama==0.4.5 configparser==4.0.2 contextlib2==0.6.0 -distlib==0.3.4 -filelock==3.2.0 +distlib==0.3.6 +filelock==3.2.0; python_version <= "3.11" +filelock==3.11.0; python_version >= "3.12" gitdb2==2.0.0; python_version == '3.6' gitdb==4.0.8 imagesize==0.7.1 diff --git a/requirements.txt b/requirements.txt index 9d57a401..318c4b0f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,7 +18,9 @@ click>=8.0.2 # click-repl 0.2 is needed for compatibility with Click 8.0 (see click-repl issue #819) click-repl>=0.2 -click-spinner>=0.1.6 +# click-spinner 0.1.10 is needed to support Python 3.12 +click-spinner>=0.1.6; python_version <= '3.11' +click-spinner>=0.1.10; python_version >= '3.12' progressbar2>=3.12.0 tabulate>=0.8.2; python_version <= '3.9' tabulate>=0.8.8; python_version >= '3.10' diff --git a/setup.py b/setup.py index f9388c40..9c6ee32c 100644 --- a/setup.py +++ b/setup.py @@ -130,5 +130,6 @@ def read_file(a_file): 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ] ) diff --git a/tox.ini b/tox.ini index e3b461b3..50b886eb 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,7 @@ envlist = py39 py310 py311 + py312 win64_py36_32 win64_py36_64 win64_py37_32 @@ -27,6 +28,8 @@ envlist = win64_py310_64 win64_py311_32 win64_py311_64 + win64_py312_32 + win64_py312_64 cygwin64_py36 skip_missing_interpreters = true @@ -90,6 +93,10 @@ basepython = python3.10 platform = linux2|darwin basepython = python3.11 +[testenv:py312] +platform = linux2|darwin +basepython = python3.12 + # Note: The basepython file paths for the win64* tox environments may need to # be customized. @@ -165,6 +172,18 @@ basepython = python setenv = PATH = C:\Python311-x64;{env:PATH} +[testenv:win64_py312_32] +platform = win32 +basepython = python +setenv = + PATH = C:\Python312;{env:PATH} + +[testenv:win64_py312_64] +platform = win32 +basepython = python +setenv = + PATH = C:\Python312-x64;{env:PATH} + [testenv:cygwin64_py36] platform = cygwin basepython = python3.6m