mitogen: Support Python 3.12

Most of the necessary changes were made in recent PEP 451 commits. This bumps
the CI jobs, and declares the support. Test dependendancies are bumped to
latest supportted/available versions.

refs #1033
pull/1032/head
Alex Willmer 2 months ago
parent fe8a3a71fc
commit 123efa7510

@ -15,12 +15,20 @@ steps:
condition: ne(variables['python.version'], '') condition: ne(variables['python.version'], '')
- script: | - script: |
set -o errexit
set -o nounset
set -o pipefail
sudo apt-get update sudo apt-get update
sudo apt-get install -y python2-dev python3-pip virtualenv sudo apt-get install -y python2-dev python3-pip virtualenv
displayName: Install build deps displayName: Install build deps
condition: and(eq(variables['python.version'], ''), eq(variables['Agent.OS'], 'Linux')) condition: and(eq(variables['python.version'], ''), eq(variables['Agent.OS'], 'Linux'))
- script: | - script: |
set -o errexit
set -o nounset
set -o pipefail
# macOS builders lack a realpath command # macOS builders lack a realpath command
type python && python -c"import os.path;print(os.path.realpath('$(type -p python)'))" && python --version type python && python -c"import os.path;print(os.path.realpath('$(type -p python)'))" && python --version
type python2 && python2 -c"import os.path;print(os.path.realpath('$(type -p python2)'))" && python2 --version type python2 && python2 -c"import os.path;print(os.path.realpath('$(type -p python2)'))" && python2 --version
@ -41,20 +49,46 @@ steps:
displayName: Show python versions displayName: Show python versions
- script: | - script: |
if [[ $(uname) == "Darwin" ]]; then set -o errexit
python2 -m ensurepip --user --altinstall --no-default-pip set -o nounset
python2 -m pip install --user "tox<4.0" set -o pipefail
# Tox environment name (e.g. py312-mode_mitogen) -> Python executable name (e.g. python3.12)
PYTHON=$(python -c 'import re; print(re.sub(r"^py([23])([0-9]{1,2}).*", r"python\1.\2", "$(tox.env)"))')
if [[ -z $PYTHON ]]; then
echo 1>&2 "Python interpreter could not be determined"
exit 1
fi
if [[ $PYTHON == "python2.7" && $(uname) == "Darwin" ]]; then
"$PYTHON" -m ensurepip --user --altinstall --no-default-pip
"$PYTHON" -m pip install --user -r "tests/requirements-tox.txt"
elif [[ $PYTHON == "python2.7" ]]; then
curl "https://bootstrap.pypa.io/pip/2.7/get-pip.py" --output "get-pip.py"
"$PYTHON" get-pip.py --user --no-python-version-warning
# Avoid Python 2.x pip masking system pip
rm -f ~/.local/bin/{easy_install,pip,wheel}
"$PYTHON" -m pip install --user -r "tests/requirements-tox.txt"
else else
python -m pip install "tox<4.0" "$PYTHON" -m pip install -r "tests/requirements-tox.txt"
fi fi
displayName: Install tooling displayName: Install tooling
- script: | - script: |
if [[ $(uname) == "Darwin" ]]; then set -o errexit
python2 -m tox -e "$(tox.env)" set -o nounset
else set -o pipefail
python -m tox -e "$(tox.env)"
# Tox environment name (e.g. py312-mode_mitogen) -> Python executable name (e.g. python3.12)
PYTHON=$(python -c 'import re; print(re.sub(r"^py([23])([0-9]{1,2}).*", r"python\1.\2", "$(tox.env)"))')
if [[ -z $PYTHON ]]; then
echo 1>&2 "Python interpreter could not be determined"
exit 1
fi fi
"$PYTHON" -m tox -e "$(tox.env)"
displayName: "Run tests" displayName: "Run tests"
env: env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID) AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)

