Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0f9d259
Add basic mypy support
pradyunsg Jun 14, 2017
bc637a8
:newspaper:
pradyunsg Jun 16, 2017
ed9208e
Improve mypy configuration
pradyunsg Jun 14, 2017
9fce241
Patch pkg_resources for mypy
pradyunsg Jun 15, 2017
8f92b55
Fix mypy warnings
pradyunsg Jun 15, 2017
da46ab2
Add type annotations to pip.configuration
pradyunsg Jun 15, 2017
711596b
Use pip.utils.typing to guard typing imports
pradyunsg Jun 16, 2017
7c5f901
Modify vendoring to include additional .pyi stubs
pradyunsg Jul 4, 2017
adf4538
Add generated stubs
pradyunsg Jul 4, 2017
c2371a1
Exclude the pyi files and extra directory created
pradyunsg Jul 4, 2017
b3e16f9
Fix mypy errors since addition of stubs
pradyunsg Jul 17, 2017
55fd83f
Add a separate tox job for mypy
pradyunsg Jul 17, 2017
6a0da3d
Fix a bug found by mypy
pradyunsg Jul 17, 2017
9b03434
use six instead of try except
pradyunsg Jul 17, 2017
3046f7a
Don't ask for permission
pradyunsg Jul 17, 2017
182c548
Fix remaining errors
pradyunsg Jul 17, 2017
b9b5e4a
:art:
pradyunsg Jul 17, 2017
1b5a23f
:wrench:
pradyunsg Jul 17, 2017
c365304
Merge branch 'master' into mypy/infrastructure
pradyunsg Aug 2, 2017
cb113d5
I actually missed a conflict. Wow.
pradyunsg Aug 2, 2017
11451c5
Merge branch 'master' into mypy/infrastructure
pradyunsg Sep 2, 2017
d37868f
Move the typing file
pradyunsg Sep 2, 2017
d408818
Add imports I'd missed
pradyunsg Sep 2, 2017
d9a4431
Move mypy stubs as well
pradyunsg Sep 2, 2017
efd7264
Update MANIFEST
pradyunsg Sep 2, 2017
ec26f0a
Import from inner packages
pradyunsg Sep 2, 2017
da57810
type: Any partials in cmdoptions
pradyunsg Sep 2, 2017
93d9f20
Remove a useless section
pradyunsg Sep 2, 2017
e2b2f70
isort all imports
pradyunsg Sep 2, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
Merge branch 'master' into mypy/infrastructure
  • Loading branch information
pradyunsg committed Sep 2, 2017
commit 11451c54ec09317704942f4fc5f043f0ab4fe6fe
2 changes: 1 addition & 1 deletion .landscape.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ignore-paths:
- pip/_vendor/
- src/pip/_vendor/
2 changes: 2 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Markus Hametner <[email protected]
Masklinn <[email protected]>
Matthew Iversen <[email protected]> <[email protected]>
<[email protected]> <[email protected]>
Pradyun Gedam <[email protected]> <[email protected]>
Pradyun Gedam <[email protected]>
Preston Holmes <[email protected]>
Przemek Wrzos <hetmankp@none>
<[email protected]> <[email protected]>
Expand Down
21 changes: 12 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: python
sudo: false
dist: trusty

matrix:
include:
Expand All @@ -8,27 +9,29 @@ matrix:
- env: TOXENV=lint-py3
- env: TOXENV=mypy
- env: TOXENV=packaging

# PyPy jobs start first -- they are the slowest
- env: TOXENV=pypy
python: pypy
- env: TOXENV=pypy3
python: pypy3
# Latest Stable CPython jobs
- env: TOXENV=py27
python: 2.7
- env: TOXENV=py36
python: 3.6
# All the other Py3 versions
- env: TOXENV=py33
python: 3.3
- env: TOXENV=py34
python: 3.4
- env: TOXENV=py35
python: 3.5
- env: TOXENV=py36
python: 3.6
# Nightly Python goes last
- env: TOXENV=py37
python: nightly
- env: TOXENV=pypy
python: pypy-5.4
- env: "TOXENV=py27 VENDOR=no WHEELS=yes"
python: 2.7
- env: "TOXENV=py36 VENDOR=no WHEELS=yes"
python: 3.6
allow_failures:
- python: nightly
- python: pypy3

