Skip to content

Commit

Permalink
Merge branch 'main' into release/21.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Aug 6, 2021
2 parents 2c55d2b + 0b95378 commit b974673
Show file tree
Hide file tree
Showing 48 changed files with 1,048 additions and 942 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
tests:
# Anything that's touching testable stuff
- ".github/workflows/ci.yml"
- "tools/requirements/tests.txt"
- "src/**"
- "tests/**"
if: github.event_name == 'pull_request'
Expand Down
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ repos:
- id: black
exclude: |
(?x)
^src/pip/_internal/commands|
^src/pip/_internal/index|
^src/pip/_internal/models|
^src/pip/_internal/operations|
^src/pip/_internal/req|
^src/pip/_internal/vcs|
^src/pip/_internal/\w+\.py$|
# Tests
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ sphinx:
python:
version: 3.8
install:
- requirements: tools/requirements/docs.txt
- requirements: docs/requirements.txt
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ recursive-include src/pip/_vendor *LICENSE*
recursive-include src/pip/_vendor *COPYING*

include docs/docutils.conf
include docs/requirements.txt

exclude .coveragerc
exclude .mailmap
Expand Down
2 changes: 1 addition & 1 deletion docs/html/cli/pip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ verbosity log will be kept. This option is empty by default. This log appends
to previous logging.

Like all pip options, ``--log`` can also be set as an environment variable, or
placed into the pip config file. See the :ref:`Configuration` section.
placed into the pip config file. See the :doc:`topics/configuration` section.

.. _`exists-action`:

Expand Down
2 changes: 1 addition & 1 deletion docs/html/development/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
Configuration
=============

This content is now covered in the :ref:`Configuration` section of the :doc:`User Guide </user_guide>`.
This content is now covered in the :doc:`topics/configuration` section of the :doc:`User Guide </user_guide>`.
2 changes: 1 addition & 1 deletion tools/requirements/docs.txt → docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx == 3.2.1
sphinx ~= 4.1.0
towncrier
furo
myst_parser
Expand Down
1 change: 1 addition & 0 deletions news/10128.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve deprecation warning regarding the copying of source trees when installing from a local directory.
4 changes: 4 additions & 0 deletions news/10165.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Add a ``feature_flag`` optional kwarg to the ``deprecated()`` function
``pip._internal.utils.deprecation:deprecated``. Also formulate a corresponding canned
message which suggests using the ``--use-feature={feature_flag}`` to test upcoming
behavior.
3 changes: 3 additions & 0 deletions news/10233.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
New resolver: When a package is specified with extras in constraints, and with
extras in non-constraint requirements, the resolver now correctly identifies the
constraint's existence and avoids backtracking.
2 changes: 2 additions & 0 deletions news/10252.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Modify the ``sysconfig.get_preferred_scheme`` function check to be
compatible with CPython 3.10’s alphareleases.
Empty file.
Empty file.
6 changes: 3 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"protected-pip": "tools/tox_pip.py",
}
REQUIREMENTS = {
"docs": "tools/requirements/docs.txt",
"tests": "tools/requirements/tests.txt",
"common-wheels": "tools/requirements/tests-common_wheels.txt",
"docs": "docs/requirements.txt",
"tests": "tests/requirements.txt",
"common-wheels": "tests/requirements-common_wheels.txt",
}