@ -21,21 +21,21 @@ jobs:
matrix: matrix:
Mito_27: Mito_27:
tox.env: py27-mode_mitogen tox.env: py27-mode_mitogen
Mito_311: Mito_312:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_mitogen tox.env: py312-mode_mitogen
Loc_27_210: Loc_27_210:
tox.env: py27-mode_localhost-ansible2.10 tox.env: py27-mode_localhost-ansible2.10
Loc_311_6: Loc_312_6:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_localhost-ansible6 tox.env: py312-mode_localhost-ansible6
Van_27_210: Van_27_210:
tox.env: py27-mode_localhost-ansible2.10-strategy_linear tox.env: py27-mode_localhost-ansible2.10-strategy_linear
Van_311_6: Van_312_6:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_localhost-ansible6-strategy_linear tox.env: py312-mode_localhost-ansible6-strategy_linear
- job: Linux - job: Linux
pool: pool:
@ -92,33 +92,33 @@ jobs:
python.version: '3.6' python.version: '3.6'
tox.env: py36-mode_mitogen-distro_ubuntu2004 tox.env: py36-mode_mitogen-distro_ubuntu2004
Mito_311_centos6: Mito_312_centos6:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_mitogen-distro_centos6 tox.env: py312-mode_mitogen-distro_centos6
Mito_311_centos7: Mito_312_centos7:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_mitogen-distro_centos7 tox.env: py312-mode_mitogen-distro_centos7
Mito_311_centos8: Mito_312_centos8:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_mitogen-distro_centos8 tox.env: py312-mode_mitogen-distro_centos8
Mito_311_debian9: Mito_312_debian9:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_mitogen-distro_debian9 tox.env: py312-mode_mitogen-distro_debian9
Mito_311_debian10: Mito_312_debian10:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_mitogen-distro_debian10 tox.env: py312-mode_mitogen-distro_debian10
Mito_311_debian11: Mito_312_debian11:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_mitogen-distro_debian11 tox.env: py312-mode_mitogen-distro_debian11
Mito_311_ubuntu1604: Mito_312_ubuntu1604:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_mitogen-distro_ubuntu1604 tox.env: py312-mode_mitogen-distro_ubuntu1604
Mito_311_ubuntu1804: Mito_312_ubuntu1804:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_mitogen-distro_ubuntu1804 tox.env: py312-mode_mitogen-distro_ubuntu1804
Mito_311_ubuntu2004: Mito_312_ubuntu2004:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_mitogen-distro_ubuntu2004 tox.env: py312-mode_mitogen-distro_ubuntu2004
Ans_27_210: Ans_27_210:
tox.env: py27-mode_ansible-ansible2.10 tox.env: py27-mode_ansible-ansible2.10
@ -144,6 +144,6 @@ jobs:
Ans_311_5: Ans_311_5:
python.version: '3.11' python.version: '3.11'
tox.env: py311-mode_ansible-ansible5 tox.env: py311-mode_ansible-ansible5
Ans_311_6: Ans_312_6:
python.version: '3.11' python.version: '3.12'
tox.env: py311-mode_ansible-ansible6 tox.env: py312-mode_ansible-ansible6

@ -149,7 +149,8 @@ Noteworthy Differences
Mitogen 0.3.1+ supports Mitogen 0.3.1+ supports
- Ansible 2.10, 3, and 4; with Python 2.7, or 3.6-3.11 - Ansible 2.10, 3, and 4; with Python 2.7, or 3.6-3.11
- Ansible 5 and 6; with Python 3.8-3.11 - Ansible 5; with Python 3.8-3.11
- Ansible 6; with Python 3.8-3.12
Verify your installation is running one of these versions by checking Verify your installation is running one of these versions by checking
``ansible --version`` output. ``ansible --version`` output.

@ -25,6 +25,7 @@ Unreleased
becoming an unprivileged user with Python 3.x becoming an unprivileged user with Python 3.x
* :gh:issue:`1033` Support `PEP 451 <https://peps.python.org/pep-0451/>, * :gh:issue:`1033` Support `PEP 451 <https://peps.python.org/pep-0451/>,
required by Python 3.12 required by Python 3.12
* :gh:issue:`1033` Support Python 3.12
v0.3.4 (2023-07-02) v0.3.4 (2023-07-02)