install: travis_retry .travis/install.sh
script: .travis/run.sh
Expand Down
40 changes: 1 addition & 39 deletions .travis/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,11 @@
set -e
set -x

# We want to create the virtual environment here, but not actually run anything
tox --notest

# If we have a VENDOR=no then we want to reinstall pip into the virtual
# environment without the vendor directory included as well as install the
# dependencies we need installed.
if [[ $VENDOR = "no" ]]; then
# Install our dependencies if we're not installing from wheels
if [[ $WHEELS != "yes" ]]; then
.tox/$TOXENV/bin/pip install -r pip/_vendor/vendor.txt --no-deps
fi

# Install our dependencies if we're installing from wheels
if [[ $WHEELS = "yes" ]]; then
mkdir -p /tmp/wheels
pip wheel --wheel-dir /tmp/wheels --no-deps -r pip/_vendor/vendor.txt
cp /tmp/wheels/* `echo .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/`
fi

# Remove the vendored dependencies from within the installed pip inside of
# our installed copy of pip.
find .tox/$TOXENV/lib/python*/site-packages/pip/_vendor -d \
-not -regex '.*/pip/_vendor/__init__\.py$' \
-not -regex '.*/pip/_vendor$' \
-exec rm -rf {} \;

# Patch our installed pip/_vendor/__init__.py so that it knows to look for
# the vendored dependencies instead of only looking for the vendored.
sed -i 's/DEBUNDLED = False/DEBUNDLED = True/' \
.tox/$TOXENV/lib/python*/site-packages/pip/_vendor/__init__.py

# Test to make sure that we successfully installed without vendoring
if [ -f .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/six.py ]; then
echo "Did not successfully unvendor"
exit 1
fi
fi

if [[ $TOXENV == py* ]]; then
# Run unit tests
tox -- -m unit
# Run integration tests
tox -- -m integration -n 8 --duration=5
tox -- -m integration -n 4 --duration=5
else
# Run once
tox
Expand Down
8 changes: 4 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ include LICENSE.txt
include NEWS.rst
include README.rst
include pyproject.toml
include pip/_vendor/README.rst
include pip/_vendor/vendor.txt
include src/pip/_vendor/README.rst
include src/pip/_vendor/vendor.txt

exclude .coveragerc
exclude .mailmap
exclude .travis.yml
exclude .landscape.yml
exclude pip/_vendor/Makefile
exclude src/pip/_vendor/Makefile
exclude tox.ini
exclude dev-requirements.txt
exclude appveyor.yml

recursive-include pip/_vendor *.pem
recursive-include src/pip/_vendor *.pem
recursive-include docs Makefile *.rst *.py *.bat

exclude pip/_vendor/six
Expand Down
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pytest-catchlog
pytest-rerunfailures
pytest-timeout
pytest-xdist
pyyaml
mock<1.1
scripttest>=1.3
https://github.com/pypa/virtualenv/archive/master.zip#egg=virtualenv
6 changes: 3 additions & 3 deletions docs/pipext.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from docutils.parsers import rst
from docutils.statemachine import ViewList
from textwrap import dedent
from pip.commands import commands_dict as commands
from pip import cmdoptions
from pip.utils import get_prog
from pip._internal import cmdoptions
from pip._internal.commands import commands_dict as commands
from pip._internal.utils.misc import get_prog


class PipCommandUsage(rst.Directive):
Expand Down
1 change: 1 addition & 0 deletions news/3830.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pip no longer passes global options from one package to later packages in the same requirement file.
1 change: 1 addition & 0 deletions news/4227.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Report the line which caused the hash error when using requirement files.
1 change: 1 addition & 0 deletions news/4299.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support build-numbers in wheel versions and support sorting with build-numbers.
2 changes: 2 additions & 0 deletions news/4696.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Move all of pip's APIs into the pip._internal package, properly reflecting the
fact that pip does not currently have any public APIs.
2 changes: 2 additions & 0 deletions news/4700.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Move all of pip's APIs into the pip._internal package, properly reflecting the
fact that pip does not currently have any public APIs.
4 changes: 0 additions & 4 deletions pip/models/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ follow_imports = skip
ignore_errors = True

