Skip to content

Commit

Permalink
mitogen: Support Python 3.12
Browse files Browse the repository at this point in the history
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
  • Loading branch information
moreati committed Mar 17, 2024
1 parent fe8a3a7 commit 123efa7
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 66 deletions.
50 changes: 42 additions & 8 deletions .ci/azure-pipelines-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@ steps:
condition: ne(variables['python.version'], '')

- script: |
set -o errexit
set -o nounset
set -o pipefail
sudo apt-get update
sudo apt-get install -y python2-dev python3-pip virtualenv
displayName: Install build deps
condition: and(eq(variables['python.version'], ''), eq(variables['Agent.OS'], 'Linux'))

- script: |
set -o errexit
set -o nounset
set -o pipefail
# macOS builders lack a realpath command
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
Expand All @@ -41,20 +49,46 @@ steps:
displayName: Show python versions

- script: |
if [[ $(uname) == "Darwin" ]]; then
python2 -m ensurepip --user --altinstall --no-default-pip
python2 -m pip install --user "tox<4.0"
set -o errexit
set -o nounset
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
python -m pip install "tox<4.0"
"$PYTHON" -m pip install -r "tests/requirements-tox.txt"
fi
displayName: Install tooling

- script: |
if [[ $(uname) == "Darwin" ]]; then
python2 -m tox -e "$(tox.env)"
else
python -m tox -e "$(tox.env)"
set -o errexit
set -o nounset
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
"$PYTHON" -m tox -e "$(tox.env)"
displayName: "Run tests"
env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
Expand Down
78 changes: 39 additions & 39 deletions .ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ jobs:
matrix:
Mito_27:
tox.env: py27-mode_mitogen
Mito_311:
python.version: '3.11'
tox.env: py311-mode_mitogen
Mito_312:
python.version: '3.12'
tox.env: py312-mode_mitogen

Loc_27_210:
tox.env: py27-mode_localhost-ansible2.10
Loc_311_6:
python.version: '3.11'
tox.env: py311-mode_localhost-ansible6
Loc_312_6:
python.version: '3.12'
tox.env: py312-mode_localhost-ansible6

Van_27_210:
tox.env: py27-mode_localhost-ansible2.10-strategy_linear
Van_311_6:
python.version: '3.11'
tox.env: py311-mode_localhost-ansible6-strategy_linear
Van_312_6:
python.version: '3.12'
tox.env: py312-mode_localhost-ansible6-strategy_linear

- job: Linux
pool:
Expand Down Expand Up @@ -92,33 +92,33 @@ jobs:
python.version: '3.6'
tox.env: py36-mode_mitogen-distro_ubuntu2004

Mito_311_centos6:
python.version: '3.11'
tox.env: py311-mode_mitogen-distro_centos6
Mito_311_centos7:
python.version: '3.11'
tox.env: py311-mode_mitogen-distro_centos7
Mito_311_centos8:
python.version: '3.11'
tox.env: py311-mode_mitogen-distro_centos8
Mito_311_debian9:
python.version: '3.11'
tox.env: py311-mode_mitogen-distro_debian9
Mito_311_debian10:
python.version: '3.11'
tox.env: py311-mode_mitogen-distro_debian10
Mito_311_debian11:
python.version: '3.11'
tox.env: py311-mode_mitogen-distro_debian11
Mito_311_ubuntu1604:
python.version: '3.11'
tox.env: py311-mode_mitogen-distro_ubuntu1604
Mito_311_ubuntu1804:
python.version: '3.11'
tox.env: py311-mode_mitogen-distro_ubuntu1804
Mito_311_ubuntu2004:
python.version: '3.11'
tox.env: py311-mode_mitogen-distro_ubuntu2004
Mito_312_centos6:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_centos6
Mito_312_centos7:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_centos7
Mito_312_centos8:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_centos8
Mito_312_debian9:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_debian9
Mito_312_debian10:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_debian10
Mito_312_debian11:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_debian11
Mito_312_ubuntu1604:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_ubuntu1604
Mito_312_ubuntu1804:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_ubuntu1804
Mito_312_ubuntu2004:
python.version: '3.12'
tox.env: py312-mode_mitogen-distro_ubuntu2004

