Remove Python 3.10 support for the controller

Fixes #83094
pull/83221/head
Martin Krizek 1 month ago
parent 8ad68f12ee
commit a5b922ab8c

@ -157,7 +157,6 @@ stages:
nameFormat: Python {0}
testFormat: galaxy/{0}/1
targets:
- test: '3.10'
- test: 3.11
- test: 3.12
- stage: Generic
@ -168,7 +167,6 @@ stages:
nameFormat: Python {0}
testFormat: generic/{0}/1
targets:
- test: '3.10'
- test: 3.11
- test: 3.12
- stage: Incidental_Windows

@ -0,0 +1,2 @@
removed_features:
- Removed Python 3.10 as a supported version on the controller. Python 3.11 or newer is required.

@ -5,7 +5,7 @@ env-setup
---------
The 'env-setup' script modifies your environment to allow you to run
ansible from a git checkout using python >= 3.10.
ansible from a git checkout using python >= 3.11.
First, set up your environment to run from the checkout:

@ -11,9 +11,9 @@ import sys
# Used for determining if the system is running a new enough python version
# and should only restrict on our documented minimum versions
if sys.version_info < (3, 10):
if sys.version_info < (3, 11):
raise SystemExit(
'ERROR: Ansible requires Python 3.10 or newer on the controller. '
'ERROR: Ansible requires Python 3.11 or newer on the controller. '
'Current version: %s' % ''.join(sys.version.splitlines())
)

@ -62,8 +62,7 @@ def should_retry_error(exception):
if isinstance(orig_exc, URLError):
orig_exc = orig_exc.reason
# Handle common URL related errors such as TimeoutError, and BadStatusLine
# Note: socket.timeout is only required for Py3.9
# Handle common URL related errors
if isinstance(orig_exc, (TimeoutError, BadStatusLine, IncompleteRead)):
return True

