Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop pip-20.0 support #1191

Merged
merged 4 commits into from Jul 31, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions .appveyor.yml
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -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:
Expand Down
16 changes: 9 additions & 7 deletions README.rst
Expand Up @@ -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.* |
+---------------+-----------------+
14 changes: 2 additions & 12 deletions piptools/_compat/pip_compat.py
Expand Up @@ -2,24 +2,14 @@
from __future__ import absolute_import

import pip
from pip._internal.cli.progress_bars import BAR_TYPES
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
):
Expand Down
6 changes: 1 addition & 5 deletions piptools/repositories/local.py
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 0 additions & 6 deletions piptools/repositories/pypi.py
Expand Up @@ -187,9 +187,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):
Expand Down Expand Up @@ -238,9 +235,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):
Expand Down
7 changes: 1 addition & 6 deletions piptools/utils.py
Expand Up @@ -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"}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -32,7 +32,7 @@ zip_safe = false
install_requires =
click >= 7
six
pip >= 20.0
pip >= 20.1

[options.packages.find]
exclude = tests
Expand Down
15 changes: 0 additions & 15 deletions tests/test_repository_pypi.py
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
9 changes: 2 additions & 7 deletions 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
Expand All @@ -12,15 +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.*
; TODO: change to pip==20.2.* after pip-20.2 being released
pip20.2: -e git+https://github.com/pypa/pip.git@master#egg=pip
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

Expand All @@ -46,7 +42,6 @@ commands = twine check {distdir}/*

[travis:env]
PIP =
20.0: pip20.0
20.1: pip20.1
20.2: pip20.2
latest: piplatest
Expand Down