Skip to content

Commit

Permalink
Added support for Python 3.12; Other fixes
Browse files Browse the repository at this point in the history
Details:

* Added Python 3.12 to the test workflow.

* Changed versions of several packages used for development for Python 3.12
  and partially also for older Python versions, for consistency with other
  zhmcclient projects.

* Removed sphinx from being checked in check_reqs target on Python 3.12,
  pip-missing-reqs 2.5 reports missing sphinx-versions package (rightfully).

* Removed information about OS versions in comment of constraint files.

* Removed comments on fixes for safety issues from requirements and
  constraint files because that is documented in the safety policy file.

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
  • Loading branch information
andy-maier committed Oct 23, 2023
1 parent 397ff2c commit 2a5b945
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 127 deletions.
8 changes: 4 additions & 4 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\" ], \
\"python-version\": [ \"3.5\", \"3.6\", \"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\" ], \
\"python-version\": [ \"3.5\", \"3.6\", \"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"3.12\" ], \
\"package_level\": [ \"minimum\", \"latest\", \"ansible\" ], \
\"exclude\": [ \
{ \
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
else \
echo "matrix={ \
\"os\": [ \"ubuntu-latest\" ], \
\"python-version\": [ \"3.10\", \"3.11\" ], \
\"python-version\": [ \"3.10\", \"3.12\" ], \
\"package_level\": [ \"minimum\", \"latest\", \"ansible\" ], \
\"include\": [ \
{ \
Expand Down Expand Up @@ -180,12 +180,12 @@ jobs:
}, \
{ \
\"os\": \"macos-latest\", \
\"python-version\": \"3.10\", \
\"python-version\": \"3.12\", \
\"package_level\": \"minimum\" \
}, \
{ \
\"os\": \"macos-latest\", \
\"python-version\": \"3.10\", \
\"python-version\": \"3.12\", \
\"package_level\": \"latest\" \
} \
] \
Expand Down
28 changes: 26 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,28 @@ else
ifeq ($(python_m_n_version),3.6)
check_reqs_packages := ansible pip_check_reqs pytest coverage coveralls flake8 sphinx ansible_doc_extractor
else
ifeq ($(python_m_n_version),3.7)
check_reqs_packages := ansible pip_check_reqs pytest coverage coveralls flake8 sphinx ansible_doc_extractor ansible_test pylint
else
ifeq ($(python_m_n_version),3.8)
check_reqs_packages := ansible pip_check_reqs pytest coverage coveralls flake8 sphinx ansible_doc_extractor ansible_test pylint
else
ifeq ($(python_m_n_version),3.9)
check_reqs_packages := ansible pip_check_reqs pytest coverage coveralls flake8 sphinx ansible_doc_extractor ansible_test pylint
else
ifeq ($(python_m_n_version),3.10)
check_reqs_packages := ansible pip_check_reqs pytest coverage coveralls flake8 sphinx ansible_doc_extractor ansible_test pylint
else
ifeq ($(python_m_n_version),3.11)
check_reqs_packages := ansible pip_check_reqs pytest coverage coveralls flake8 sphinx ansible_doc_extractor ansible_test pylint
else
# sphinx is excluded because pip-missing-reqs 2.5 reports missing sphinx-versions package (rightfully)
check_reqs_packages := ansible pip_check_reqs pytest coverage coveralls flake8 ansible_doc_extractor ansible_test pylint
endif
endif
endif
endif
endif
endif
endif
endif
Expand Down Expand Up @@ -261,11 +282,14 @@ safety: safety_$(pymn)_$(PACKAGE_LEVEL).done
@echo "Makefile: $@ done."

# Excluding Python>=3.10 with minimum package levels because of PyYAML 5.4.1 install issue with Cython 3
run_sanity_current := $(shell PL=$(PACKAGE_LEVEL) $(PYTHON_CMD) -c "import sys,os; py=sys.version_info[0:2]; pl=os.getenv('PL'); sys.stdout.write('true' if py<=(3,9) or py>=(3,10) and pl=='latest' else 'false')")
# Excluding Python>=3.12 because not yet supportd by Ansible
run_sanity_current := $(shell PL=$(PACKAGE_LEVEL) $(PYTHON_CMD) -c "import sys,os; py=sys.version_info[0:2]; pl=os.getenv('PL'); sys.stdout.write('true' if py<=(3,9) or (3,10)<=py<=(3,11) and pl=='latest' else 'false')")

# Excluding Python <=3.6 because ?
# Excluding Python 3.7+3.8 with minimum package levels because ?
# Excluding Python 3.10 with minimum package levels because of PyYAML 5.4.1 install issue with Cython 3
run_sanity_virtual := $(shell PL=$(PACKAGE_LEVEL) $(PYTHON_CMD) -c "import sys,os; py=sys.version_info[0:2]; pl=os.getenv('PL'); sys.stdout.write('true' if (3,7)<=py<=(3,8) and pl=='latest' or py==(3,9) or py==(3,10) and pl=='latest' or py>=(3,11) else 'false')")
# Excluding Python>=3.12 because not yet supportd by Ansible
run_sanity_virtual := $(shell PL=$(PACKAGE_LEVEL) $(PYTHON_CMD) -c "import sys,os; py=sys.version_info[0:2]; pl=os.getenv('PL'); sys.stdout.write('true' if (3,7)<=py<=(3,8) and pl=='latest' or py==(3,9) or py==(3,10) and pl=='latest' or py==(3,11) else 'false')")

# The sanity check requires the .git directory to be present.
.PHONY: sanity
Expand Down
49 changes: 29 additions & 20 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ voluptuous>=0.11.7; python_version >= '3.5'

# Unit test (imports into testcases):
# packaging is specified in requirements.txt
funcsigs>=1.0.2; python_version < '3.3'
funcsigs>=1.0.2; python_version == '2.7' # technically: python_version <= '3.2'
# pytest 5.0.0 has removed support for Python < 3.5
# pytest 4.3.1 solves an issue on Python 3 with minimum package levels
pytest>=4.3.1,<5.0.0; python_version < '3.5'
pytest>=4.3.1,<5.0.0; python_version == '2.7' # technically: python_version <= '3.4'
pytest>=4.3.1; python_version >= '3.5' and 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'
Expand Down Expand Up @@ -84,7 +84,6 @@ dparse>=0.6.2; python_version >= '3.6'
# deprecated in Sphinx 4.3.0.
# Sphinx 4.0.0 breaks autodocsumm and needs to be excluded
# Sphinx <4.3.0 requires docutils <0.18 due to an incompatibility
# Sphinx 3.0.4 fixes safety issues 45775,38330
# Note: Sphinx 4.1.0 added support for Jinja2 3.1.0 which renamed some filters
# Sphinx 5.1.0 is the first one allowing docutils 0.19
Sphinx>=4.1.0; python_version >= '3.6' and python_version <= '3.9'
Expand All @@ -102,7 +101,6 @@ sphinxcontrib-websupport>=1.1.2; python_version >= '3.6'
Pygments>=2.7.4; python_version == '3.6'
Pygments>=2.15.0; python_version >= '3.7'
# Babel 2.7.0 fixes an ImportError for MutableMapping which starts failing on Python 3.10
# Babel 2.9.1 fixes safety issue 42203
Babel>=2.9.1
# ansible-doc-extractor and it's dependent theme for docs generation (no imports, invoked via script):
# The Makefile defines in doc_build on which Python versions docs are built. Keep in sync with Makefile and minimum-constraints.txt.
Expand All @@ -114,24 +112,30 @@ sphinx-rtd-theme>=1.0.0; python_version >= '3.6'
git+https://github.com/andy-maier/sphinx-versions.git@1.1.3.post2#egg=sphinx-versions; python_version >= '3.6'

# PyLint (no imports, invoked via pylint script)
# Pylint is run in ansible sanity test which is run only on Python>=3.7
# Pylint 2.6 is used by Ansible 4 in its sanity env (lower Ansible versions don't have a sanity env)
# Pylint 2.9 is used by Ansible 5+6 in its sanity env
# Pylint 2.15 is used by Ansible 7 in its sanity env
# Pylint 2.6 is used by Ansible 4 in its sanity env, so we use that as the minimum version on all Python versions
# Pylint is run in ansible sanity test which is run only on Python>=3.5
# The sanity test running in Ansible's sanity virtual environment uses the following Pylint versions:
# Pylint 2.6 is used by Ansible 4 (lower Ansible versions don't have a sanity env)
# Pylint 2.9 is used by Ansible 5+6
# Pylint 2.15 is used by Ansible 7
# Pylint requires astroid
# Pylint 2.7 introduced the consider-using-generator check, which is raised.
# Pylint 2.11 introduced the consider-using-f-string check, which is raised.
# The Pylint versions defined here are used when the sanity test runs in the current virtual env.
# Keep them in sync with the versions run in the sanity virtual env.
pylint>=2.6.0,<2.7; python_version >= '3.5' and python_version <= '3.7' # pylint 2.6
pylint>=2.6.0,<2.10; python_version >= '3.8' and python_version <= '3.9' # pylint 2.9
pylint>=2.6.0,<2.16; python_version >= '3.10' # pylint 2.15
pylint>=2.6.0,<2.16; python_version >= '3.10' and python_version <= '3.11' # pylint 2.15
pylint>=3.0.1; python_version >= '3.12' # pylint 3.x
astroid>=2.4.0,<2.5; python_version >= '3.5' and python_version <= '3.7' # astroid 2.4
astroid>=2.4.0,<2.7; python_version >= '3.8' and python_version <= '3.9' # astroid 2.6
astroid>=2.4.0,<2.13; python_version >= '3.10' # astroid 2.12
typed-ast>=1.4.0,<1.5.0; python_version >= '3.5' and python_version < '3.8' and implementation_name=='cpython'
astroid>=2.4.0,<2.13; python_version >= '3.10' and python_version <= '3.11' # astroid 2.12
astroid>=3.0.1; python_version >= '3.12' # astroid 3.x
typed-ast>=1.4.0,<1.5.0; python_version >= '3.5' and python_version <= '3.7' and implementation_name=='cpython'
# used by pylint 2.14 which requires python_version >= '3.7' and is used by us only on py>=3.10
dill>=0.2; python_version >= '3.10'
platformdirs>=2.2.0; python_version >= '3.10'
dill>=0.2; python_version == '3.11'
dill>=0.3.7; python_version >= '3.12'
platformdirs>=2.2.0; python_version >= '3.10' and python_version <= '3.11'
platformdirs>=3.2.0; python_version >= '3.12'
tomlkit>=0.10.1; python_version >= '3.10'
tomli>=1.1.0; python_version == '3.10' # not needed on py>3.10

Expand All @@ -143,18 +147,22 @@ tomli>=1.1.0; python_version == '3.10' # not needed on py>3.10
flake8>=3.8.0,<3.9; python_version == '2.7'
flake8>=3.8.0,<3.9; python_version >= '3.5' and python_version <= '3.8' # flake8 3.8
flake8>=3.8.0,<5.0; python_version == '3.9' # flake8 4.0
flake8>=3.8.0,<6.0; python_version >= '3.10' # flake8 5.0
flake8>=3.8.0,<6.0; python_version >= '3.10' and python_version <= '3.11' # flake8 5.0
flake8>=5.0.0,<6.0; python_version >= '3.12' # flake8 5.0
pycodestyle>=2.6.0,<2.7; python_version == '2.7'
pycodestyle>=2.6.0,<2.7; python_version >= '3.5' and python_version <= '3.8' # pycodestyle 2.6
pycodestyle>=2.6.0,<2.9; python_version == '3.9' # pycodestyle 2.8
pycodestyle>=2.6.0,<2.10; python_version >= '3.10' # pycodestyle 2.9
pycodestyle>=2.6.0,<2.10; python_version >= '3.10' and python_version <= '3.11' # pycodestyle 2.9
pycodestyle>=2.9.0,<2.10; python_version >= '3.12' # pycodestyle 2.9
pyflakes>=2.2.0,<2.3; python_version == '2.7'
pyflakes>=2.2.0,<2.3; python_version >= '3.5' and python_version <= '3.8' # pyflakes 2.2
pyflakes>=2.2.0,<2.5; python_version == '3.9' # pyflakes 2.4
pyflakes>=2.2.0,<2.6; python_version >= '3.10' # pyflakes 2.5
mccabe>=0.6.0
pyflakes>=2.2.0,<2.6; python_version >= '3.10' and python_version <= '3.11' # pyflakes 2.5
pyflakes>=2.5.0,<2.6; python_version >= '3.12' # pyflakes 2.5
mccabe>=0.6.0; python_version <= '3.11'
mccabe>=0.7.0; python_version >= '3.12'
entrypoints>=0.3.0
functools32>=3.2.3.post2; python_version == '2.7' # technically: python_version < '3.2'
functools32>=3.2.3.post2; python_version == '2.7' # technically: python_version <= '3.1'

# Package dependency management tools (not used by any make rules)
pipdeptree>=2.2.0
Expand All @@ -164,6 +172,7 @@ 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.3.2; python_version >= '3.5' and python_version <= '3.7'
# pip-check-reqs 2.5.0 has issue https://github.com/r1chardj0n3s/pip-check-reqs/issues/143
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.3; python_version >= '3.12'

# Indirect dependencies are not specified in this file unless constraints are needed.
2 changes: 2 additions & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Availability: `AutomationHub`_, `Galaxy`_, `GitHub`_

**Enhancements:**

* Added support for Python 3.12. (issue #796)

**Cleanup:**

* Removed documentation and test files (except sanity test ignore files) from
Expand Down
Loading

0 comments on commit 2a5b945

Please sign in to comment.