Skip to content

Commit

Permalink
Merge pull request #1055 from atugushev/drop-old-pips
Browse files Browse the repository at this point in the history
Pin pip-tools to pip>=20.0
  • Loading branch information
atugushev authored Mar 3, 2020
2 parents 4396227 + 2aab742 commit 888c2a1
Show file tree
Hide file tree
Showing 21 changed files with 91 additions and 583 deletions.
115 changes: 3 additions & 112 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,136 +3,27 @@ environment:
PYTHON: "C:\\Python36"

matrix:
- TOXENV: py27-pip8.1.1-coverage
PIP: 8.1.1
- TOXENV: py27-pip9.0.1
PIP: 9.0.1
- TOXENV: py27-pip9.0.3
PIP: 9.0.3
- TOXENV: py27-pip10.0.1
PIP: 10.0.1
- TOXENV: py27-pip18.0
PIP: 18.0
- TOXENV: py27-pip19.0.3
PIP: 19.0.3
- TOXENV: py27-pip19.1
PIP: 19.1
- TOXENV: py27-pip19.2.3
PIP: 19.2.3
- TOXENV: py27-pip19.3
PIP: 19.3
- TOXENV: py27-pip20.0
PIP: 20.0
- TOXENV: py27-pipmaster
PIP: master
# TODO: add "PIP: 20.0" after pip==20.1 being released

- TOXENV: py27-piplatest-coverage
PIP: latest

- TOXENV: py35-pip8.1.1
PIP: 8.1.1
- TOXENV: py35-pip9.0.1
PIP: 9.0.1
- TOXENV: py35-pip9.0.3
PIP: 9.0.3
- TOXENV: py35-pip10.0.1
PIP: 10.0.1
- TOXENV: py35-pip18.0-coverage
PIP: 18.0
- TOXENV: py35-pip19.0.3
PIP: 19.0.3
- TOXENV: py35-pip19.1
PIP: 19.1
- TOXENV: py35-pip19.2.3
PIP: 19.2.3
- TOXENV: py35-pip19.3
PIP: 19.3
- TOXENV: py35-pip20.0
PIP: 20.0
- TOXENV: py35-pipmaster
PIP: master
- TOXENV: py35-piplatest
PIP: latest

- TOXENV: py36-pip8.1.1
PIP: 8.1.1
- TOXENV: py36-pip9.0.1
PIP: 9.0.1
- TOXENV: py36-pip9.0.3
PIP: 9.0.3
- TOXENV: py36-pip10.0.1
PIP: 10.0.1
- TOXENV: py36-pip18.0
PIP: 18.0
- TOXENV: py36-pip19.0.3-coverage
PIP: 19.0.3
- TOXENV: py36-pip19.1
PIP: 19.1
- TOXENV: py36-pip19.2.3
PIP: 19.2.3
- TOXENV: py36-pip19.3
PIP: 19.3
- TOXENV: py36-pip20.0
PIP: 20.0
- TOXENV: py36-pipmaster
PIP: master
- TOXENV: py36-piplatest
PIP: latest

- TOXENV: py37-pip8.1.1
PIP: 8.1.1
- TOXENV: py37-pip9.0.1
PIP: 9.0.1
- TOXENV: py37-pip9.0.3
PIP: 9.0.3
- TOXENV: py37-pip10.0.1
PIP: 10.0.1
- TOXENV: py37-pip18.0
PIP: 18.0
- TOXENV: py37-pip19.0.3
PIP: 19.0.3
- TOXENV: py37-pip19.1-coverage
PIP: 19.1
- TOXENV: py37-pip19.2.3
PIP: 19.2.3
- TOXENV: py37-pip19.3
PIP: 19.3
- TOXENV: py37-pip20.0
PIP: 20.0
- TOXENV: py37-pipmaster-coverage
PIP: master
- TOXENV: py37-piplatest-coverage
- TOXENV: py37-piplatest
PIP: latest

