Merge pull request #1397 from pypa/speed

lazy load pip; refactor cli
This commit is contained in:
2018-02-04 16:06:47 -05:00
committed by GitHub
5 changed files with 2389 additions and 2297 deletions
+67 -2287
View File
File diff suppressed because it is too large Load Diff
+2307
View File
File diff suppressed because it is too large Load Diff
+7 -2
View File
@@ -9,9 +9,7 @@ import logging
import click
import crayons
import delegator
import pip
import parse
import requirements
import fuzzywuzzy.process
import requests
import six
@@ -271,6 +269,8 @@ packages = [
def get_requirement(dep):
import pip
import requirements
"""Pre-clean requirement strings passed to the requirements parser.
Ensures that we can accept both local and relative paths, file and VCS URIs,
@@ -454,6 +454,7 @@ def prepare_pip_source_args(sources, pip_args=None):
def actually_resolve_reps(deps, index_lookup, markers_lookup, project, sources, verbose, clear, pre):
import pip
class PipCommand(pip.basecommand.Command):
"""Needed for pip-tools."""
@@ -851,6 +852,7 @@ def is_required_version(version, specified_version):
def is_vcs(pipfile_entry):
import requirements
"""Determine if dictionary entry from Pipfile is for a vcs dependency."""
if hasattr(pipfile_entry, 'keys'):
@@ -864,6 +866,8 @@ def is_vcs(pipfile_entry):
def is_installable_file(path):
import pip
"""Determine if a path can potentially be installed"""
if hasattr(path, 'keys') and any(key for key in path.keys() if key in ['file', 'path']):
path = urlparse(path['file']).path if 'file' in path else path['path']
@@ -901,6 +905,7 @@ def is_file(package):
def pep440_version(version):
"""Normalize version to PEP 440 standards"""
import pip
# Use pip built-in version parser.
return str(pip.index.parse_version(version))
+1 -1
View File
@@ -2,7 +2,7 @@ import os
from mock import patch, Mock, PropertyMock
from pipenv.cli import (
from pipenv.core import (
pip_install, pip_download
)
+7 -7
View File
@@ -7,7 +7,7 @@ import json
import pytest
from pipenv.cli import activate_virtualenv
from pipenv.core import activate_virtualenv
from pipenv.utils import temp_environ, get_windows_path, mkdir_p, normalize_drive
from pipenv.vendor import toml
from pipenv.vendor import delegator
@@ -267,7 +267,7 @@ records = "*"
assert c.return_code != 0
c = p.pipenv('run python -c "import tablib"')
assert c.return_code == 0
@pytest.mark.run
@pytest.mark.uninstall
@@ -318,10 +318,10 @@ records = "*"
with PipenvInstance() as p:
c = p.pipenv('install --dev requests pytest')
assert c.return_code == 0
c = p.pipenv('install tpfd')
assert c.return_code == 0
assert 'tpfd' in p.pipfile['packages']
assert 'requests' in p.pipfile['dev-packages']
assert 'pytest' in p.pipfile['dev-packages']
@@ -342,7 +342,7 @@ records = "*"
c = p.pipenv('run python -m requests.help')
assert c.return_code > 0
c = p.pipenv('run python -c "import tpfd"')
assert c.return_code == 0
@@ -608,7 +608,7 @@ requests = {version = "*", os_name = "== 'splashwear'"}
assert 'tablib' in p.lockfile['default']
assert 'git' in p.lockfile['default']['tablib']
assert p.lockfile['default']['tablib']['git'] == 'git://github.com/kennethreitz/tablib.git'
assert 'ref' in p.lockfile['default']['tablib']
assert 'ref' in p.lockfile['default']['tablib']
@pytest.mark.run
@pytest.mark.alt
@@ -945,7 +945,7 @@ records = {extras = ["pandas"], version = "==0.5.2"}
def test_resolve_system_python_no_virtualenv(self):
"""Ensure we don't error out when we are in a folder off of / and doing an install using --system,
which used to cause the resolver and PIP_PYTHON_PATH to point at /bin/python
Sample dockerfile:
FROM python:3.6-alpine3.6