@ -1584,13 +1584,6 @@ def install_artifact(b_coll_targz_path, b_collection_path, b_temp_path, signatur
"""
try:
with tarfile.open(b_coll_targz_path, mode='r') as collection_tar:
# Remove this once py3.11 is our controller minimum
# Workaround for https://bugs.python.org/issue47231
# See _extract_tar_dir
collection_tar._ansible_normalized_cache = {
m.name.removesuffix(os.path.sep): m for m in collection_tar.getmembers()
} # deprecated: description='TarFile member index' core_version='2.18' python_version='3.11'
# Verify the signature on the MANIFEST.json before extracting anything else
_extract_tar_file(collection_tar, MANIFEST_FILENAME, b_collection_path, b_temp_path)

@ -32,27 +32,8 @@ except ImportError:
__import__(name)
return sys.modules[name]
try:
from importlib import reload as reload_module
except ImportError:
# 2.7 has a global reload function instead...
reload_module = reload # type: ignore[name-defined] # pylint:disable=undefined-variable
try:
try:
# Available on Python >= 3.11
# We ignore the import error that will trigger when running mypy with
# older Python versions.
from importlib.resources.abc import TraversableResources # type: ignore[import]
except ImportError:
# Used with Python 3.9 and 3.10 only
# This member is still available as an alias up until Python 3.14 but
# is deprecated as of Python 3.12.
from importlib.abc import TraversableResources # deprecated: description='TraversableResources move' python_version='3.10'
except ImportError:
# Python < 3.9
# deprecated: description='TraversableResources fallback' python_version='3.8'
TraversableResources = object # type: ignore[assignment,misc]
from importlib import reload as reload_module
from importlib.resources.abc import TraversableResources
try:
from importlib.util import find_spec, spec_from_loader
@ -77,26 +58,7 @@ try:
except ImportError:
_meta_yml_to_dict = None
if not hasattr(__builtins__, 'ModuleNotFoundError'):
# this was introduced in Python 3.6
ModuleNotFoundError = ImportError
_VALID_IDENTIFIER_STRING_REGEX = re.compile(
''.join((_VALID_IDENTIFIER_REGEX, r'\Z')),
)
try: # NOTE: py3/py2 compat
# py2 mypy can't deal with try/excepts
is_python_identifier = str.isidentifier # type: ignore[attr-defined]
except AttributeError: # Python 2
def is_python_identifier(self): # type: (str) -> bool
"""Determine whether the given string is a Python identifier."""
# Ref: https://stackoverflow.com/a/55802320/595220
return bool(re.match(_VALID_IDENTIFIER_STRING_REGEX, self))
is_python_identifier = str.isidentifier # type: ignore[attr-defined]
PB_EXTENSIONS = ('.yml', '.yaml')
SYNTHETIC_PACKAGE_NAME = '<ansible_synthetic_collection_package>'

@ -866,8 +866,9 @@ def get_wheel_path(version: Version, dist_dir: pathlib.Path = DIST_DIR) -> pathl
def calculate_digest(path: pathlib.Path) -> str:
"""Return the digest for the specified file."""
# TODO: use hashlib.file_digest once Python 3.11 is the minimum supported version
return hashlib.new(DIGEST_ALGORITHM, path.read_bytes()).hexdigest()
with open(path, "rb") as f:
digest = hashlib.file_digest(f, DIGEST_ALGORITHM)
return digest.hexdigest()
@functools.cache

@ -27,7 +27,6 @@ classifiers =
Natural Language :: English
Operating System :: POSIX
Programming Language :: Python :: 3
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3 :: Only
@ -37,7 +36,7 @@ classifiers =
[options]
zip_safe = False
python_requires = >=3.10
python_requires = >=3.11
# keep ansible-test as a verbatim script to work with editable installs, since it needs to do its
# own package redirection magic that's beyond the scope of the normal `ansible` path redirection
# done by setuptools `develop`

@ -1,8 +1,7 @@
# do not add a cryptography or pyopenssl constraint to this file, they require special handling, see get_cryptography_requirements in python_requirements.py
# do not add a coverage constraint to this file, it is handled internally by ansible-test
pypsrp < 1.0.0 # in case the next major version is too big of a change
pywinrm >= 0.3.0 ; python_version < '3.11' # message encryption support
pywinrm >= 0.4.3 ; python_version >= '3.11' # support for Python 3.11
pywinrm >= 0.4.3 # support for Python 3.11
pytest >= 4.5.0 # pytest 4.5.0 added support for --strict-markers
ntlm-auth >= 1.3.0 # message encryption support using cryptography
requests-ntlm >= 1.1.0 # message encryption support

@ -7,10 +7,10 @@ from __future__ import annotations
REMOTE_ONLY_PYTHON_VERSIONS = (
'3.8',
'3.9',
'3.10',
)
CONTROLLER_PYTHON_VERSIONS = (
'3.10',
'3.11',
'3.12',
)

@ -2,13 +2,10 @@ lib/ansible/config/base.yml no-unwanted-files
lib/ansible/executor/powershell/async_watchdog.ps1 pslint:PSCustomUseLiteralPath
lib/ansible/executor/powershell/async_wrapper.ps1 pslint:PSCustomUseLiteralPath
lib/ansible/executor/powershell/exec_wrapper.ps1 pslint:PSCustomUseLiteralPath
lib/ansible/galaxy/collection/__init__.py mypy-3.10:attr-defined # inline ignore has no effect
lib/ansible/galaxy/collection/__init__.py mypy-3.11:attr-defined # inline ignore has no effect
lib/ansible/galaxy/collection/__init__.py mypy-3.12:attr-defined # inline ignore has no effect
lib/ansible/galaxy/collection/gpg.py mypy-3.10:arg-type
lib/ansible/galaxy/collection/gpg.py mypy-3.11:arg-type
lib/ansible/galaxy/collection/gpg.py mypy-3.12:arg-type
lib/ansible/parsing/yaml/constructor.py mypy-3.10:type-var # too many occurrences to ignore inline
lib/ansible/parsing/yaml/constructor.py mypy-3.11:type-var # too many occurrences to ignore inline
lib/ansible/parsing/yaml/constructor.py mypy-3.12:type-var # too many occurrences to ignore inline
lib/ansible/keyword_desc.yml no-unwanted-files

@ -1,4 +1,4 @@
bcrypt ; python_version >= '3.10' # controller only
passlib ; python_version >= '3.10' # controller only
pexpect ; python_version >= '3.10' # controller only
pywinrm ; python_version >= '3.10' # controller only
bcrypt ; python_version >= '3.11' # controller only
passlib ; python_version >= '3.11' # controller only
pexpect ; python_version >= '3.11' # controller only
pywinrm ; python_version >= '3.11' # controller only

Loading…
Cancel
Save