From 864ec3e253aefd7e8581e26131387ecef48bd3dd Mon Sep 17 00:00:00 2001 From: Andreas Maier Date: Sun, 22 Oct 2023 10:45:47 +0200 Subject: [PATCH] Added support for Python 3.12 Details: * Added Python 3.12 to test workflow, setup.py. * 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. * Had to increase the minimum versions of several packages used only for development. Signed-off-by: Andreas Maier --- .github/workflows/test.yml | 15 ++++++++++----- dev-requirements.txt | 33 +++++++++++++++++++++------------ docs/changes.rst | 5 +++++ minimum-constraints.txt | 36 ++++++++++++++++++++++-------------- setup.py | 1 + 5 files changed, 59 insertions(+), 31 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 452b8c4..4a47948 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,7 +37,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\": [ \ { \ @@ -67,7 +67,7 @@ jobs: else \ echo "matrix={ \ \"os\": [ \"ubuntu-latest\" ], \ - \"python-version\": [ \"3.11\" ], \ + \"python-version\": [ \"3.12\" ], \ \"package_level\": [ \"minimum\", \"latest\" ], \ \"include\": [ \ { \ @@ -87,7 +87,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\" \ }, \ { \ @@ -97,12 +102,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 2c39356..62dd0b7 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -18,8 +18,8 @@ dparse>=0.6.2 pytest>=4.3.1; python_version == '3.6' pytest>=4.4.0; python_version >= '3.7' and python_version <= '3.9' pytest>=6.2.5; python_version >= '3.10' -importlib-metadata>=0.12,<5.0.0; python_version <= '3.7' -importlib-metadata>=1.1.0; python_version >= '3.8' +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 @@ -28,7 +28,8 @@ packaging>=21.0 # Virtualenv # build requires virtualenv.cli_run which was added in 20.1 # virtualenv 20.0 requires six<2,>=1.12.0 -virtualenv>=20.1.0 +virtualenv>=20.1.0; python_version <= '3.11' +virtualenv>=20.23.0; python_version >= '3.12' # Coverage reporting (no imports, invoked via coveralls script): coverage>=5.0 @@ -40,28 +41,35 @@ coveralls>=3.3.0 # well with its pinned dependencies, so we need to repeat these for py34. # 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 # PyLint (no imports, invoked via pylint script) # Pylint requires astroid +# Pylint 2.7 / astroid 2.5 started requiring Python>=3.6 +# Pylint 2.14 / astroid 2.12 started requiring Python>=3.7 +# Pylint 3.0 / astroid 3.0 started requiring Python>=3.8 pylint>=2.13.0,<2.14.0; python_version == '3.6' pylint>=2.13.0; python_version >= '3.7' and python_version <= '3.10' -pylint>=2.15.0; python_version >= '3.11' +pylint>=2.15.0; python_version == '3.11' +pylint>=3.0.1; python_version >= '3.12' astroid>=2.11.0; python_version <= '3.10' -astroid>=2.12.4; python_version >= '3.11' +astroid>=2.12.4; python_version == '3.11' +astroid>=3.0.1; python_version >= '3.12' typed-ast>=1.4.0,<1.5.0; python_version <= '3.7' and implementation_name=='cpython' # lazy-object-proxy is used by astroid 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 @@ -69,7 +77,7 @@ isort>=4.3.8 tomlkit>=0.10.1; python_version >= '3.7' # dill is used by pylint >=2.13 dill>=0.2; python_version <= '3.10' -dill>=0.3.6; python_version >= '3.11' +dill>=0.3.7; python_version >= '3.11' # Sphinx (no imports, invoked via sphinx-build script): # Keep in sync with rtd-requirements.txt @@ -104,4 +112,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 eaf998b..708e678 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -67,6 +67,11 @@ 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 several + packages used only for development. (issue #388) + * Added a '--version' option for showing the versions of the exporter and the zhmcclient library. (issue #298) diff --git a/minimum-constraints.txt b/minimum-constraints.txt index e473bc5..f830940 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.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' @@ -91,13 +93,14 @@ pytest==6.2.5; python_version >= '3.10' # Pluggy 0.12.0 has a bug causing pytest plugins to fail loading on py38 pluggy==0.7.1; python_version == '3.6' pluggy==0.13.0; python_version >= '3.7' -importlib-metadata==0.22; python_version <= '3.7' -importlib-metadata==1.1.0; python_version >= '3.8' +importlib-metadata==2.1.3; python_version == '3.6' +importlib-metadata==4.8.3; python_version >= '3.7' packaging==21.0 # Virtualenv -virtualenv==20.1.0 +virtualenv==20.1.0; python_version <= '3.11' +virtualenv==20.23.0; python_version >= '3.12' # Coverage reporting (no imports, invoked via coveralls script): coverage==5.0 @@ -106,28 +109,32 @@ coveralls==3.3.0 # 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 # PyLint (no imports, invoked via pylint script): pylint==2.13.0; python_version <= '3.10' -pylint==2.15.0; python_version >= '3.11' +pylint==2.15.0; python_version == '3.11' +pylint==3.0.1; python_version >= '3.12' astroid==2.11.0; python_version <= '3.10' -astroid==2.12.4; python_version >= '3.11' +astroid==2.12.4; python_version == '3.11' +astroid==3.0.1; python_version >= '3.12' typed-ast==1.4.0; python_version <= '3.7' and implementation_name=='cpython' lazy-object-proxy==1.4.3 wrapt==1.12; 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.10' -dill==0.3.6; python_version >= '3.11' +dill==0.3.7; python_version >= '3.11' # Sphinx (no imports, invoked via sphinx-build script): Sphinx==3.5.4; python_version <= '3.9' @@ -152,7 +159,8 @@ readme-renderer==25.0 # Package dependency management tools (not used by any make rules) pipdeptree==2.2.0 pip-check-reqs==2.3.2; 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 that require a version constraint (must be consistent with dev-requirements.txt) diff --git a/setup.py b/setup.py index e6eef33..ef3e290 100644 --- a/setup.py +++ b/setup.py @@ -136,5 +136,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', ] )