From 4ee9a4af2511e75cc9aa7e7255bf32ccce4a7540 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Mon, 12 Jul 2021 20:31:12 +0100 Subject: [PATCH 1/5] Add Python 3.10 support --- .github/workflows/ci.yml | 2 ++ docs/html/installation.md | 2 +- noxfile.py | 2 +- setup.py | 1 + tox.ini | 2 +- 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 019eba65b90..d71ba0735f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,6 +96,7 @@ jobs: - 3.7 - 3.8 - 3.9 + - 3.10 steps: - uses: actions/checkout@v2 @@ -137,6 +138,7 @@ jobs: # - 3.7 # - 3.8 - 3.9 + - 3.10 group: [1, 2] steps: diff --git a/docs/html/installation.md b/docs/html/installation.md index ecb71a4aa16..17cb0fc4b42 100644 --- a/docs/html/installation.md +++ b/docs/html/installation.md @@ -67,7 +67,7 @@ distro community, cloud provider support channels, etc). The current version of pip works on: - Windows, Linux and MacOS. -- CPython 3.6, 3.7, 3.8, 3.9 and latest PyPy3. +- CPython 3.6, 3.7, 3.8, 3.9, 3.10 and latest PyPy3. pip is tested to work on the latest patch version of the Python interpreter, for each of the minor versions listed above. Previous patch versions are diff --git a/noxfile.py b/noxfile.py index dae585738e3..0067c7071fc 100644 --- a/noxfile.py +++ b/noxfile.py @@ -70,7 +70,7 @@ def should_update_common_wheels() -> bool: # completely to nox for all our automation. Contributors should prefer using # `tox -e ...` until this note is removed. # ----------------------------------------------------------------------------- -@nox.session(python=["3.6", "3.7", "3.8", "3.9", "pypy3"]) +@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "pypy3"]) def test(session: nox.Session) -> None: # Get the common wheels. if should_update_common_wheels(): diff --git a/setup.py b/setup.py index a233bd2532f..75f5195cf0b 100644 --- a/setup.py +++ b/setup.py @@ -41,6 +41,7 @@ def get_version(rel_path: str) -> str: "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ], diff --git a/tox.ini b/tox.ini index 5000f115ebd..a46ad04b7b3 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ minversion = 3.4.0 envlist = docs, packaging, lint, vendoring, - py36, py37, py38, py39, pypy3 + py36, py37, py38, py39, py310, pypy3 [helpers] # Wrapper for calls to pip that make sure the version being used is the From c9b234c2afb10a9825b8cd1eb2a0d991ad57aca1 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Fri, 16 Jul 2021 15:00:33 +0100 Subject: [PATCH 2/5] Permit pre-release versions of Python 3.10 in CI --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d71ba0735f0..a05a5e791a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,7 @@ jobs: - 3.7 - 3.8 - 3.9 - - 3.10 + - "3.10.0-alpha - 3.10" steps: - uses: actions/checkout@v2 @@ -138,7 +138,7 @@ jobs: # - 3.7 # - 3.8 - 3.9 - - 3.10 + - "3.10.0-alpha - 3.10" group: [1, 2] steps: From 35b938b42edd432b477bc74b6858ae1186478017 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Fri, 23 Jul 2021 09:39:53 +0100 Subject: [PATCH 3/5] Permit multi-character segments in Python versions, in a test This is necessary since Python 3.10 has two digits in the minor version. --- tests/lib/test_lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/test_lib.py b/tests/lib/test_lib.py index 29b76f58c32..09c400211a9 100644 --- a/tests/lib/test_lib.py +++ b/tests/lib/test_lib.py @@ -45,7 +45,7 @@ def test_correct_pip_version(script): # distribution pip_folder_outputed = re.match( r"pip \d+(\.[\d]+)+(\.?(b|rc|dev|pre|post)\d+)? from (.*) " - r"\(python \d(.[\d])+\)$", + r"\(python \d(.[\d]+)+\)$", result.stdout, ).group(4) pip_folder = join(SRC_DIR, "src", "pip") From df987483918728f4178bcb2843cdd43fdbeb66a4 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Sat, 24 Jul 2021 11:12:19 +0100 Subject: [PATCH 4/5] Skip warnings-as-errors test There is no clean way, that we know of so far, for fixing this on 3.10+. --- tests/functional/test_warning.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/functional/test_warning.py b/tests/functional/test_warning.py index 5c5b1a201ce..9272abb92b2 100644 --- a/tests/functional/test_warning.py +++ b/tests/functional/test_warning.py @@ -1,3 +1,4 @@ +import sys import textwrap import pytest @@ -44,6 +45,10 @@ def test_flag_does_nothing_if_python_version_is_not_2(script): script.pip("list", "--no-python-version-warning") +@pytest.mark.skipif( + sys.version_info >= (3, 10), + reason="distutils is deprecated in 3.10+" +) def test_pip_works_with_warnings_as_errors(script): script.environ['PYTHONWARNINGS'] = 'error' script.pip("--version") From 4d933d2e108325482b4ce26a85ea48ee859f6b70 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Fri, 6 Aug 2021 15:55:55 +0100 Subject: [PATCH 5/5] Use a stricter regex for matching the Python version Co-authored-by: Kevin Puetz --- tests/lib/test_lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/test_lib.py b/tests/lib/test_lib.py index 09c400211a9..0e26389c1d1 100644 --- a/tests/lib/test_lib.py +++ b/tests/lib/test_lib.py @@ -45,7 +45,7 @@ def test_correct_pip_version(script): # distribution pip_folder_outputed = re.match( r"pip \d+(\.[\d]+)+(\.?(b|rc|dev|pre|post)\d+)? from (.*) " - r"\(python \d(.[\d]+)+\)$", + r"\(python \d+(\.[\d]+)+\)$", result.stdout, ).group(4) pip_folder = join(SRC_DIR, "src", "pip")