- TOXENV: py38-pip9.0.1
PIP: 9.0.1
- TOXENV: py38-pip9.0.3
PIP: 9.0.3
- TOXENV: py38-pip10.0.1
PIP: 10.0.1
- TOXENV: py38-pip18.0
PIP: 18.0
- TOXENV: py38-pip19.0.3
PIP: 19.0.3
- TOXENV: py38-pip19.1
PIP: 19.1
- TOXENV: py38-pip19.2.3-coverage
PIP: 19.2.3
- TOXENV: py38-pip19.3-coverage
PIP: 19.3
- TOXENV: py38-pip20.0
PIP: 20.0
- TOXENV: py38-pipmaster-coverage
PIP: master
- TOXENV: py38-piplatest-coverage
PIP: latest

matrix:
fast_finish: true
allow_failures:
- PIP: master
exclude:
# platform.linux_distribution() is removed in Python 3.8 (bpo-28167).
- TOXENV: py38-pip8.1.1

install:
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
Expand Down
37 changes: 1 addition & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,8 @@ python:

env:
# NOTE: keep this in sync with envlist in tox.ini for tox-travis.
- PIP=8.1.1
- PIP=9.0.1
- PIP=9.0.3
- PIP=10.0.1
- PIP=18.0
- PIP=19.0.3
- PIP=19.1
- PIP=19.2.3
- PIP=19.3
- PIP=20.0
# TODO: add PIP=20.0 after pip==20.1 being released
- PIP=latest
- PIP=master

cache: false
install:
Expand All @@ -30,37 +20,12 @@ script:
- tox

stages:
- baseline
- test
- name: deploy
if: repo = jazzband/pip-tools AND tag IS present

jobs:
exclude:
- python: "pypy3.5-6.0"
env: PIP=8.1.1
# platform.linux_distribution() is removed in Python 3.8 (bpo-28167).
- python: "3.8"
env: PIP=8.1.1

# Baseline jobs (included there/below).
- env: PIP=latest
python: "3.8"
- env: PIP=latest
python: "3.7"
- env: PIP=latest
python: "2.7"

include:
# Baseline stage to abort early.
- stage: baseline
env: PIP=latest
python: "3.8"
- env: PIP=latest
python: "3.7"
- env: PIP=latest
python: "2.7"

# QA checks.
- env: TOXENV=checkqa
python: 3.7
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Similar to ``pip``, ``pip-tools`` must be installed in each of your project's
.. code-block:: bash
$ source /path/to/venv/bin/activate
(venv)$ pip install pip-tools
(venv)$ python -m pip install pip-tools
**Note**: all of the remaining example commands assume you've activated your
project's virtual environment.
Expand Down
32 changes: 1 addition & 31 deletions piptools/_compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,7 @@

import six

from .pip_compat import (
DEV_PKGS,
FAVORITE_HASH,
PIP_VERSION,
FormatControl,
InstallationCandidate,
InstallCommand,
InstallRequirement,
Link,
PackageFinder,
PyPI,
RequirementSet,
Resolver,
Wheel,
WheelCache,
cmdoptions,
get_installed_distributions,
get_requirement_tracker,
global_tempdir_manager,
install_req_from_editable,
install_req_from_line,
is_dir_url,
is_file_url,
is_vcs_url,
normalize_path,
parse_requirements,
path_to_url,
stdlib_pkgs,
url_to_path,
user_cache_dir,
)
from .pip_compat import PIP_VERSION

if six.PY2:
from .tempfile import TemporaryDirectory
Expand Down
111 changes: 0 additions & 111 deletions piptools/_compat/pip_compat.py
Original file line number Diff line number Diff line change
@@ -1,118 +1,7 @@
# -*- coding=utf-8 -*-
from __future__ import absolute_import

import importlib
from contextlib import contextmanager

import pip
from pip._vendor.packaging.version import parse as parse_version

PIP_VERSION = tuple(map(int, parse_version(pip.__version__).base_version.split(".")))

try:
from pip._internal.req.req_tracker import RequirementTracker
except ImportError:

@contextmanager
def RequirementTracker():
yield


# Introduced in pip 20.0
try:
from pip._internal.utils.temp_dir import global_tempdir_manager
except ImportError:

