Skip to content

Commit

Permalink
Added support for Python 3.12
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
andy-maier committed Oct 22, 2023
1 parent a97115f commit 044824a
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 29 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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\": [ \
{ \
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
else \
echo "matrix={ \
\"os\": [ \"ubuntu-latest\" ], \
\"python-version\": [ \"3.11\" ], \
\"python-version\": [ \"3.12\" ], \
\"package_level\": [ \"minimum\", \"latest\" ], \
\"include\": [ \
{ \
Expand All @@ -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\" \
}, \
{ \
Expand All @@ -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\" \
} \
] \
Expand Down
22 changes: 13 additions & 9 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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):
Expand All @@ -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'
6 changes: 6 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:**
Expand Down
36 changes: 22 additions & 14 deletions minimum-constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -136,20 +140,22 @@ 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'
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):
Expand All @@ -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)

Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]
)
19 changes: 19 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ envlist =
py39
py310
py311
py312
win64_py36_32
win64_py36_64
win64_py37_32
Expand All @@ -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
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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

0 comments on commit 044824a

Please sign in to comment.