Ans_27_210:
tox.env: py27-mode_ansible-ansible2.10
Expand All @@ -144,6 +144,6 @@ jobs:
Ans_311_5:
python.version: '3.11'
tox.env: py311-mode_ansible-ansible5
Ans_311_6:
python.version: '3.11'
tox.env: py311-mode_ansible-ansible6
Ans_312_6:
python.version: '3.12'
tox.env: py312-mode_ansible-ansible6
3 changes: 2 additions & 1 deletion docs/ansible_detailed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ Noteworthy Differences
Mitogen 0.3.1+ supports

- 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
``ansible --version`` output.
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Unreleased
becoming an unprivileged user with Python 3.x
* :gh:issue:`1033` Support `PEP 451 <https://peps.python.org/pep-0451/>,
required by Python 3.12
* :gh:issue:`1033` Support Python 3.12


v0.3.4 (2023-07-02)
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def long_description():
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: System :: Distributed Computing',
'Topic :: System :: Systems Administration',
Expand Down
4 changes: 4 additions & 0 deletions tests/requirements-tox.txt
Original file line number Diff line number Diff line change
@@ -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'
31 changes: 23 additions & 8 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
cffi==1.15.1
coverage==5.5; python_version < '3.7'
coverage==6.4.4; python_version >= '3.7'
cffi==1.15.1; python_version < '3.8'
cffi==1.16; python_version >= '3.8'

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==3.2.20; python_version >= '3.6'
mock==2.0.0
psutil==5.9.5
pytest-catchlog==1.2.2
pytest==3.1.2

mock==3.0.5; python_version == '2.7'
mock==5.1.0; python_version >= '3.6'

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'
timeoutcontext==1.2.0
# Fix InsecurePlatformWarning while creating py26 tox environment
Expand All @@ -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'
# Last idna compatible with Python 2.6 was idna 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'
38 changes: 28 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
# 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.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?
# 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.6 <= 2.11 <= 6.2 <= 3.2.20 <= 3.0.3 <= 21 <= 5.9.5 <= 7.0.1 <= 3.28 <= 20.16
# 3.7 <= 2.12 <= 3.2.20
# 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.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 <= 7.0.1 <= 3.28 <= 20.17²
# 3.7 <= 2.12 <= 7.2.7 <= 3.2.20 <= 7.4.4 <= 4.8.0
# 3.8 <= 2.12
# 3.9 <= 2.15
# 3.10
Expand All @@ -31,6 +31,9 @@
# Python 3.12 + get_uri requires Ansible >= 8 (ansible-core >= 2.15).
# Python 3.12 removed deprecated httplib.HTTPSConnection() arguments.
# 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
# ================== ======================
Expand All @@ -53,10 +56,11 @@
envlist =
init,
py{27,36}-mode_ansible-ansible{2.10,3,4},
py{311}-mode_ansible-ansible{2.10,3,4,5,6},
py{27,36,311}-mode_mitogen-distro_centos{6,7,8},
py{27,36,311}-mode_mitogen-distro_debian{9,10,11},
py{27,36,311}-mode_mitogen-distro_ubuntu{1604,1804,2004},
py{311}-mode_ansible-ansible{2.10,3,4,5},
py{312}-mode_ansible-ansible{6},
py{27,36,312}-mode_mitogen-distro_centos{6,7,8},
py{27,36,312}-mode_mitogen-distro_debian{9,10,11},
py{27,36,312}-mode_mitogen-distro_ubuntu{1604,1804,2004},
report,

[testenv]
Expand All @@ -77,8 +81,8 @@ deps =
ansible2.10: ansible==2.10.7
ansible3: ansible==3.4.0
ansible4: ansible==4.10.0
ansible5: ansible==5.8.0
ansible6: ansible==6.0.0
ansible5: ansible~=5.0
ansible6: ansible~=6.0
install_command =
python -m pip --no-python-version-warning --disable-pip-version-check install {opts} {packages}
commands_pre =
Expand Down Expand Up @@ -135,7 +139,21 @@ setenv =
mode_localhost: ANSIBLE_SKIP_TAGS=issue_776,resource_intensive
mode_mitogen: MODE=mitogen
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 =
# Deprecated: Tox 3.18+; Removed: Tox 4.0
*_install.py
*_tests.py
aws
docker
docker-credential-secretservice
echo
Expand Down

0 comments on commit 123efa7

Please sign in to comment.