[tool:pytest]
addopts = --ignore pip/_vendor --ignore tests/tests_cache
addopts = --ignore src/pip/_vendor --ignore tests/tests_cache

[bdist_wheel]
universal=1
14 changes: 9 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def find_version(*file_paths):

setup(
name="pip",
version=find_version("pip", "__init__.py"),
version=find_version("src", "pip", "__init__.py"),
description="The PyPA recommended tool for installing Python packages.",
long_description=long_description,
classifiers=[
Expand All @@ -60,7 +60,11 @@ def find_version(*file_paths):
author_email='[email protected]',
url='https://pip.pypa.io/',
license='MIT',
packages=find_packages(exclude=["contrib", "docs", "tests*", "tasks"]),
package_dir={"": "src"},
packages=find_packages(
where="src",
exclude=["contrib", "docs", "tests*", "tasks"],
),
package_data={
"pip._vendor.certifi": ["*.pem"],
"pip._vendor.requests": ["*.pem"],
Expand All @@ -69,9 +73,9 @@ def find_version(*file_paths):
},
entry_points={
"console_scripts": [
"pip=pip:main",
"pip%s=pip:main" % sys.version[:1],
"pip%s=pip:main" % sys.version[:3],
"pip=pip._internal:main",
"pip%s=pip._internal:main" % sys.version[:1],
"pip%s=pip._internal:main" % sys.version[:3],
],
},
tests_require=tests_require,
Expand Down
1 change: 1 addition & 0 deletions src/pip/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "10.0.0.dev0"
4 changes: 2 additions & 2 deletions pip/__main__.py → src/pip/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
path = os.path.dirname(os.path.dirname(__file__))
sys.path.insert(0, path)

import pip # noqa
from pip._internal import main as _main # noqa

if __name__ == '__main__':
sys.exit(pip.main())
sys.exit(_main())
30 changes: 13 additions & 17 deletions pip/__init__.py → src/pip/_internal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@
else:
securetransport.inject_into_urllib3()

from pip.exceptions import CommandError, PipError
from pip.utils import get_installed_distributions, get_prog
from pip.utils import deprecation
from pip.vcs import git, mercurial, subversion, bazaar # noqa
from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip.commands import get_summaries, get_similar_commands
from pip.commands import commands_dict
from pip import __version__
from pip._internal import cmdoptions
from pip._internal.exceptions import CommandError, PipError
from pip._internal.utils.misc import get_installed_distributions, get_prog
from pip._internal.utils import deprecation
from pip._internal.vcs import git, mercurial, subversion, bazaar # noqa
from pip._internal.baseparser import (
ConfigOptionParser, UpdatingDefaultsHelpFormatter,
)
from pip._internal.commands import get_summaries, get_similar_commands
from pip._internal.commands import commands_dict
from pip._vendor.requests.packages.urllib3.exceptions import (
InsecureRequestWarning,
)
Expand All @@ -61,12 +65,8 @@
# This fixes a peculiarity when importing via __import__ - as we are
# initialising the pip module, "from pip import cmdoptions" is recursive
# and appears not to work properly in that situation.
import pip.cmdoptions # noqa
cmdoptions = pip.cmdoptions # type: Any

# The version as used in the setup.py and the docs conf.py
__version__ = "10.0.0.dev0"

# import pip._internal.cmdoptions
# cmdoptions = pip._internal.cmdoptions

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -253,7 +253,3 @@ def main(args=None):
logger.debug("Ignoring error %s when setting locale", e)
command = commands_dict[cmd_name](isolated=check_isolated(cmd_args))
return command.main(cmd_args)


if __name__ == '__main__':
sys.exit(main())
41 changes: 24 additions & 17 deletions pip/basecommand.py → src/pip/_internal/basecommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,28 @@
import sys
import warnings

from pip import cmdoptions
from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip.compat import WINDOWS
from pip.download import PipSession
from pip.exceptions import (
from pip._internal import cmdoptions
from pip._internal.baseparser import (
ConfigOptionParser, UpdatingDefaultsHelpFormatter
)
from pip._internal.compat import WINDOWS
from pip._internal.download import PipSession
from pip._internal.exceptions import (
BadCommand, CommandError, InstallationError, PreviousBuildDirError,
UninstallationError
)
from pip.index import PackageFinder
from pip.locations import running_under_virtualenv
from pip.req import InstallRequirement, parse_requirements
from pip.status_codes import (
from pip._internal.index import PackageFinder
from pip._internal.locations import running_under_virtualenv
from pip._internal.req import InstallRequirement, parse_requirements
from pip._internal.status_codes import (
ERROR, PREVIOUS_BUILD_DIR_ERROR, SUCCESS, UNKNOWN_ERROR,
VIRTUALENV_NOT_FOUND
)
from pip.utils import deprecation, get_prog, normalize_path
from pip.utils.logging import IndentingFormatter
from pip.utils.outdated import pip_version_check
from pip.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.utils import deprecation
from pip._internal.utils.logging import IndentingFormatter
from pip._internal.utils.misc import get_prog, normalize_path
from pip._internal.utils.outdated import pip_version_check
from pip._internal.utils.typing import MYPY_CHECK_RUNNING

if MYPY_CHECK_RUNNING:
from typing import Optional
Expand Down Expand Up @@ -133,7 +136,7 @@ def main(self, args):
"disable_existing_loggers": False,
"filters": {
"exclude_warnings": {
"()": "pip.utils.logging.MaxLevelFilter",
"()": "pip._internal.utils.logging.MaxLevelFilter",
"level": logging.WARNING,
},
},
Expand All @@ -146,20 +149,24 @@ def main(self, args):
"handlers": {
"console": {
"level": level,
"class": "pip.utils.logging.ColorizedStreamHandler",
"class":
"pip._internal.utils.logging.ColorizedStreamHandler",
"stream": self.log_streams[0],
"filters": ["exclude_warnings"],
"formatter": "indent",
},
"console_errors": {
"level": "WARNING",
"class": "pip.utils.logging.ColorizedStreamHandler",
"class":
"pip._internal.utils.logging.ColorizedStreamHandler",
"stream": self.log_streams[1],
"formatter": "indent",
},
"user_log": {
"level": "DEBUG",
"class": "pip.utils.logging.BetterRotatingFileHandler",
"class":
("pip._internal.utils.logging"
".BetterRotatingFileHandler"),
"filename": options.log or "/dev/null",
"delay": True,
"formatter": "indent",
Expand Down
4 changes: 2 additions & 2 deletions pip/baseparser.py → src/pip/_internal/baseparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

from pip._vendor.six import string_types

from pip.configuration import Configuration
from pip.utils import get_terminal_size
from pip._internal.configuration import Configuration
from pip._internal.utils.misc import get_terminal_size

logger = logging.getLogger(__name__)

Expand Down
12 changes: 6 additions & 6 deletions pip/cache.py → src/pip/_internal/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

from pip._vendor.packaging.utils import canonicalize_name

import pip.index
from pip.compat import expanduser
from pip.download import path_to_url
from pip.wheel import InvalidWheelFilename, Wheel
from pip._internal import index
from pip._internal.compat import expanduser
from pip._internal.download import path_to_url
from pip._internal.wheel import InvalidWheelFilename, Wheel

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -71,7 +71,7 @@ def _get_candidates(self, link, package_name):
return []

canonical_name = canonicalize_name(package_name)
formats = pip.index.fmt_ctl_formats(
formats = index.fmt_ctl_formats(
self.format_control, canonical_name
)
if not self.allowed_formats.intersection(formats):
Expand Down Expand Up @@ -100,7 +100,7 @@ def _link_for_candidate(self, link, candidate):
root = self.get_path_for_link(link)
path = os.path.join(root, candidate)

return pip.index.Link(path_to_url(path))
return index.Link(path_to_url(path))


class WheelCache(Cache):
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.