@contextmanager
def global_tempdir_manager():
yield


def do_import(module_path, subimport=None, old_path=None):
old_path = old_path or module_path
prefixes = ["pip._internal", "pip"]
paths = [module_path, old_path]
search_order = [
"{0}.{1}".format(p, pth) for p in prefixes for pth in paths if pth is not None
]
package = subimport if subimport else None
for to_import in search_order:
if not subimport:
to_import, _, package = to_import.rpartition(".")
try:
imported = importlib.import_module(to_import)
except ImportError:
continue
else:
return getattr(imported, package)


InstallRequirement = do_import("req.req_install", "InstallRequirement")
InstallationCandidate = do_import(
"models.candidate", "InstallationCandidate", old_path="index"
)
parse_requirements = do_import("req.req_file", "parse_requirements")
RequirementSet = do_import("req.req_set", "RequirementSet")
user_cache_dir = do_import("utils.appdirs", "user_cache_dir")
FAVORITE_HASH = do_import("utils.hashes", "FAVORITE_HASH")
path_to_url = do_import("utils.urls", "path_to_url", old_path="download")
url_to_path = do_import("utils.urls", "url_to_path", old_path="download")
PackageFinder = do_import("index.package_finder", "PackageFinder", old_path="index")
FormatControl = do_import("models.format_control", "FormatControl", old_path="index")
InstallCommand = do_import("commands.install", "InstallCommand")
Wheel = do_import("models.wheel", "Wheel", old_path="wheel")
cmdoptions = do_import("cli.cmdoptions", old_path="cmdoptions")
get_installed_distributions = do_import(
"utils.misc", "get_installed_distributions", old_path="utils"
)
PyPI = do_import("models.index", "PyPI")
stdlib_pkgs = do_import("utils.compat", "stdlib_pkgs", old_path="compat")
DEV_PKGS = do_import("commands.freeze", "DEV_PKGS")
Link = do_import("models.link", "Link", old_path="index")
Session = do_import("_vendor.requests.sessions", "Session")
Resolver = do_import("legacy_resolve", "Resolver", old_path="resolve")
WheelCache = do_import("cache", "WheelCache", old_path="wheel")
normalize_path = do_import("utils.misc", "normalize_path", old_path="utils")

# pip 18.1 has refactored InstallRequirement constructors use by pip-tools.
if PIP_VERSION < (18, 1):
install_req_from_line = InstallRequirement.from_line
install_req_from_editable = InstallRequirement.from_editable
else:
install_req_from_line = do_import("req.constructors", "install_req_from_line")
install_req_from_editable = do_import(
"req.constructors", "install_req_from_editable"
)


def is_vcs_url(link):
if PIP_VERSION < (19, 3):
_is_vcs_url = do_import("download", "is_vcs_url")
return _is_vcs_url(link)

return link.is_vcs


def is_file_url(link):
if PIP_VERSION < (19, 3):
_is_file_url = do_import("download", "is_file_url")
return _is_file_url(link)

return link.is_file


def is_dir_url(link):
if PIP_VERSION < (19, 3):
_is_dir_url = do_import("download", "is_dir_url")
return _is_dir_url(link)

return link.is_existing_dir()


def get_requirement_tracker():
if PIP_VERSION[:2] <= (19, 3):
return RequirementTracker()

from pip._internal.req import req_tracker

return req_tracker.get_requirement_tracker()
3 changes: 2 additions & 1 deletion piptools/locations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
from shutil import rmtree

from ._compat import user_cache_dir
from pip._internal.utils.appdirs import user_cache_dir

from .click import secho

# The user_cache_dir helper comes straight from pip itself
Expand Down
3 changes: 2 additions & 1 deletion piptools/repositories/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

from contextlib import contextmanager

from .._compat import FAVORITE_HASH
from pip._internal.utils.hashes import FAVORITE_HASH

from .base import BaseRepository

from piptools.utils import as_tuple, key_from_ireq, make_install_requirement
Expand Down
Loading

0 comments on commit 888c2a1

Please sign in to comment.