diff --git a/.ci/azure-pipelines-steps.yml b/.ci/azure-pipelines-steps.yml index 5d516eb0..919b992b 100644 --- a/.ci/azure-pipelines-steps.yml +++ b/.ci/azure-pipelines-steps.yml @@ -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 @@ -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) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 0bedaa03..3630f83e 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -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: @@ -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 @@ -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 diff --git a/docs/ansible_detailed.rst b/docs/ansible_detailed.rst index 5679537e..cb83aa71 100644 --- a/docs/ansible_detailed.rst +++ b/docs/ansible_detailed.rst @@ -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. diff --git a/docs/changelog.rst b/docs/changelog.rst index 940e4900..126095fd 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -25,6 +25,7 @@ Unreleased becoming an unprivileged user with Python 3.x * :gh:issue:`1033` Support `PEP 451 , required by Python 3.12 +* :gh:issue:`1033` Support Python 3.12 v0.3.4 (2023-07-02) diff --git a/setup.py b/setup.py index 4d7fadfc..b17dab9d 100644 --- a/setup.py +++ b/setup.py @@ -78,6 +78,7 @@ setup( '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', diff --git a/tests/requirements-tox.txt b/tests/requirements-tox.txt new file mode 100644 index 00000000..bc7f7c2a --- /dev/null +++ b/tests/requirements-tox.txt @@ -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' diff --git a/tests/requirements.txt b/tests/requirements.txt index 1e5d2a1d..6d87d177 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -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 @@ -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' diff --git a/tox.ini b/tox.ini index ae4f35c9..4a1772a0 100644 --- a/tox.ini +++ b/tox.ini @@ -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 @@ -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 # ================== ====================== @@ -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] @@ -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 = @@ -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