@ -78,6 +78,7 @@ setup(
'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: CPython',
'Topic :: System :: Distributed Computing', 'Topic :: System :: Distributed Computing',
'Topic :: System :: Systems Administration', 'Topic :: System :: Systems Administration',

@ -0,0 +1,4 @@
tox==3.28; python_version == '2.7'
tox==3.28; python_version == '3.6'
tox==4.8.0; python_version == '3.7'
tox>=4.13.0,~=4.0; python_version >= '3.8'

@ -1,12 +1,24 @@
cffi==1.15.1 cffi==1.15.1; python_version < '3.8'
coverage==5.5; python_version < '3.7' cffi==1.16; python_version >= '3.8'
coverage==6.4.4; python_version >= '3.7'
coverage==5.5; python_version == '2.7'
coverage==6.2; python_version == '3.6'
coverage==7.2.7; python_version == '3.7'
coverage==7.4.3; python_version >= '3.8'
Django==1.11.29; python_version < '3.0' Django==1.11.29; python_version < '3.0'
Django==3.2.20; python_version >= '3.6' Django==3.2.20; python_version >= '3.6'
mock==2.0.0
psutil==5.9.5 mock==3.0.5; python_version == '2.7'
pytest-catchlog==1.2.2 mock==5.1.0; python_version >= '3.6'
pytest==3.1.2
psutil==5.9.8
pytest==4.6.11; python_version == '2.7'
pytest==7.0.1; python_version == '3.6'
pytest==7.4.4; python_version == '3.7'
pytest==8.0.2; python_version >= '3.8'
subprocess32==3.5.4; python_version < '3.0' subprocess32==3.5.4; python_version < '3.0'
timeoutcontext==1.2.0 timeoutcontext==1.2.0
# Fix InsecurePlatformWarning while creating py26 tox environment # Fix InsecurePlatformWarning while creating py26 tox environment
@ -15,4 +27,7 @@ urllib3[secure]==1.23; python_version < '2.7'
urllib3[secure]==1.26; python_version > '2.6' and python_version < '2.7.9' urllib3[secure]==1.26; python_version > '2.6' and python_version < '2.7.9'
# Last idna compatible with Python 2.6 was idna 2.7. # Last idna compatible with Python 2.6 was idna 2.7.
idna==2.7; python_version < '2.7' idna==2.7; python_version < '2.7'
virtualenv==20.10.0
virtualenv==20.15.1; python_version == '2.7'
virtualenv==20.17.1; python_version == '3.6'
virtualenv==20.25.1; python_version >= '3.7'

@ -10,10 +10,10 @@
# 2.4 2.3? <= 3.7.1 <= 1.3.7 <= 1.1 <= 2.1.3 <= 1.4 <= 1.8 # 2.4 2.3? <= 3.7.1 <= 1.3.7 <= 1.1 <= 2.1.3 <= 1.4 <= 1.8
# 2.5 <= 3.7.1 <= 1.4.22 <= 1.3.1 <= 2.1.3 <= 2.8.7 <= 1.6.1 <= 1.9.1 # 2.5 <= 3.7.1 <= 1.4.22 <= 1.3.1 <= 2.1.3 <= 2.8.7 <= 1.6.1 <= 1.9.1
# 2.6 <= 2.6.20 <= 2.12 <= 4.5.4 <= 1.6.11 <= 2.10.3 <= 9.0.3 <= 5.9.0 <= 3.2.5 <= 2.9.1 <= 15.2.0 # 2.6 <= 2.6.20 <= 2.12 <= 4.5.4 <= 1.6.11 <= 2.10.3 <= 9.0.3 <= 5.9.0 <= 3.2.5 <= 2.9.1 <= 15.2.0
# 2.7 <= 2.11 <= 5.6 <= 1.11.29 <= 2.11.3 <= 20 <= 4.6.11 <= 3.28 <= 20.3? # 2.7 <= 2.11 <= 5.5 <= 1.11.29 <= 2.11.3 <= 20 <= 4.6.11 <= 3.28 <= 20.15²
# 3.5 <= 2.11 <= 2.13 <= 5.6 <= 2.2.28 <= 2.11.3 <= 20 <= 5.9.5 <= 6.1.0 <= 3.28 <= 20.15 # 3.5 <= 2.11 <= 2.13 <= 5.5 <= 2.2.28 <= 2.11.3 <= 20 <= 5.9.5 <= 6.1.0 <= 3.28 <= 20.15²
# 3.6 <= 2.11 <= 6.2 <= 3.2.20 <= 3.0.3 <= 21 <= 5.9.5 <= 7.0.1 <= 3.28 <= 20.16 # 3.6 <= 2.11 <= 6.2 <= 3.2.20 <= 3.0.3 <= 21 <= 7.0.1 <= 3.28 <= 20.17²
# 3.7 <= 2.12 <= 3.2.20 # 3.7 <= 2.12 <= 7.2.7 <= 3.2.20 <= 7.4.4 <= 4.8.0
# 3.8 <= 2.12 # 3.8 <= 2.12
# 3.9 <= 2.15 # 3.9 <= 2.15
# 3.10 # 3.10
@ -31,6 +31,9 @@
# Python 3.12 + get_uri requires Ansible >= 8 (ansible-core >= 2.15). # Python 3.12 + get_uri requires Ansible >= 8 (ansible-core >= 2.15).
# Python 3.12 removed deprecated httplib.HTTPSConnection() arguments. # Python 3.12 removed deprecated httplib.HTTPSConnection() arguments.
# https://github.com/ansible/ansible/pull/80751 # https://github.com/ansible/ansible/pull/80751
#
# 2. Higher virtualenv versions cannot run under this Python version. They can
# still generate virtual environments for it.
# Ansible Dependency # Ansible Dependency
# ================== ====================== # ================== ======================
@ -53,10 +56,11 @@
envlist = envlist =
init, init,
py{27,36}-mode_ansible-ansible{2.10,3,4}, py{27,36}-mode_ansible-ansible{2.10,3,4},
py{311}-mode_ansible-ansible{2.10,3,4,5,6}, py{311}-mode_ansible-ansible{2.10,3,4,5},
py{27,36,311}-mode_mitogen-distro_centos{6,7,8}, py{312}-mode_ansible-ansible{6},
py{27,36,311}-mode_mitogen-distro_debian{9,10,11}, py{27,36,312}-mode_mitogen-distro_centos{6,7,8},
py{27,36,311}-mode_mitogen-distro_ubuntu{1604,1804,2004}, py{27,36,312}-mode_mitogen-distro_debian{9,10,11},
py{27,36,312}-mode_mitogen-distro_ubuntu{1604,1804,2004},
report, report,
[testenv] [testenv]
@ -77,8 +81,8 @@ deps =
ansible2.10: ansible==2.10.7 ansible2.10: ansible==2.10.7
ansible3: ansible==3.4.0 ansible3: ansible==3.4.0
ansible4: ansible==4.10.0 ansible4: ansible==4.10.0
ansible5: ansible==5.8.0 ansible5: ansible~=5.0
ansible6: ansible==6.0.0 ansible6: ansible~=6.0
install_command = install_command =
python -m pip --no-python-version-warning --disable-pip-version-check install {opts} {packages} python -m pip --no-python-version-warning --disable-pip-version-check install {opts} {packages}
commands_pre = commands_pre =
@ -135,7 +139,21 @@ setenv =
mode_localhost: ANSIBLE_SKIP_TAGS=issue_776,resource_intensive mode_localhost: ANSIBLE_SKIP_TAGS=issue_776,resource_intensive
mode_mitogen: MODE=mitogen mode_mitogen: MODE=mitogen
strategy_linear: ANSIBLE_STRATEGY=linear strategy_linear: ANSIBLE_STRATEGY=linear
allowlist_externals =
# Added: Tox 3.18: Tox 4.0+
*_install.py
*_tests.py
aws
docker
docker-credential-secretservice
echo
gpg2
pass
whitelist_externals = whitelist_externals =
# Deprecated: Tox 3.18+; Removed: Tox 4.0
*_install.py
*_tests.py
aws
docker docker
docker-credential-secretservice docker-credential-secretservice
echo echo

Loading…
Cancel
Save