diff --git a/README.rst b/README.rst index 4e2b80ffc..e13fea9da 100644 --- a/README.rst +++ b/README.rst @@ -495,5 +495,5 @@ versions as the required ``pip`` versions. +---------------+----------------+----------------+ | 5.5.0 | 20.1 - 20.3.* | 2.7, 3.5 - 3.9 | +---------------+----------------+----------------+ -| 6.0.0 | 20.1 - 20.3.* | 3.6 - 3.9 | +| 6.0.0 | 20.3+ | 3.6 - 3.9 | +---------------+----------------+----------------+ diff --git a/piptools/repositories/pypi.py b/piptools/repositories/pypi.py index 08ec1215f..3ade3248d 100644 --- a/piptools/repositories/pypi.py +++ b/piptools/repositories/pypi.py @@ -23,7 +23,7 @@ from pip._internal.utils.urls import path_to_url, url_to_path from pip._vendor.requests import RequestException -from .._compat import PIP_VERSION, contextlib +from .._compat import contextlib from ..exceptions import NoCandidateFound from ..logging import log from ..utils import ( @@ -55,11 +55,7 @@ def __init__(self, pip_args, cache_dir): # General options (find_links, index_url, extra_index_url, trusted_host, # and pre) are deferred to pip. self.command = create_command("install") - extra_pip_args = ( - [] - if PIP_VERSION[:2] <= (20, 2) - else ["--use-deprecated", "legacy-resolver"] - ) + extra_pip_args = ["--use-deprecated", "legacy-resolver"] self.options, _ = self.command.parse_args(pip_args + extra_pip_args) if self.options.cache_dir: self.options.cache_dir = normalize_path(self.options.cache_dir) @@ -88,8 +84,6 @@ def __init__(self, pip_args, cache_dir): self._source_dir = None self._cache_dir = normalize_path(str(cache_dir)) self._download_dir = os.path.join(self._cache_dir, "pkgs") - if PIP_VERSION[:2] <= (20, 2): - self._wheel_download_dir = os.path.join(self._cache_dir, "wheels") self._setup_logging() @@ -119,8 +113,6 @@ def source_dir(self): def clear_caches(self): rmtree(self._download_dir, ignore_errors=True) - if PIP_VERSION[:2] <= (20, 2): - rmtree(self._wheel_download_dir, ignore_errors=True) def find_all_candidates(self, req_name): if req_name not in self._available_candidates_cache: @@ -174,15 +166,10 @@ def resolve_reqs(self, download_dir, ireq, wheel_cache): use_user_site=False, download_dir=download_dir, ) - if PIP_VERSION[:2] <= (20, 2): - preparer_kwargs["wheel_download_dir"] = self._wheel_download_dir preparer = self.command.make_requirement_preparer(**preparer_kwargs) reqset = RequirementSet() - if PIP_VERSION[:2] <= (20, 1): - ireq.is_direct = True - else: - ireq.user_supplied = True + ireq.user_supplied = True reqset.add_requirement(ireq) resolver = self.command.make_resolver( @@ -200,10 +187,7 @@ def resolve_reqs(self, download_dir, ireq, wheel_cache): if not ireq.prepared: # If still not prepared, e.g. a constraint, do enough to assign # the ireq a name: - if PIP_VERSION[:2] <= (20, 2): - resolver._get_abstract_dist_for(ireq) - else: - resolver._get_dist_for(ireq) + resolver._get_dist_for(ireq) return set(results) @@ -233,8 +217,6 @@ def get_dependencies(self, ireq): else: download_dir = self._get_download_path(ireq) os.makedirs(download_dir, exist_ok=True) - if PIP_VERSION[:2] <= (20, 2): - os.makedirs(self._wheel_download_dir, exist_ok=True) with global_tempdir_manager(): wheel_cache = WheelCache(self._cache_dir, self.options.format_control) diff --git a/setup.cfg b/setup.cfg index 521c4215b..5cda9035e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,7 +30,7 @@ packages = find: zip_safe = false install_requires = click >= 7 - pip >= 20.1 + pip >= 20.3 [options.packages.find] exclude = tests diff --git a/tests/test_resolver.py b/tests/test_resolver.py index 0e2f08609..03f6e9d9b 100644 --- a/tests/test_resolver.py +++ b/tests/test_resolver.py @@ -1,6 +1,5 @@ import pytest -from piptools._compat import PIP_VERSION from piptools.exceptions import NoCandidateFound from piptools.resolver import RequirementSummary, combine_install_requirements @@ -325,40 +324,12 @@ def test_compile_failure_shows_provenance(resolver, from_line): ("test_package", "test_package", True), ("test_package==1.2.3", "test_package==1.2.3", True), ("test_package>=1.2.3", "test_package>=1.2.3", True), - pytest.param( - "test_package==1.2", - "test_package==1.2.0", - True, - marks=pytest.mark.skipif( - PIP_VERSION[:2] < (20, 2), reason="Required only for pip>=20.2" - ), - ), - pytest.param( - "test_package>=1.2", - "test_package>=1.2.0", - True, - marks=pytest.mark.skipif( - PIP_VERSION[:2] < (20, 2), reason="Required only for pip>=20.2" - ), - ), + ("test_package==1.2", "test_package==1.2.0", True), + ("test_package>=1.2", "test_package>=1.2.0", True), ("test_package[foo,bar]==1.2", "test_package[bar,foo]==1.2", True), ("test_package[foo,bar]>=1.2", "test_package[bar,foo]>=1.2", True), - pytest.param( - "test_package[foo,bar]==1.2", - "test_package[bar,foo]==1.2.0", - True, - marks=pytest.mark.skipif( - PIP_VERSION[:2] < (20, 2), reason="Required only for pip>=20.2" - ), - ), - pytest.param( - "test_package[foo,bar]>=1.2", - "test_package[bar,foo]>=1.2.0", - True, - marks=pytest.mark.skipif( - PIP_VERSION[:2] < (20, 2), reason="Required only for pip>=20.2" - ), - ), + ("test_package[foo,bar]==1.2", "test_package[bar,foo]==1.2.0", True), + ("test_package[foo,bar]>=1.2", "test_package[bar,foo]>=1.2.0", True), ("test_package", "other_test_package", False), ("test_package==1.2.3", "other_test_package==1.2.3", False), ("test_package==1.2.3", "test_package==1.2.4", False), @@ -387,40 +358,12 @@ def test_RequirementSummary_equality(from_line, left_hand, right_hand, expected) ("test_package", "test_package", True), ("test_package==1.2.3", "test_package==1.2.3", True), ("test_package>=1.2.3", "test_package>=1.2.3", True), - pytest.param( - "test_package==1.2", - "test_package==1.2.0", - True, - marks=pytest.mark.skipif( - PIP_VERSION[:2] < (20, 2), reason="Required only for pip>=20.2" - ), - ), - pytest.param( - "test_package>=1.2", - "test_package>=1.2.0", - True, - marks=pytest.mark.skipif( - PIP_VERSION[:2] < (20, 2), reason="Required only for pip>=20.2" - ), - ), + ("test_package==1.2", "test_package==1.2.0", True), + ("test_package>=1.2", "test_package>=1.2.0", True), ("test_package[foo,bar]==1.2", "test_package[bar,foo]==1.2", True), ("test_package[foo,bar]>=1.2", "test_package[bar,foo]>=1.2", True), - pytest.param( - "test_package[foo,bar]==1.2", - "test_package[bar,foo]==1.2.0", - True, - marks=pytest.mark.skipif( - PIP_VERSION[:2] < (20, 2), reason="Required only for pip>=20.2" - ), - ), - pytest.param( - "test_package[foo,bar]>=1.2", - "test_package[bar,foo]>=1.2.0", - True, - marks=pytest.mark.skipif( - PIP_VERSION[:2] < (20, 2), reason="Required only for pip>=20.2" - ), - ), + ("test_package[foo,bar]==1.2", "test_package[bar,foo]==1.2.0", True), + ("test_package[foo,bar]>=1.2", "test_package[bar,foo]>=1.2.0", True), ("test_package", "other_test_package", False), ("test_package==1.2.3", "other_test_package==1.2.3", False), ("test_package==1.2.3", "test_package==1.2.4", False), diff --git a/tox.ini b/tox.ini index 0598e1bf9..e5da91be4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = # NOTE: keep this in sync with the env list in .github/workflows/ci.yml. - py{36,37,38,39,py3}-pip{20.1,20.2,20.3,previous,latest,master}-coverage + py{36,37,38,39,py3}-pip{20.3,previous,latest,master}-coverage checkqa readme skip_missing_interpreters = True @@ -11,11 +11,9 @@ extras = testing coverage: coverage deps = - pipprevious: pip==20.2.* + pipprevious: pip==20.3.* piplatest: pip pipmaster: -e git+https://github.com/pypa/pip.git@master#egg=pip - pip20.1: pip==20.1.* - pip20.2: pip==20.2.* pip20.3: pip==20.3.* setenv = coverage: PYTEST_ADDOPTS=--strict --doctest-modules --cov --cov-report=term-missing --cov-report=xml {env:PYTEST_ADDOPTS:}