diff --git a/.appveyor.yml b/.appveyor.yml index 5df681cda..220bcea89 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -3,28 +3,28 @@ environment: PYTHON: "C:\\Python36" matrix: - - TOXENV: py27-pip20.0-coverage - PIP: 20.0 + - TOXENV: py27-pip20.1-coverage + PIP: 20.1 - TOXENV: py27-piplatest-coverage PIP: latest - - TOXENV: py35-pip20.0 - PIP: 20.0 + - TOXENV: py35-pip20.1 + PIP: 20.1 - TOXENV: py35-piplatest PIP: latest - - TOXENV: py36-pip20.0 - PIP: 20.0 + - TOXENV: py36-pip20.1 + PIP: 20.1 - TOXENV: py36-piplatest PIP: latest - - TOXENV: py37-pip20.0 - PIP: 20.0 + - TOXENV: py37-pip20.1 + PIP: 20.1 - TOXENV: py37-piplatest PIP: latest - - TOXENV: py38-pip20.0-coverage - PIP: 20.0 + - TOXENV: py38-pip20.1-coverage + PIP: 20.1 - TOXENV: py38-piplatest-coverage PIP: latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5da29dde..468375c63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,8 +28,7 @@ jobs: - 3.7 pip-version: - "latest" - - "20.2" # TODO: update to 20.1 after pip-20.2 being released - - "20.0" + - "20.1" include: - os: Ubuntu python-version: 3.9-dev diff --git a/.travis.yml b/.travis.yml index 7ed071a83..44ab4a13d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,7 @@ python: env: # NOTE: keep this in sync with envlist in tox.ini for tox-travis. - PIP=latest - - PIP=20.2 # TODO: update to 20.1 after pip-20.2 being released - - PIP=20.0 + - PIP=20.1 cache: false install: diff --git a/README.rst b/README.rst index 8f045a989..314eeaf2c 100644 --- a/README.rst +++ b/README.rst @@ -457,10 +457,12 @@ Versions and compatibility The table below summarizes the latest ``pip-tools`` versions with the required ``pip`` versions. -+-----------+-----------------+ -| pip-tools | pip | -+===========+=================+ -| 4.5.x | 8.1.3 - 20.0.x | -+-----------+-----------------+ -| 5.x | 20.0.x - 20.1.x | -+-----------+-----------------+ ++---------------+-----------------+ +| pip-tools | pip | ++===============+=================+ +| 4.5.* | 8.1.3 - 20.0.2 | ++---------------+-----------------+ +| 5.0.0 - 5.3.0 | 20.0 - 20.1.1 | ++---------------+-----------------+ +| >= 5.4.0 | 20.1 - 20.2.* | ++---------------+-----------------+ diff --git a/piptools/_compat/__init__.py b/piptools/_compat/__init__.py index f67f0949a..fda80d571 100644 --- a/piptools/_compat/__init__.py +++ b/piptools/_compat/__init__.py @@ -4,7 +4,7 @@ import six -from .pip_compat import BAR_TYPES, PIP_VERSION, parse_requirements +from .pip_compat import PIP_VERSION, parse_requirements if six.PY2: from .tempfile import TemporaryDirectory diff --git a/piptools/_compat/pip_compat.py b/piptools/_compat/pip_compat.py index 543593ad9..6cd24a0ff 100644 --- a/piptools/_compat/pip_compat.py +++ b/piptools/_compat/pip_compat.py @@ -3,23 +3,12 @@ import pip from pip._internal.req import parse_requirements as _parse_requirements +from pip._internal.req.constructors import install_req_from_parsed_requirement from pip._vendor.packaging.version import parse as parse_version PIP_VERSION = tuple(map(int, parse_version(pip.__version__).base_version.split("."))) -if PIP_VERSION[:2] <= (20, 0): - - def install_req_from_parsed_requirement(req, **kwargs): - return req - - from pip._internal.utils.ui import BAR_TYPES - -else: - from pip._internal.req.constructors import install_req_from_parsed_requirement - from pip._internal.cli.progress_bars import BAR_TYPES - - def parse_requirements( filename, session, finder=None, options=None, constraint=False, isolated=False ): diff --git a/piptools/repositories/local.py b/piptools/repositories/local.py index 6c91d1b4f..473db096a 100644 --- a/piptools/repositories/local.py +++ b/piptools/repositories/local.py @@ -5,7 +5,6 @@ from pip._internal.utils.hashes import FAVORITE_HASH -from .._compat import PIP_VERSION from .base import BaseRepository from piptools.utils import as_tuple, key_from_ireq, make_install_requirement @@ -79,10 +78,7 @@ def get_hashes(self, ireq): key_from_ireq(ireq) ) if existing_pin and ireq_satisfied_by_existing_pin(ireq, existing_pin): - if PIP_VERSION[:2] <= (20, 0): - hashes = existing_pin.options.get("hashes", {}) - else: - hashes = existing_pin.hash_options + hashes = existing_pin.hash_options hexdigests = hashes.get(FAVORITE_HASH) if hexdigests: return { diff --git a/piptools/repositories/pypi.py b/piptools/repositories/pypi.py index 7480b5e85..261ffcd3f 100644 --- a/piptools/repositories/pypi.py +++ b/piptools/repositories/pypi.py @@ -10,6 +10,7 @@ from shutil import rmtree from pip._internal.cache import WheelCache +from pip._internal.cli.progress_bars import BAR_TYPES from pip._internal.commands import create_command from pip._internal.models.index import PackageIndex, PyPI from pip._internal.models.link import Link @@ -23,7 +24,7 @@ from pip._internal.utils.urls import path_to_url, url_to_path from pip._vendor.requests import RequestException -from .._compat import BAR_TYPES, PIP_VERSION, TemporaryDirectory, contextlib +from .._compat import PIP_VERSION, TemporaryDirectory, contextlib from ..click import progressbar from ..exceptions import NoCandidateFound from ..logging import log @@ -187,9 +188,6 @@ def resolve_reqs(self, download_dir, ireq, wheel_cache): # the ireq a name: resolver._get_abstract_dist_for(ireq) - if PIP_VERSION[:2] <= (20, 0): - reqset.cleanup_files() - return set(results) def get_dependencies(self, ireq): @@ -238,9 +236,6 @@ def get_dependencies(self, ireq): else: del os.environ["PIP_REQ_TRACKER"] - if PIP_VERSION[:2] <= (20, 0): - wheel_cache.cleanup() - return self._dependencies_cache[ireq] def copy_ireq_dependencies(self, source, dest): diff --git a/piptools/utils.py b/piptools/utils.py index b0eca76a6..13c1ae496 100644 --- a/piptools/utils.py +++ b/piptools/utils.py @@ -12,7 +12,6 @@ from pip._internal.vcs import is_url from six.moves import shlex_quote -from ._compat import PIP_VERSION from .click import style UNSAFE_PACKAGES = {"setuptools", "distribute", "pip"} @@ -276,11 +275,7 @@ def get_hashes_from_ireq(ireq): in the requirement options. """ result = [] - if PIP_VERSION[:2] <= (20, 0): - ireq_hashes = ireq.options.get("hashes", {}) - else: - ireq_hashes = ireq.hash_options - for algorithm, hexdigests in ireq_hashes.items(): + for algorithm, hexdigests in ireq.hash_options.items(): for hash_ in hexdigests: result.append("{}:{}".format(algorithm, hash_)) return result diff --git a/setup.cfg b/setup.cfg index 7fbaa0efe..50aafcbcc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,7 +32,7 @@ zip_safe = false install_requires = click >= 7 six - pip >= 20.0 + pip >= 20.1 [options.packages.find] exclude = tests diff --git a/tests/test_repository_pypi.py b/tests/test_repository_pypi.py index e072bdd7c..5e9ec117b 100644 --- a/tests/test_repository_pypi.py +++ b/tests/test_repository_pypi.py @@ -6,7 +6,6 @@ from pip._internal.utils.urls import path_to_url from pip._vendor.requests import HTTPError, Session -from piptools._compat import PIP_VERSION from piptools.repositories import PyPIRepository from piptools.repositories.pypi import open_local_or_remote_file @@ -129,20 +128,6 @@ def test_pypirepo_source_dir_is_str(pypi_repository): assert isinstance(pypi_repository.source_dir, str) -@pytest.mark.skipif(PIP_VERSION[:2] > (20, 0), reason="Refactored in pip==20.1") -@mock.patch("piptools.repositories.pypi.PyPIRepository.resolve_reqs") # to run offline -@mock.patch("piptools.repositories.pypi.WheelCache") -def test_wheel_cache_cleanup_called( - WheelCache, resolve_reqs, pypi_repository, from_line -): - """ - Test WheelCache.cleanup() called once after dependency resolution. - """ - ireq = from_line("six==1.10.0") - pypi_repository.get_dependencies(ireq) - WheelCache.return_value.cleanup.assert_called_once_with() - - def test_relative_path_cache_dir_is_normalized(from_line): relative_cache_dir = "pypi-repo-cache" pypi_repository = PyPIRepository([], cache_dir=relative_cache_dir) diff --git a/tox.ini b/tox.ini index f0439eaf7..da3c82742 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = # NOTE: keep this in sync with the env list in .travis.yml for tox-travis. - py{27,35,36,37,38,39,py,py3}-pip{20.0,20.1,20.2,latest,master}-coverage + py{27,35,36,37,38,39,py,py3}-pip{20.1,20.2,latest,master}-coverage checkqa readme skip_missing_interpreters = True @@ -12,14 +12,11 @@ extras = coverage: coverage deps = pipmaster: -e git+https://github.com/pypa/pip.git@master#egg=pip -; TODO: remove all 20.0 mentions after pip-20.2 being released - pip20.0: pip==20.0.* pip20.1: pip==20.1.* pip20.2: pip==20.2.* setenv = piplatest: PIP=latest pipmaster: PIP=master - pip20.0: PIP==20.0 pip20.1: PIP==20.1 pip20.2: PIP==20.2 @@ -45,7 +42,6 @@ commands = twine check {distdir}/* [travis:env] PIP = - 20.0: pip20.0 20.1: pip20.1 20.2: pip20.2 latest: piplatest