AUTHORS_FILE = "AUTHORS.txt"
Expand Down
163 changes: 89 additions & 74 deletions src/pip/_internal/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,87 +3,102 @@
"""

import importlib
from collections import OrderedDict, namedtuple
from collections import namedtuple
from typing import Any, Dict, Optional

from pip._internal.cli.base_command import Command

CommandInfo = namedtuple('CommandInfo', 'module_path, class_name, summary')
CommandInfo = namedtuple("CommandInfo", "module_path, class_name, summary")

# The ordering matters for help display.
# Also, even though the module path starts with the same
# "pip._internal.commands" prefix in each case, we include the full path
# because it makes testing easier (specifically when modifying commands_dict
# in test setup / teardown by adding info for a FakeCommand class defined
# in a test-related module).
# Finally, we need to pass an iterable of pairs here rather than a dict
# so that the ordering won't be lost when using Python 2.7.
commands_dict: Dict[str, CommandInfo] = OrderedDict([
('install', CommandInfo(
'pip._internal.commands.install', 'InstallCommand',
'Install packages.',
)),
('download', CommandInfo(
'pip._internal.commands.download', 'DownloadCommand',
'Download packages.',
)),
('uninstall', CommandInfo(
'pip._internal.commands.uninstall', 'UninstallCommand',
'Uninstall packages.',
)),
('freeze', CommandInfo(
'pip._internal.commands.freeze', 'FreezeCommand',
'Output installed packages in requirements format.',
)),
('list', CommandInfo(
'pip._internal.commands.list', 'ListCommand',
'List installed packages.',
)),
('show', CommandInfo(
'pip._internal.commands.show', 'ShowCommand',
'Show information about installed packages.',
)),
('check', CommandInfo(
'pip._internal.commands.check', 'CheckCommand',
'Verify installed packages have compatible dependencies.',
)),
('config', CommandInfo(
'pip._internal.commands.configuration', 'ConfigurationCommand',
'Manage local and global configuration.',
)),
('search', CommandInfo(
'pip._internal.commands.search', 'SearchCommand',
'Search PyPI for packages.',
)),
('cache', CommandInfo(
'pip._internal.commands.cache', 'CacheCommand',
# This dictionary does a bunch of heavy lifting for help output:
# - Enables avoiding additional (costly) imports for presenting `--help`.
# - The ordering matters for help display.
#
# Even though the module path starts with the same "pip._internal.commands"
# prefix, the full path makes testing easier (specifically when modifying
# `commands_dict` in test setup / teardown).
commands_dict: Dict[str, CommandInfo] = {
"install": CommandInfo(
"pip._internal.commands.install",
"InstallCommand",
"Install packages.",
),
"download": CommandInfo(
"pip._internal.commands.download",
"DownloadCommand",
"Download packages.",
),
"uninstall": CommandInfo(
"pip._internal.commands.uninstall",
"UninstallCommand",
"Uninstall packages.",
),
"freeze": CommandInfo(
"pip._internal.commands.freeze",
"FreezeCommand",
"Output installed packages in requirements format.",
),
"list": CommandInfo(
"pip._internal.commands.list",
"ListCommand",
"List installed packages.",
),
"show": CommandInfo(
"pip._internal.commands.show",
"ShowCommand",
"Show information about installed packages.",
),
"check": CommandInfo(
"pip._internal.commands.check",
"CheckCommand",
"Verify installed packages have compatible dependencies.",
),
"config": CommandInfo(
"pip._internal.commands.configuration",
"ConfigurationCommand",
"Manage local and global configuration.",
),
"search": CommandInfo(
"pip._internal.commands.search",
"SearchCommand",
"Search PyPI for packages.",
),
"cache": CommandInfo(
"pip._internal.commands.cache",
"CacheCommand",
"Inspect and manage pip's wheel cache.",
)),
('index', CommandInfo(
'pip._internal.commands.index', 'IndexCommand',
),
"index": CommandInfo(
"pip._internal.commands.index",
"IndexCommand",
"Inspect information available from package indexes.",
)),
('wheel', CommandInfo(
'pip._internal.commands.wheel', 'WheelCommand',
'Build wheels from your requirements.',
)),
('hash', CommandInfo(
'pip._internal.commands.hash', 'HashCommand',
'Compute hashes of package archives.',
)),
('completion', CommandInfo(
'pip._internal.commands.completion', 'CompletionCommand',
'A helper command used for command completion.',
)),
('debug', CommandInfo(
'pip._internal.commands.debug', 'DebugCommand',
'Show information useful for debugging.',
)),
('help', CommandInfo(
'pip._internal.commands.help', 'HelpCommand',
'Show help for commands.',
)),
])
),
"wheel": CommandInfo(
"pip._internal.commands.wheel",
"WheelCommand",
"Build wheels from your requirements.",
),
"hash": CommandInfo(
"pip._internal.commands.hash",
"HashCommand",
"Compute hashes of package archives.",
),
"completion": CommandInfo(
"pip._internal.commands.completion",
"CompletionCommand",
"A helper command used for command completion.",
),
"debug": CommandInfo(
"pip._internal.commands.debug",
"DebugCommand",
"Show information useful for debugging.",
),
"help": CommandInfo(
"pip._internal.commands.help",
"HelpCommand",
"Show help for commands.",
),
}


def create_command(name: str, **kwargs: Any) -> Command:
Expand Down
Loading

0 comments on commit b974673

Please sign in to comment.