Merge branch 'main' into switch-to-tenacity

This commit is contained in:
Tzu-ping Chung 2021-04-03 23:31:48 +08:00 committed by GitHub
commit 5457c6f399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
277 changed files with 6925 additions and 8853 deletions

View File

@ -1,36 +0,0 @@
parameters:
vmImage:
jobs:
- job: Package
dependsOn:
- Test_Primary
- Test_Secondary
pool:
vmImage: ${{ parameters.vmImage }}
steps:
- task: UsePythonVersion@0
displayName: Use Python 3 latest
inputs:
versionSpec: '3'
- bash: |
git config --global user.email "distutils-sig@python.org"
git config --global user.name "pip"
displayName: Setup Git credentials
- bash: pip install nox
displayName: Install dependencies
- bash: nox -s prepare-release -- 99.9
displayName: Prepare dummy release
- bash: nox -s build-release -- 99.9
displayName: Generate distributions for the dummy release
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: dist'
inputs:
pathtoPublish: dist
artifactName: dist

View File

@ -1,53 +0,0 @@
parameters:
vmImage:
jobs:
- job: Test_Primary
displayName: Tests /
pool:
vmImage: ${{ parameters.vmImage }}
strategy:
matrix:
"3.6": # lowest Python version
python.version: '3.6'
python.architecture: x64
"3.8": # current
python.version: '3.8'
python.architecture: x64
maxParallel: 6
steps:
- template: ../steps/run-tests-windows.yml
parameters:
runIntegrationTests: true
- job: Test_Secondary
displayName: Tests /
# Don't run integration tests for these runs
# Run after Test_Primary so we don't devour time and jobs if tests are going to fail
dependsOn: Test_Primary
pool:
vmImage: ${{ parameters.vmImage }}
strategy:
matrix:
"3.7":
python.version: '3.7'
python.architecture: x64
# This is for Windows, so test x86 builds
"3.6-x86":
python.version: '3.6'
python.architecture: x86
"3.7-x86":
python.version: '3.7'
python.architecture: x86
"3.8-x86":
python.version: '3.8'
python.architecture: x86
maxParallel: 6
steps:
- template: ../steps/run-tests-windows.yml
parameters:
runIntegrationTests: false

View File

@ -1,38 +0,0 @@
parameters:
vmImage:
jobs:
- job: Test_Primary
displayName: Tests /
pool:
vmImage: ${{ parameters.vmImage }}
strategy:
matrix:
"3.6": # lowest Python version
python.version: '3.6'
python.architecture: x64
"3.8":
python.version: '3.8'
python.architecture: x64
maxParallel: 2
steps:
- template: ../steps/run-tests.yml
- job: Test_Secondary
displayName: Tests /
# Run after Test_Primary so we don't devour time and jobs if tests are going to fail
dependsOn: Test_Primary
pool:
vmImage: ${{ parameters.vmImage }}
strategy:
matrix:
"3.7":
python.version: '3.7'
python.architecture: x64
maxParallel: 4
steps:
- template: ../steps/run-tests.yml

View File

@ -1,11 +0,0 @@
variables:
CI: true
jobs:
- template: jobs/test.yml
parameters:
vmImage: ubuntu-16.04
- template: jobs/package.yml
parameters:
vmImage: ubuntu-16.04

View File

@ -1,54 +0,0 @@
parameters:
runIntegrationTests:
steps:
- task: UsePythonVersion@0
displayName: Use Python $(python.version)
inputs:
versionSpec: '$(python.version)'
architecture: '$(python.architecture)'
- task: PowerShell@2
inputs:
filePath: .azure-pipelines/scripts/New-RAMDisk.ps1
arguments: "-Drive R -Size 1GB"
displayName: Setup RAMDisk
- powershell: |
mkdir R:\Temp
$acl = Get-Acl "R:\Temp"
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule(
"Everyone", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow"
)
$acl.AddAccessRule($rule)
Set-Acl "R:\Temp" $acl
displayName: Set RAMDisk Permissions
- bash: pip install --upgrade 'virtualenv<20' setuptools tox
displayName: Install Tox
- script: tox -e py -- -m unit -n auto --junit-xml=junit/unit-test.xml
env:
TEMP: "R:\\Temp"
displayName: Tox run unit tests
- ${{ if eq(parameters.runIntegrationTests, 'true') }}:
- powershell: |
# Fix Git SSL errors
pip install certifi tox
python -m certifi > cacert.txt
$env:GIT_SSL_CAINFO = $(Get-Content cacert.txt)
# Shorten paths to get under MAX_PATH or else integration tests will fail
# https://bugs.python.org/issue18199
$env:TEMP = "R:\Temp"
tox -e py -- -m integration -n auto --durations=5 --junit-xml=junit/integration-test.xml
displayName: Tox run integration tests
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFiles: junit/*.xml
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()

View File

@ -1,25 +0,0 @@
steps:
- task: UsePythonVersion@0
displayName: Use Python $(python.version)
inputs:
versionSpec: '$(python.version)'
- bash: pip install --upgrade 'virtualenv<20' setuptools tox
displayName: Install Tox
- script: tox -e py -- -m unit -n auto --junit-xml=junit/unit-test.xml
displayName: Tox run unit tests
# Run integration tests in two groups so we will fail faster if there is a failure in the first group
- script: tox -e py -- -m integration -n auto --durations=5 -k "not test_install" --junit-xml=junit/integration-test-group0.xml
displayName: Tox run Group 0 integration tests
- script: tox -e py -- -m integration -n auto --durations=5 -k "test_install" --junit-xml=junit/integration-test-group1.xml
displayName: Tox run Group 1 integration tests
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFiles: junit/*.xml
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()

View File

@ -1,11 +0,0 @@
variables:
CI: true
jobs:
- template: jobs/test-windows.yml
parameters:
vmImage: vs2017-win2016
- template: jobs/package.yml
parameters:
vmImage: vs2017-win2016

2
.gitattributes vendored
View File

@ -1,4 +1,4 @@
# Patches must have Unix-style line endings, even on Windows
tools/automation/vendoring/patches/* eol=lf
tools/vendoring/patches/* eol=lf
# The CA Bundle should always use Unix-style line endings, even on Windows
src/pip/_vendor/certifi/*.pem eol=lf

View File

@ -1,81 +1,62 @@
---
name: Bug report
about: Something is not working correctly.
description: Something is not working correctly.
title: ""
labels: "S: needs triage, type: bug"
issue_body: true # default: true, adds a classic WSYWIG textarea, if on
body:
- type: markdown
attributes:
value: |
If you're reporting an issue for `--use-feature=2020-resolver`,
use the "Dependency resolver failures / errors" template instead.
- type: markdown
attributes:
value: "**Environment**"
- type: input
attributes:
label: pip version
validations:
required: true
- type: input
attributes:
label: Python version
validations:
required: true
- type: input
attributes:
label: OS
validations:
required: true
- type: textarea
attributes:
label: Additional information
description: >-
Feel free to add more information about your environment here.
- type: textarea
attributes:
label: Description
description: >-
A clear and concise description of what the bug is.
- type: textarea
attributes:
label: Expected behavior
description: >-
A clear and concise description of what you expected to happen.
- type: textarea
attributes:
label: How to Reproduce
description: >-
Describe the steps to reproduce this bug.
value: |
1. Get package from '...'
2. Then run '...'
3. An error occurs.
- type: textarea
attributes:
label: Output
description: >-
Paste the output of the steps above, including the commands
themselves and pip's output/traceback etc.
value: |
```console
```
- type: checkboxes
attributes:
label: Code of Conduct
description: |
Read the [PSF Code of Conduct][CoC] first.
[CoC]: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
options:
- label: I agree to follow the PSF Code of Conduct
- type: textarea
attributes:
label: Description
description: >-
A clear and concise description of what the bug is.
validations:
required: true
...
- type: textarea
attributes:
label: Expected behavior
description: >-
A clear and concise description of what you expected to happen.
- type: input
attributes:
label: pip version
validations:
required: true
- type: input
attributes:
label: Python version
validations:
required: true
- type: input
attributes:
label: OS
validations:
required: true
- type: textarea
attributes:
label: How to Reproduce
description: Please provide steps to reproduce this bug.
value: |
1. Get package from '...'
2. Then run '...'
3. An error occurs.
validations:
required: true
- type: textarea
attributes:
label: Output
description: >-
Provide the output of the steps above, including the commands
themselves and pip's output/traceback etc.
render: sh-session
- type: checkboxes
attributes:
label: Code of Conduct
options:
- label: >-
I agree to follow the [PSF Code of Conduct](https://www.python.org/psf/conduct/).
required: true

View File

@ -1,34 +0,0 @@
---
name: Dependency resolver failures / errors
about: Report when the pip dependency resolver fails
labels: ["K: UX", "K: crash", "C: new resolver", "C: dependency resolution"]
---
<!--
Please provide as much information as you can about your failure, so that we can understand the root cause.
Try if your issue has been fixed in the in-development version of pip. Use the following command to install pip from master:
python -m pip install -U "pip @ https://github.com/pypa/pip/archive/master.zip"
-->
**What did you want to do?**
<!-- Include any inputs you gave to pip, for example:
* Package requirements: any CLI arguments and/or your requirements.txt file
* Already installed packages, outputted via `pip freeze`
-->
**Output**
```
Paste what pip outputted in a code block. https://github.github.com/gfm/#fenced-code-blocks
```
**Additional information**
<!--
It would be great if you could also include your dependency tree. For this you can use pipdeptree: https://pypi.org/project/pipdeptree/
For users installing packages from a private repository or local directory, please try your best to describe your setup. We'd like to understand how to reproduce the error locally, so would need (at a minimum) a description of the packages you are trying to install, and a list of dependencies for each package.
-->

187
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,187 @@
name: CI
on:
push:
branches: [master]
tags:
# Tags for all potential release numbers till 2030.
- "2[0-9].[0-3]" # 20.0 -> 29.3
- "2[0-9].[0-3].[0-9]+" # 20.0.0 -> 29.3.[0-9]+
pull_request:
schedule:
- cron: 0 0 * * MON # Run every Monday at 00:00 UTC
jobs:
determine-changes:
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.filter.outputs.tests }}
vendoring: ${{ steps.filter.outputs.vendoring }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
vendoring:
# Anything that's touching "vendored code"
- "src/pip/_vendor/**"
- "pyproject.toml"
tests:
# Anything that's touching testable stuff
- ".github/workflows/ci.yml"
- "tools/requirements/tests.txt"
- "src/**"
- "tests/**"
pre-commit:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0
with:
extra_args: --hook-stage=manual
packaging:
name: packaging
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Set up git credentials
run: |
git config --global user.email "pypa-dev@googlegroups.com"
git config --global user.name "pip"
- run: pip install nox
- run: nox -s prepare-release -- 99.9
- run: nox -s build-release -- 99.9
vendoring:
name: vendoring
runs-on: ubuntu-latest
needs: [determine-changes]
if: ${{ needs.determine-changes.outputs.vendoring == 'true' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install vendoring
- run: vendoring sync . --verbose
- run: git diff --exit-code
tests-unix:
name: tests / ${{ matrix.python }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
needs: [pre-commit, packaging, determine-changes]
if: ${{ needs.determine-changes.outputs.tests == 'true' }}
strategy:
fail-fast: true
matrix:
os: [Ubuntu, MacOS]
python:
- 3.6
- 3.7
- 3.8
- 3.9
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- run: pip install tox 'virtualenv<20'
# Main check
- name: Run unit tests
run: >-
tox -e py --
-m unit
--verbose --numprocesses auto --showlocals
- name: Run integration tests
run: >-
tox -e py --
-m integration
--verbose --numprocesses auto --showlocals
--durations=5
tests-windows:
name: tests / ${{ matrix.python }} / ${{ matrix.os }} / ${{ matrix.group }}
runs-on: ${{ matrix.os }}-latest
needs: [pre-commit, packaging, determine-changes]
if: ${{ needs.determine-changes.outputs.tests == 'true' }}
strategy:
fail-fast: true
matrix:
os: [Windows]
python:
- 3.6
# Commented out, since Windows tests are expensively slow.
# - 3.7
# - 3.8
- 3.9
group: [1, 2]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
# We use a RAMDisk on Windows, since filesystem IO is a big slowdown
# for our tests.
- name: Create a RAMDisk
run: ./tools/ci/New-RAMDisk.ps1 -Drive R -Size 1GB
- name: Setup RAMDisk permissions
run: |
mkdir R:\Temp
$acl = Get-Acl "R:\Temp"
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule(
"Everyone", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow"
)
$acl.AddAccessRule($rule)
Set-Acl "R:\Temp" $acl
- run: pip install tox 'virtualenv<20'
env:
TEMP: "R:\\Temp"
# Main check
- name: Run unit tests
if: matrix.group == 1
run: >-
tox -e py --
-m unit
--verbose --numprocesses auto --showlocals
env:
TEMP: "R:\\Temp"
- name: Run integration tests (group 1)
if: matrix.group == 1
run: >-
tox -e py --
-m integration -k "not test_install"
--verbose --numprocesses auto --showlocals
env:
TEMP: "R:\\Temp"
- name: Run integration tests (group 2)
if: matrix.group == 2
run: >-
tox -e py --
-m integration -k "test_install"
--verbose --numprocesses auto --showlocals
env:
TEMP: "R:\\Temp"

View File

@ -1,53 +0,0 @@
name: Linting
on:
push:
pull_request:
schedule:
# Run every Friday at 18:02 UTC
- cron: 2 18 * * 5
jobs:
lint:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
env:
TOXENV: lint,docs,vendoring
strategy:
matrix:
os:
- Ubuntu
- Windows
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
# Setup Caching
- name: pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements/tests.txt') }}-${{ hashFiles('tools/requirements/docs.txt') }}-${{ hashFiles('tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Set PY (for pre-commit cache)
run: echo "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- name: pre-commit cache
uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|2020-02-14|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
# Get the latest tox
- name: Install tox
run: python -m pip install tox
# Main check
- run: python -m tox

View File

@ -1,127 +0,0 @@
name: MacOS
on:
push:
pull_request:
schedule:
# Run every Friday at 18:02 UTC
- cron: 2 18 * * 5
jobs:
dev-tools:
name: Quality Check
runs-on: macos-latest
steps:
# Caches
- name: pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements/tests.txt') }}-${{ hashFiles('tools/requirements/docs.txt') }}-${{ hashFiles('tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Set PY (for pre-commit cache)
run: echo "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- name: pre-commit cache
uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|2020-02-14|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
# Setup
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install tox
run: python -m pip install tox
# Main check
- run: python -m tox -e "lint,docs"
packaging:
name: Packaging
runs-on: macos-latest
steps:
# Caches
- name: pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements/tests.txt') }}-${{ hashFiles('tools/requirements/docs.txt') }}-${{ hashFiles('tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
# Setup
- name: Set up git credentials
run: |
git config --global user.email "pypa-dev@googlegroups.com"
git config --global user.name "pip"
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install tox and nox
run: python -m pip install tox nox
# Main check
- name: Check vendored packages
run: python -m tox -e "vendoring"
- name: Prepare dummy release
run: nox -s prepare-release -- 99.9
- name: Generate distributions for the dummy release
run: nox -s build-release -- 99.9
tests:
name: Tests / ${{ matrix.python }}
runs-on: macos-latest
needs: dev-tools
strategy:
fail-fast: false
matrix:
python: [3.6, 3.7, 3.8, 3.9]
steps:
# Caches
- name: pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements/tests.txt') }}-${{ hashFiles('tools/requirements/docs.txt') }}-${{ hashFiles('tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
# Setup
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: python -m pip install tox 'virtualenv<20'
# Main check
- name: Run unit tests
run: >-
python -m tox -e py --
-m unit
--verbose
--numprocesses auto
- name: Run integration tests
run: >-
python -m tox -e py --
-m integration
--verbose
--numprocesses auto
--durations=5

3
.gitignore vendored
View File

@ -48,3 +48,6 @@ tests/data/common_wheels/
# Mac
.DS_Store
# Profiling related artifacts
*.prof

View File

@ -22,36 +22,23 @@ repos:
- id: black
exclude: |
(?x)
^docs/|
^src/pip/_internal/cli|
^src/pip/_internal/commands|
^src/pip/_internal/distributions|
^src/pip/_internal/index|
^src/pip/_internal/models|
^src/pip/_internal/network|
^src/pip/_internal/operations|
^src/pip/_internal/req|
^src/pip/_internal/resolution|
^src/pip/_internal/utils|
^src/pip/_internal/vcs|
^src/pip/_internal/\w+\.py$|
^src/pip/__main__.py$|
^tools/|
# Tests
^tests/conftest.py|
^tests/yaml|
^tests/lib|
^tests/data|
^tests/unit|
^tests/functional/(?!test_install)|
^tests/functional/test_install|
# Files in the root of the repository
^setup.py|
^noxfile.py|
# A blank ignore, to avoid merge conflicts later.
^$
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
@ -72,7 +59,7 @@ repos:
rev: v0.800
hooks:
- id: mypy
exclude: docs|tests
exclude: tests
args: ["--pretty"]
additional_dependencies: ['nox==2020.12.31']

View File

@ -1,32 +0,0 @@
language: python
cache: pip
dist: xenial
python: 3.9
addons:
apt:
packages:
- bzr
stages:
- primary
- secondary
jobs:
include:
# Basic Checks
- stage: primary
env: TOXENV=docs
- env: TOXENV=lint
- env: TOXENV=vendoring
# Complete checking for ensuring compatibility
# PyPy
- stage: secondary
env: GROUP=1
python: pypy3.6-7.3.1
- env: GROUP=2
python: pypy3.6-7.3.1
before_install: tools/travis/setup.sh
install: travis_retry tools/travis/install.sh
script: tools/travis/run.sh

View File

@ -22,7 +22,7 @@ exclude noxfile.py
recursive-include src/pip/_vendor *.pem
recursive-include src/pip/_vendor py.typed
recursive-include docs *.css *.rst *.py
recursive-include docs *.css *.py *.rst *.md
exclude src/pip/_vendor/six
exclude src/pip/_vendor/six/moves

View File

@ -1,160 +0,0 @@
"""A sphinx extension for collecting per doc feedback."""
from __future__ import annotations
from itertools import chain
from typing import Dict, List, Union
from sphinx.application import Sphinx
DEFAULT_DOC_LINES_THRESHOLD = 250
RST_INDENT = 4
EMAIL_INDENT = 6
def _modify_rst_document_source_on_read(
app: Sphinx,
docname: str,
source: List[str],
) -> None:
"""Add info block to top and bottom of each document source.
This function modifies RST source in-place by adding an admonition
block at the top and the bottom of each document right after it's
been read from disk preserving :orphan: at top, if present.
"""
admonition_type = app.config.docs_feedback_admonition_type
big_doc_lines = app.config.docs_feedback_big_doc_lines
escaped_email = app.config.docs_feedback_email.replace(' ', r'\ ')
excluded_documents = set(app.config.docs_feedback_excluded_documents)
questions_list = app.config.docs_feedback_questions_list
valid_admonitions = {
'attention', 'caution', 'danger', 'error', 'hint',
'important', 'note', 'tip', 'warning', 'admonition',
}
if admonition_type not in valid_admonitions:
raise ValueError(
'Expected `docs_feedback_admonition_type` to be one of '
f'{valid_admonitions} but got {admonition_type}.'
)
if not questions_list:
raise ValueError(
'Expected `docs_feedback_questions_list` to list questions '
'but got none.'
)
if docname in excluded_documents:
# NOTE: Completely ignore any document
# NOTE: listed in 'docs_feedback_excluded_documents'.
return
is_doc_big = source[0].count('\n') >= big_doc_lines
questions_list_rst = '\n'.join(
f'{" " * RST_INDENT}{number!s}. {question}'
for number, question in enumerate(questions_list, 1)
)
questions_list_urlencoded = (
'\n'.join(
f'\n{" " * RST_INDENT}{number!s}. {question} '
for number, question in enumerate(
chain(
(f'Document: {docname}. Page URL: https://', ),
questions_list,
),
)
).
rstrip('\r\n\t ').
replace('\r', '%0D').
replace('\n', '%0A').
replace(' ', '%20')
)
admonition_msg = rf"""
**Did this article help?**
We are currently doing research to improve pip's documentation
and would love your feedback.
Please `email us`_ and let us know{{let_us_know_ending}}
{{questions_list_rst}}
.. _email us:
mailto:{escaped_email}\
?subject=[Doc:\ {docname}]\ Pip\ docs\ feedback\ \
(URL\:\ https\://)\
&body={questions_list_urlencoded}
"""
let_us_know_ending = ':'
info_block_bottom = (
f'.. {admonition_type}::\n\t\t{admonition_msg.format_map(locals())}\n'
)
questions_list_rst = ''
let_us_know_ending = (
' why you came to this page and what on it helped '
'you and what did not. '
'(:issue:`Read more about this research <8517>`)'
)
info_block_top = '' if is_doc_big else (
f'.. {admonition_type}::\n\t\t{admonition_msg.format_map(locals())}\n'
)
orphan_mark = ':orphan:'
is_orphan = orphan_mark in source[0]
if is_orphan:
source[0] = source[0].replace(orphan_mark, '')
else:
orphan_mark = ''
source[0] = '\n\n'.join((
orphan_mark, info_block_top, source[0], info_block_bottom,
))
def setup(app: Sphinx) -> Dict[str, Union[bool, str]]:
"""Initialize the Sphinx extension.
This function adds a callback for modifying the document sources
in-place on read.
It also declares the extension settings changable via :file:`conf.py`.
"""
rebuild_trigger = 'html' # rebuild full html on settings change
app.add_config_value(
'docs_feedback_admonition_type',
default='important',
rebuild=rebuild_trigger,
)
app.add_config_value(
'docs_feedback_big_doc_lines',
default=DEFAULT_DOC_LINES_THRESHOLD,
rebuild=rebuild_trigger,
)
app.add_config_value(
'docs_feedback_email',
default='Docs UX Team <docs-feedback@pypa.io>',
rebuild=rebuild_trigger,
)
app.add_config_value(
'docs_feedback_excluded_documents',
default=set(),
rebuild=rebuild_trigger,
)
app.add_config_value(
'docs_feedback_questions_list',
default=(),
rebuild=rebuild_trigger,
)
app.connect('source-read', _modify_rst_document_source_on_read)
return {
'parallel_read_safe': True,
'parallel_write_safe': True,
'version': 'builtin',
}

48
docs/html/cli/index.md Normal file
View File

@ -0,0 +1,48 @@
# Commands
The general options that apply to all the commands listed below can be
found [under the `pip` page in this section](pip).
```{toctree}
:maxdepth: 1
:hidden:
pip
```
```{toctree}
:maxdepth: 1
:caption: Environment Management and Introspection
pip_install
pip_uninstall
pip_list
pip_freeze
pip_check
```
```{toctree}
:maxdepth: 1
:caption: Handling Distribution Files
pip_download
pip_wheel
pip_hash
```
```{toctree}
:maxdepth: 1
:caption: Package Index information
pip_show
pip_search
```
```{toctree}
:maxdepth: 1
:caption: Managing pip itself
pip_cache
pip_config
pip_debug
```

255
docs/html/cli/pip.rst Normal file
View File

@ -0,0 +1,255 @@
===
pip
===
Usage
*****
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip <command> [options]
.. tab:: Windows
.. code-block:: shell
py -m pip <command> [options]
Description
***********
.. _`Logging`:
Logging
=======
Console logging
~~~~~~~~~~~~~~~
pip offers :ref:`-v, --verbose <--verbose>` and :ref:`-q, --quiet <--quiet>`
to control the console log level. By default, some messages (error and warnings)
are colored in the terminal. If you want to suppress the colored output use
:ref:`--no-color <--no-color>`.
.. _`FileLogging`:
File logging
~~~~~~~~~~~~
pip offers the :ref:`--log <--log>` option for specifying a file where a maximum
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.
.. _`exists-action`:
--exists-action option
======================
This option specifies default behavior when path already exists.
Possible cases: downloading files or checking out repositories for installation,
creating archives. If ``--exists-action`` is not defined, pip will prompt
when decision is needed.
*(s)witch*
Only relevant to VCS checkout. Attempt to switch the checkout
to the appropriate URL and/or revision.
*(i)gnore*
Abort current operation (e.g. don't copy file, don't create archive,
don't modify a checkout).
*(w)ipe*
Delete the file or VCS checkout before trying to create, download, or checkout a new one.
*(b)ackup*
Rename the file or checkout to ``{name}{'.bak' * n}``, where n is some number
of ``.bak`` extensions, such that the file didn't exist at some point.
So the most recent backup will be the one with the largest number after ``.bak``.
*(a)abort*
Abort pip and return non-zero exit status.
.. _`build-interface`:
Build System Interface
======================
pip builds packages by invoking the build system. By default, builds will use
``setuptools``, but if a project specifies a different build system using a
``pyproject.toml`` file, as per :pep:`517`, pip will use that instead. As well
as package building, the build system is also invoked to install packages
direct from source. This is handled by invoking the build system to build a
wheel, and then installing from that wheel. The built wheel is cached locally
by pip to avoid repeated identical builds.
The current interface to the build system is via the ``setup.py`` command line
script - all build actions are defined in terms of the specific ``setup.py``
command line that will be run to invoke the required action.
Setuptools Injection
~~~~~~~~~~~~~~~~~~~~
When :pep:`517` is not used, the supported build system is ``setuptools``.
However, not all packages use ``setuptools`` in their build scripts. To support
projects that use "pure ``distutils``", pip injects ``setuptools`` into
``sys.modules`` before invoking ``setup.py``. The injection should be
transparent to ``distutils``-based projects, but 3rd party build tools wishing
to provide a ``setup.py`` emulating the commands pip requires may need to be
aware that it takes place.
Projects using :pep:`517` *must* explicitly use setuptools - pip does not do
the above injection process in this case.
Build System Output
~~~~~~~~~~~~~~~~~~~
Any output produced by the build system will be read by pip (for display to the
user if requested). In order to correctly read the build system output, pip
requires that the output is written in a well-defined encoding, specifically
the encoding the user has configured for text output (which can be obtained in
Python using ``locale.getpreferredencoding``). If the configured encoding is
ASCII, pip assumes UTF-8 (to account for the behaviour of some Unix systems).
Build systems should ensure that any tools they invoke (compilers, etc) produce
output in the correct encoding. In practice - and in particular on Windows,
where tools are inconsistent in their use of the "OEM" and "ANSI" codepages -
this may not always be possible. pip will therefore attempt to recover cleanly
if presented with incorrectly encoded build tool output, by translating
unexpected byte sequences to Python-style hexadecimal escape sequences
(``"\x80\xff"``, etc). However, it is still possible for output to be displayed
using an incorrect encoding (mojibake).
Under :pep:`517`, handling of build tool output is the backend's responsibility,
and pip simply displays the output produced by the backend. (Backends, however,
will likely still have to address the issues described above).
PEP 517 and 518 Support
~~~~~~~~~~~~~~~~~~~~~~~
As of version 10.0, pip supports projects declaring dependencies that are
required at install time using a ``pyproject.toml`` file, in the form described
in :pep:`518`. When building a project, pip will install the required
dependencies locally, and make them available to the build process.
Furthermore, from version 19.0 onwards, pip supports projects specifying the
build backend they use in ``pyproject.toml``, in the form described in
:pep:`517`.
When making build requirements available, pip does so in an *isolated
environment*. That is, pip does not install those requirements into the user's
``site-packages``, but rather installs them in a temporary directory which it
adds to the user's ``sys.path`` for the duration of the build. This ensures
that build requirements are handled independently of the user's runtime
environment. For example, a project that needs a recent version of setuptools
to build can still be installed, even if the user has an older version
installed (and without silently replacing that version).
In certain cases, projects (or redistributors) may have workflows that
explicitly manage the build environment. For such workflows, build isolation
can be problematic. If this is the case, pip provides a
``--no-build-isolation`` flag to disable build isolation. Users supplying this
flag are responsible for ensuring the build environment is managed
appropriately (including ensuring that all required build dependencies are
installed).
By default, pip will continue to use the legacy (direct ``setup.py`` execution
based) build processing for projects that do not have a ``pyproject.toml`` file.
Projects with a ``pyproject.toml`` file will use a :pep:`517` backend. Projects
with a ``pyproject.toml`` file, but which don't have a ``build-system`` section,
will be assumed to have the following backend settings::
[build-system]
requires = ["setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta:__legacy__"
.. note::
``setuptools`` 40.8.0 is the first version of setuptools that offers a
:pep:`517` backend that closely mimics directly executing ``setup.py``.
If a project has ``[build-system]``, but no ``build-backend``, pip will also use
``setuptools.build_meta:__legacy__``, but will expect the project requirements
to include ``setuptools`` and ``wheel`` (and will report an error if the
installed version of ``setuptools`` is not recent enough).
If a user wants to explicitly request :pep:`517` handling even though a project
doesn't have a ``pyproject.toml`` file, this can be done using the
``--use-pep517`` command line option. Similarly, to request legacy processing
even though ``pyproject.toml`` is present, the ``--no-use-pep517`` option is
available (although obviously it is an error to choose ``--no-use-pep517`` if
the project has no ``setup.py``, or explicitly requests a build backend). As
with other command line flags, pip recognises the ``PIP_USE_PEP517``
environment veriable and a ``use-pep517`` config file option (set to true or
false) to set this option globally. Note that overriding pip's choice of
whether to use :pep:`517` processing in this way does *not* affect whether pip
will use an isolated build environment (which is controlled via
``--no-build-isolation`` as noted above).
Except in the case noted above (projects with no :pep:`518` ``[build-system]``
section in ``pyproject.toml``), pip will never implicitly install a build
system. Projects **must** ensure that the correct build system is listed in
their ``requires`` list (this applies even if pip assumes that the
``setuptools`` backend is being used, as noted above).
.. _pep-518-limitations:
**Historical Limitations**:
* ``pip<18.0``: only supports installing build requirements from wheels, and
does not support the use of environment markers and extras (only version
specifiers are respected).
* ``pip<18.1``: build dependencies using .pth files are not properly supported;
as a result namespace packages do not work under Python 3.2 and earlier.
Future Developments
~~~~~~~~~~~~~~~~~~~
:pep:`426` notes that the intention is to add hooks to project metadata in
version 2.1 of the metadata spec, to explicitly define how to build a project
from its source. Once this version of the metadata spec is final, pip will
migrate to using that interface. At that point, the ``setup.py`` interface
documented here will be retained solely for legacy purposes, until projects
have migrated.
Specifically, applications should *not* expect to rely on there being any form
of backward compatibility guarantees around the ``setup.py`` interface.
Build Options
~~~~~~~~~~~~~
The ``--global-option`` and ``--build-option`` arguments to the ``pip install``
and ``pip wheel`` inject additional arguments into the ``setup.py`` command
(``--build-option`` is only available in ``pip wheel``). These arguments are
included in the command as follows:
.. tab:: Unix/macOS
.. code-block:: console
python setup.py <global_options> BUILD COMMAND <build_options>
.. tab:: Windows
.. code-block:: shell
py setup.py <global_options> BUILD COMMAND <build_options>
The options are passed unmodified, and presently offer direct access to the
distutils command line. Use of ``--global-option`` and ``--build-option``
should be considered as build system dependent, and may not be supported in the
current form if support for alternative build systems is added to pip.
.. _`General Options`:
General Options
***************
.. pip-general-options::

View File

@ -0,0 +1,27 @@
.. _`pip cache`:
pip cache
---------
Usage
*****
.. tab:: Unix/macOS
.. pip-command-usage:: cache "python -m pip"
.. tab:: Windows
.. pip-command-usage:: cache "py -m pip"
Description
***********
.. pip-command-description:: cache
Options
*******
.. pip-command-options:: cache

View File

@ -0,0 +1,87 @@
.. _`pip check`:
=========
pip check
=========
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: check "python -m pip"
.. tab:: Windows
.. pip-command-usage:: check "py -m pip"
Description
===========
.. pip-command-description:: check
Examples
========
#. If all dependencies are compatible:
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip check
No broken requirements found.
$ echo $?
0
.. tab:: Windows
.. code-block:: console
C:\> py -m pip check
No broken requirements found.
C:\> echo %errorlevel%
0
#. If a package is missing:
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip check
pyramid 1.5.2 requires WebOb, which is not installed.
$ echo $?
1
.. tab:: Windows
.. code-block:: console
C:\> py -m pip check
pyramid 1.5.2 requires WebOb, which is not installed.
C:\> echo %errorlevel%
1
#. If a package has the wrong version:
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip check
pyramid 1.5.2 has requirement WebOb>=1.3.1, but you have WebOb 0.8.
$ echo $?
1
.. tab:: Windows
.. code-block:: console
C:\> py -m pip check
pyramid 1.5.2 has requirement WebOb>=1.3.1, but you have WebOb 0.8.
C:\> echo %errorlevel%
1

View File

@ -0,0 +1,30 @@
.. _`pip config`:
==========
pip config
==========
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: config "python -m pip"
.. tab:: Windows
.. pip-command-usage:: config "py -m pip"
Description
===========
.. pip-command-description:: config
Options
=======
.. pip-command-options:: config

View File

@ -0,0 +1,35 @@
.. _`pip debug`:
=========
pip debug
=========
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: debug "python -m pip"
.. tab:: Windows
.. pip-command-usage:: debug "py -m pip"
.. warning::
This command is only meant for debugging.
Its options and outputs are provisional and may change without notice.
Description
===========
.. pip-command-description:: debug
Options
=======
.. pip-command-options:: debug

View File

@ -0,0 +1,226 @@
.. _`pip download`:
============
pip download
============
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: download "python -m pip"
.. tab:: Windows
.. pip-command-usage:: download "py -m pip"
Description
===========
.. pip-command-description:: download
Overview
--------
``pip download`` does the same resolution and downloading as ``pip install``,
but instead of installing the dependencies, it collects the downloaded
distributions into the directory provided (defaulting to the current
directory). This directory can later be passed as the value to ``pip install
--find-links`` to facilitate offline or locked down package installation.
``pip download`` with the ``--platform``, ``--python-version``,
``--implementation``, and ``--abi`` options provides the ability to fetch
dependencies for an interpreter and system other than the ones that pip is
running on. ``--only-binary=:all:`` or ``--no-deps`` is required when using any
of these options. It is important to note that these options all default to the
current system/interpreter, and not to the most restrictive constraints (e.g.
platform any, abi none, etc). To avoid fetching dependencies that happen to
match the constraint of the current interpreter (but not your target one), it
is recommended to specify all of these options if you are specifying one of
them. Generic dependencies (e.g. universal wheels, or dependencies with no
platform, abi, or implementation constraints) will still match an over-
constrained download requirement.
Options
=======
.. pip-command-options:: download
.. pip-index-options:: download
Examples
========
#. Download a package and all of its dependencies
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip download SomePackage
python -m pip download -d . SomePackage # equivalent to above
python -m pip download --no-index --find-links=/tmp/wheelhouse -d /tmp/otherwheelhouse SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip download SomePackage
py -m pip download -d . SomePackage # equivalent to above
py -m pip download --no-index --find-links=/tmp/wheelhouse -d /tmp/otherwheelhouse SomePackage
#. Download a package and all of its dependencies with OSX specific interpreter constraints.
This forces OSX 10.10 or lower compatibility. Since OSX deps are forward compatible,
this will also match ``macosx-10_9_x86_64``, ``macosx-10_8_x86_64``, ``macosx-10_8_intel``,
etc.
It will also match deps with platform ``any``. Also force the interpreter version to ``27``
(or more generic, i.e. ``2``) and implementation to ``cp`` (or more generic, i.e. ``py``).
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip download \
--only-binary=:all: \
--platform macosx-10_10_x86_64 \
--python-version 27 \
--implementation cp \
SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip download ^
--only-binary=:all: ^
--platform macosx-10_10_x86_64 ^
--python-version 27 ^
--implementation cp ^
SomePackage
#. Download a package and its dependencies with linux specific constraints.
Force the interpreter to be any minor version of py3k, and only accept
``cp34m`` or ``none`` as the abi.
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip download \
--only-binary=:all: \
--platform linux_x86_64 \
--python-version 3 \
--implementation cp \
--abi cp34m \
SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip download ^
--only-binary=:all: ^
--platform linux_x86_64 ^
--python-version 3 ^
--implementation cp ^
--abi cp34m ^
SomePackage
#. Force platform, implementation, and abi agnostic deps.
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip download \
--only-binary=:all: \
--platform any \
--python-version 3 \
--implementation py \
--abi none \
SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip download ^
--only-binary=:all: ^
--platform any ^
--python-version 3 ^
--implementation py ^
--abi none ^
SomePackage
#. Even when overconstrained, this will still correctly fetch the pip universal wheel.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip download \
--only-binary=:all: \
--platform linux_x86_64 \
--python-version 33 \
--implementation cp \
--abi cp34m \
pip>=8
.. code-block:: console
$ ls pip-8.1.1-py2.py3-none-any.whl
pip-8.1.1-py2.py3-none-any.whl
.. tab:: Windows
.. code-block:: console
C:\> py -m pip download ^
--only-binary=:all: ^
--platform linux_x86_64 ^
--python-version 33 ^
--implementation cp ^
--abi cp34m ^
pip>=8
.. code-block:: console
C:\> dir pip-8.1.1-py2.py3-none-any.whl
pip-8.1.1-py2.py3-none-any.whl
#. Download a package supporting one of several ABIs and platforms.
This is useful when fetching wheels for a well-defined interpreter, whose
supported ABIs and platforms are known and fixed, different than the one pip is
running under.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip download \
--only-binary=:all: \
--platform manylinux1_x86_64 --platform linux_x86_64 --platform any \
--python-version 36 \
--implementation cp \
--abi cp36m --abi cp36 --abi abi3 --abi none \
SomePackage
.. tab:: Windows
.. code-block:: console
C:> py -m pip download ^
--only-binary=:all: ^
--platform manylinux1_x86_64 --platform linux_x86_64 --platform any ^
--python-version 36 ^
--implementation cp ^
--abi cp36m --abi cp36 --abi abi3 --abi none ^
SomePackage

View File

@ -0,0 +1,92 @@
.. _`pip freeze`:
==========
pip freeze
==========
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: freeze "python -m pip"
.. tab:: Windows
.. pip-command-usage:: freeze "py -m pip"
Description
===========
.. pip-command-description:: freeze
Options
=======
.. pip-command-options:: freeze
Examples
========
#. Generate output suitable for a requirements file.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip freeze
docutils==0.11
Jinja2==2.7.2
MarkupSafe==0.19
Pygments==1.6
Sphinx==1.2.2
.. tab:: Windows
.. code-block:: console
C:\> py -m pip freeze
docutils==0.11
Jinja2==2.7.2
MarkupSafe==0.19
Pygments==1.6
Sphinx==1.2.2
#. Generate a requirements file and then install from it in another environment.
.. tab:: Unix/macOS
.. code-block:: shell
env1/bin/python -m pip freeze > requirements.txt
env2/bin/python -m pip install -r requirements.txt
.. tab:: Windows
.. code-block:: shell
env1\bin\python -m pip freeze > requirements.txt
env2\bin\python -m pip install -r requirements.txt
Fixing "Permission denied:" errors
==================================
The purpose of this section of documentation is to provide practical
suggestions to users seeing a `"Permission denied" error <https://github.com/pypa/pip/issues/8418>`__ on ``pip freeze``.
This error occurs, for instance, when the command is installed only for another
user, and the current user doesn't have the permission to execute the other
user's command.
To solve that issue, you can try one of the followings:
- Install the command for yourself (e.g. in your home directory).
- Ask the system admin to allow this command for all users.
- Check and correct the PATH variable of your own environment.
- Check the `ACL (Access-Control List) <https://en.wikipedia.org/wiki/Access-control_list>`_ for this command.

View File

@ -0,0 +1,72 @@
.. _`pip hash`:
========
pip hash
========
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: hash "python -m pip"
.. tab:: Windows
.. pip-command-usage:: hash "py -m pip"
Description
===========
.. pip-command-description:: hash
Overview
--------
``pip hash`` is a convenient way to get a hash digest for use with
:ref:`hash-checking mode`, especially for packages with multiple archives. The
error message from ``pip install --require-hashes ...`` will give you one
hash, but, if there are multiple archives (like source and binary ones), you
will need to manually download and compute a hash for the others. Otherwise, a
spurious hash mismatch could occur when :ref:`pip install` is passed a
different set of options, like :ref:`--no-binary <install_--no-binary>`.
Options
=======
.. pip-command-options:: hash
Example
=======
Compute the hash of a downloaded archive:
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip download SomePackage
Collecting SomePackage
Downloading SomePackage-2.2.tar.gz
Saved ./pip_downloads/SomePackage-2.2.tar.gz
Successfully downloaded SomePackage
$ python -m pip hash ./pip_downloads/SomePackage-2.2.tar.gz
./pip_downloads/SomePackage-2.2.tar.gz:
--hash=sha256:93e62e05c7ad3da1a233def6731e8285156701e3419a5fe279017c429ec67ce0
.. tab:: Windows
.. code-block:: console
C:\> py -m pip download SomePackage
Collecting SomePackage
Downloading SomePackage-2.2.tar.gz
Saved ./pip_downloads/SomePackage-2.2.tar.gz
Successfully downloaded SomePackage
C:\> py -m pip hash ./pip_downloads/SomePackage-2.2.tar.gz
./pip_downloads/SomePackage-2.2.tar.gz:
--hash=sha256:93e62e05c7ad3da1a233def6731e8285156701e3419a5fe279017c429ec67ce0

File diff suppressed because it is too large Load Diff

201
docs/html/cli/pip_list.rst Normal file
View File

@ -0,0 +1,201 @@
.. _`pip list`:
========
pip list
========
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: list "python -m pip"
.. tab:: Windows
.. pip-command-usage:: list "py -m pip"
Description
===========
.. pip-command-description:: list
Options
=======
.. pip-command-options:: list
.. pip-index-options:: list
Examples
========
#. List installed packages.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list
docutils (0.10)
Jinja2 (2.7.2)
MarkupSafe (0.18)
Pygments (1.6)
Sphinx (1.2.1)
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list
docutils (0.10)
Jinja2 (2.7.2)
MarkupSafe (0.18)
Pygments (1.6)
Sphinx (1.2.1)
#. List outdated packages (excluding editables), and the latest version available.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --outdated
docutils (Current: 0.10 Latest: 0.11)
Sphinx (Current: 1.2.1 Latest: 1.2.2)
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --outdated
docutils (Current: 0.10 Latest: 0.11)
Sphinx (Current: 1.2.1 Latest: 1.2.2)
#. List installed packages with column formatting.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --format columns
Package Version
------- -------
docopt 0.6.2
idlex 1.13
jedi 0.9.0
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --format columns
Package Version
------- -------
docopt 0.6.2
idlex 1.13
jedi 0.9.0
#. List outdated packages with column formatting.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list -o --format columns
Package Version Latest Type
---------- ------- ------ -----
retry 0.8.1 0.9.1 wheel
setuptools 20.6.7 21.0.0 wheel
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list -o --format columns
Package Version Latest Type
---------- ------- ------ -----
retry 0.8.1 0.9.1 wheel
setuptools 20.6.7 21.0.0 wheel
#. List packages that are not dependencies of other packages. Can be combined with
other options.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --outdated --not-required
docutils (Current: 0.10 Latest: 0.11)
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --outdated --not-required
docutils (Current: 0.10 Latest: 0.11)
#. Use legacy formatting
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --format=legacy
colorama (0.3.7)
docopt (0.6.2)
idlex (1.13)
jedi (0.9.0)
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --format=legacy
colorama (0.3.7)
docopt (0.6.2)
idlex (1.13)
jedi (0.9.0)
#. Use json formatting
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --format=json
[{'name': 'colorama', 'version': '0.3.7'}, {'name': 'docopt', 'version': '0.6.2'}, ...
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --format=json
[{'name': 'colorama', 'version': '0.3.7'}, {'name': 'docopt', 'version': '0.6.2'}, ...
#. Use freeze formatting
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --format=freeze
colorama==0.3.7
docopt==0.6.2
idlex==1.13
jedi==0.9.0
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --format=freeze
colorama==0.3.7
docopt==0.6.2
idlex==1.13
jedi==0.9.0

View File

@ -0,0 +1,52 @@
.. _`pip search`:
==========
pip search
==========
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: search "python -m pip"
.. tab:: Windows
.. pip-command-usage:: search "py -m pip"
Description
===========
.. pip-command-description:: search
Options
=======
.. pip-command-options:: search
Examples
========
#. Search for "peppercorn"
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip search peppercorn
pepperedform - Helpers for using peppercorn with formprocess.
peppercorn - A library for converting a token stream into [...]
.. tab:: Windows
.. code-block:: console
C:\> py -m pip search peppercorn
pepperedform - Helpers for using peppercorn with formprocess.
peppercorn - A library for converting a token stream into [...]

154
docs/html/cli/pip_show.rst Normal file
View File

@ -0,0 +1,154 @@
.. _`pip show`:
========
pip show
========
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: show "python -m pip"
.. tab:: Windows
.. pip-command-usage:: show "py -m pip"
Description
===========
.. pip-command-description:: show
Options
=======
.. pip-command-options:: show
Examples
========
#. Show information about a package:
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip show sphinx
Name: Sphinx
Version: 1.4.5
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
Author-email: georg@python.org
License: BSD
Location: /my/env/lib/python2.7/site-packages
Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
.. tab:: Windows
.. code-block:: console
C:\> py -m pip show sphinx
Name: Sphinx
Version: 1.4.5
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
Author-email: georg@python.org
License: BSD
Location: /my/env/lib/python2.7/site-packages
Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
#. Show all information about a package
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip show --verbose sphinx
Name: Sphinx
Version: 1.4.5
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
Author-email: georg@python.org
License: BSD
Location: /my/env/lib/python2.7/site-packages
Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
Metadata-Version: 2.0
Installer:
Classifiers:
Development Status :: 5 - Production/Stable
Environment :: Console
Environment :: Web Environment
Intended Audience :: Developers
Intended Audience :: Education
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Framework :: Sphinx
Framework :: Sphinx :: Extension
Framework :: Sphinx :: Theme
Topic :: Documentation
Topic :: Documentation :: Sphinx
Topic :: Text Processing
Topic :: Utilities
Entry-points:
[console_scripts]
sphinx-apidoc = sphinx.apidoc:main
sphinx-autogen = sphinx.ext.autosummary.generate:main
sphinx-build = sphinx:main
sphinx-quickstart = sphinx.quickstart:main
[distutils.commands]
build_sphinx = sphinx.setup_command:BuildDoc
.. tab:: Windows
.. code-block:: console
C:\> py -m pip show --verbose sphinx
Name: Sphinx
Version: 1.4.5
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
Author-email: georg@python.org
License: BSD
Location: /my/env/lib/python2.7/site-packages
Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
Metadata-Version: 2.0
Installer:
Classifiers:
Development Status :: 5 - Production/Stable
Environment :: Console
Environment :: Web Environment
Intended Audience :: Developers
Intended Audience :: Education
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Framework :: Sphinx
Framework :: Sphinx :: Extension
Framework :: Sphinx :: Theme
Topic :: Documentation
Topic :: Documentation :: Sphinx
Topic :: Text Processing
Topic :: Utilities
Entry-points:
[console_scripts]
sphinx-apidoc = sphinx.apidoc:main
sphinx-autogen = sphinx.ext.autosummary.generate:main
sphinx-build = sphinx:main
sphinx-quickstart = sphinx.quickstart:main
[distutils.commands]
build_sphinx = sphinx.setup_command:BuildDoc

View File

@ -0,0 +1,58 @@
.. _`pip uninstall`:
=============
pip uninstall
=============
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: uninstall "python -m pip"
.. tab:: Windows
.. pip-command-usage:: uninstall "py -m pip"
Description
===========
.. pip-command-description:: uninstall
Options
=======
.. pip-command-options:: uninstall
Examples
========
#. Uninstall a package.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip uninstall simplejson
Uninstalling simplejson:
/home/me/env/lib/python3.9/site-packages/simplejson
/home/me/env/lib/python3.9/site-packages/simplejson-2.2.1-py3.9.egg-info
Proceed (y/n)? y
Successfully uninstalled simplejson
.. tab:: Windows
.. code-block:: console
C:\> py -m pip uninstall simplejson
Uninstalling simplejson:
/home/me/env/lib/python3.9/site-packages/simplejson
/home/me/env/lib/python3.9/site-packages/simplejson-2.2.1-py3.9.egg-info
Proceed (y/n)? y
Successfully uninstalled simplejson

125
docs/html/cli/pip_wheel.rst Normal file
View File

@ -0,0 +1,125 @@
.. _`pip wheel`:
=========
pip wheel
=========
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: wheel "python -m pip"
.. tab:: Windows
.. pip-command-usage:: wheel "py -m pip"
Description
===========
.. pip-command-description:: wheel
Build System Interface
----------------------
In order for pip to build a wheel, ``setup.py`` must implement the
``bdist_wheel`` command with the following syntax:
.. tab:: Unix/macOS
.. code-block:: shell
python setup.py bdist_wheel -d TARGET
.. tab:: Windows
.. code-block:: shell
py setup.py bdist_wheel -d TARGET
This command must create a wheel compatible with the invoking Python
interpreter, and save that wheel in the directory TARGET.
No other build system commands are invoked by the ``pip wheel`` command.
Customising the build
^^^^^^^^^^^^^^^^^^^^^
It is possible using ``--global-option`` to include additional build commands
with their arguments in the ``setup.py`` command. This is currently the only
way to influence the building of C extensions from the command line. For
example:
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip wheel --global-option bdist_ext --global-option -DFOO wheel
.. tab:: Windows
.. code-block:: shell
py -m pip wheel --global-option bdist_ext --global-option -DFOO wheel
will result in a build command of
::
setup.py bdist_ext -DFOO bdist_wheel -d TARGET
which passes a preprocessor symbol to the extension build.
Such usage is considered highly build-system specific and more an accident of
the current implementation than a supported interface.
Options
=======
.. pip-command-options:: wheel
.. pip-index-options:: wheel
Examples
========
#. Build wheels for a requirement (and all its dependencies), and then install
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip wheel --wheel-dir=/tmp/wheelhouse SomePackage
python -m pip install --no-index --find-links=/tmp/wheelhouse SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip wheel --wheel-dir=/tmp/wheelhouse SomePackage
py -m pip install --no-index --find-links=/tmp/wheelhouse SomePackage
#. Build a wheel for a package from source
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip wheel --no-binary SomePackage SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip wheel --no-binary SomePackage SomePackage

View File

@ -1,325 +1,128 @@
# pip documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 22 22:08:49 2008
#
# This file is execfile()d with the current directory set to its containing dir
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
"""Sphinx configuration file for pip's documentation."""
import glob
import os
import pathlib
import re
import sys
from typing import List, Tuple
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# Add the docs/ directory to sys.path, because pip_sphinxext.py is there.
docs_dir = os.path.dirname(os.path.dirname(__file__))
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, docs_dir)
# sys.path.append(os.path.join(os.path.dirname(__file__), '../'))
# -- General configuration ----------------------------------------------------
# -- General configuration ------------------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
# extensions = ['sphinx.ext.autodoc']
extensions = [
# native:
'sphinx.ext.extlinks',
'sphinx.ext.intersphinx',
# third-party:
'sphinx_inline_tabs',
'sphinxcontrib.towncrier',
# in-tree:
'docs_feedback_sphinxext',
'pip_sphinxext',
# first-party extensions
"sphinx.ext.autodoc",
"sphinx.ext.todo",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
# our extensions
"pip_sphinxext",
# third-party extensions
"myst_parser",
"sphinx_copybutton",
"sphinx_inline_tabs",
"sphinxcontrib.towncrier",
]
# intersphinx
intersphinx_cache_limit = 0
intersphinx_mapping = {
'pypug': ('https://packaging.python.org/', None),
'pypa': ('https://www.pypa.io/en/latest/', None),
}
# Add any paths that contain templates here, relative to this directory.
templates_path = []
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
# source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'pip'
copyright = '2008-2020, PyPA'
project = "pip"
copyright = "2008-2020, PyPA"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = release = 'dev'
# Readthedocs seems to install pip as an egg (via setup.py install) which
# is somehow resulting in "import pip" picking up an older copy of pip.
# Rather than trying to force RTD to install pip properly, we'll simply
# read the version direct from the __init__.py file. (Yes, this is
# fragile, but it works...)
pip_init = os.path.join(docs_dir, '..', 'src', 'pip', '__init__.py')
with open(pip_init) as f:
# Find the version and release information.
# We have a single source of truth for our version number: pip's __init__.py file.
# This next bit of code reads from it.
file_with_version = os.path.join(docs_dir, "..", "src", "pip", "__init__.py")
with open(file_with_version) as f:
for line in f:
m = re.match(r'__version__ = "(.*)"', line)
if m:
__version__ = m.group(1)
# The short X.Y version.
version = '.'.join(__version__.split('.')[:2])
version = ".".join(__version__.split(".")[:2])
# The full version, including alpha/beta/rc tags.
release = __version__
break
else: # AKA no-break
version = release = "dev"
# We have this here because readthedocs plays tricks sometimes and there seems
# to be a heisenbug, related to the version of pip discovered. This is here to
# help debug that if someone decides to do that in the future.
print("pip version:", version)
print("pip release:", release)
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# language = None
# -- Options for smartquotes ----------------------------------------------------------
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
# unused_docs = []
# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_patterns = ['build/']
# The reST default role (used for this markup: `text`) to use for all documents
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
# show_authors = False
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
extlinks = {
'issue': ('https://github.com/pypa/pip/issues/%s', '#'),
'pull': ('https://github.com/pypa/pip/pull/%s', 'PR #'),
'pypi': ('https://pypi.org/project/%s/', ''),
}
# Turn off sphinx build warnings because of sphinx tabs during man pages build
sphinx_tabs_nowarn = True
# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = "furo"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = f"{project} documentation v{release}"
# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
# html_logo = '_static/piplogo.png'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = 'favicon.png'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%b %d, %Y'
# If true, the Docutils Smart Quotes transform (originally based on
# SmartyPants) will be used to convert characters like quotes and dashes
# to typographically correct entities. The default is True.
smartquotes = True
# This string, for use with Docutils 0.14 or later, customizes the
# SmartQuotes transform. The default of "qDe" converts normal quote
# characters ('"' and "'"), en and em dashes ("--" and "---"), and
# ellipses "...".
# For now, we disable the conversion of dashes so that long options
# like "--find-links" won't render as "-find-links" if included in the
# text in places where monospaced type can't be used. For example, backticks
# can't be used inside roles like :ref:`--no-index <--no-index>` because
# of nesting.
# Disable the conversion of dashes so that long options like "--find-links" won't
# render as "-find-links" if included in the text.The default of "qDe" converts normal
# quote characters ('"' and "'"), en and em dashes ("--" and "---"), and ellipses "..."
smartquotes_action = "qe"
# Custom sidebar templates, maps document names to template names.
html_sidebars = {}
# -- Options for intersphinx ----------------------------------------------------------
# Additional templates that should be rendered to pages, maps page names to
# template names.
# html_additional_pages = {}
# If false, no module index is generated.
html_use_modindex = False
# If false, no index is generated.
html_use_index = False
# If true, the index is split into individual pages for each letter.
# html_split_index = False
# If true, links to the reST sources are added to the pages.
html_show_sourcelink = False
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
# html_use_opensearch = ''
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = ''
# Output file base name for HTML help builder.
htmlhelp_basename = 'pipdocs'
# -- Options for LaTeX output -------------------------------------------------
# The paper size ('letter' or 'a4').
# latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
# latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual])
latex_documents = [
(
'index',
'pip.tex',
'pip Documentation',
'pip developers',
'manual',
),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
# latex_use_parts = False
# Additional stuff for the LaTeX preamble.
# latex_preamble = ''
# Documents to append as an appendix to all manuals.
# latex_appendices = []
# If false, no module index is generated.
# latex_use_modindex = True
# -- Options for Manual Pages -------------------------------------------------
# List of manual pages generated
man_pages = [
(
'index',
'pip',
'package manager for Python packages',
'pip developers',
1
)
]
def to_document_name(path, base_dir):
"""Convert a provided path to a Sphinx "document name".
"""
relative_path = os.path.relpath(path, base_dir)
root, _ = os.path.splitext(relative_path)
return root.replace(os.sep, '/')
# Here, we crawl the entire man/commands/ directory and list every file with
# appropriate name and details
man_dir = os.path.join(docs_dir, 'man')
raw_subcommands = glob.glob(os.path.join(man_dir, 'commands/*.rst'))
if not raw_subcommands:
raise FileNotFoundError(
'The individual subcommand manpages could not be found!'
)
for fname in raw_subcommands:
fname_base = to_document_name(fname, man_dir)
outname = 'pip-' + fname_base.split('/')[1]
description = 'description of {} command'.format(
outname.replace('-', ' ')
)
man_pages.append((fname_base, outname, description, 'pip developers', 1))
# -- Options for docs_feedback_sphinxext --------------------------------------
# NOTE: Must be one of 'attention', 'caution', 'danger', 'error', 'hint',
# NOTE: 'important', 'note', 'tip', 'warning' or 'admonition'.
docs_feedback_admonition_type = 'important'
docs_feedback_big_doc_lines = 50 # bigger docs will have a banner on top
docs_feedback_email = 'Docs UX Team <docs-feedback@pypa.io>'
docs_feedback_excluded_documents = { # these won't have any banners
'news', 'reference/index',
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"pypug": ("https://packaging.python.org", None),
}
docs_feedback_questions_list = (
'What problem were you trying to solve when you came to this page?',
'What content was useful?',
'What content was not useful?',
)
# -- Options for towncrier_draft extension -----------------------------------
# -- Options for extlinks -------------------------------------------------------------
towncrier_draft_autoversion_mode = 'draft' # or: 'sphinx-release', 'sphinx-version'
towncrier_draft_include_empty = False
extlinks = {
"issue": ("https://github.com/pypa/pip/issues/%s", "#"),
"pull": ("https://github.com/pypa/pip/pull/%s", "PR #"),
"pypi": ("https://pypi.org/project/%s/", ""),
}
# -- Options for towncrier_draft extension --------------------------------------------
towncrier_draft_autoversion_mode = "draft" # or: 'sphinx-release', 'sphinx-version'
towncrier_draft_include_empty = True
towncrier_draft_working_directory = pathlib.Path(docs_dir).parent
# Not yet supported: towncrier_draft_config_path = 'pyproject.toml' # relative to cwd
# -- Options for HTML -----------------------------------------------------------------
html_theme = "furo"
html_title = f"{project} documentation v{release}"
# Disable the generation of the various indexes
html_use_modindex = False
html_use_index = False
# -- Options for Manual Pages ---------------------------------------------------------
# List of manual pages generated
def determine_man_pages() -> List[Tuple[str, str, str, str, int]]:
"""Determine which man pages need to be generated."""
def to_document_name(path: str, base_dir: str) -> str:
"""Convert a provided path to a Sphinx "document name"."""
relative_path = os.path.relpath(path, base_dir)
root, _ = os.path.splitext(relative_path)
return root.replace(os.sep, "/")
# Crawl the entire man/commands/ directory and list every file with appropriate
# name and details.
man_dir = os.path.join(docs_dir, "man")
raw_subcommands = glob.glob(os.path.join(man_dir, "commands/*.rst"))
if not raw_subcommands:
raise FileNotFoundError(
"The individual subcommand manpages could not be found!"
)
retval = [
("index", "pip", "package manager for Python packages", "pip developers", 1),
]
for fname in raw_subcommands:
fname_base = to_document_name(fname, man_dir)
outname = "pip-" + fname_base.split("/")[1]
description = "description of {} command".format(outname.replace("-", " "))
retval.append((fname_base, outname, description, "pip developers", 1))
return retval
man_pages = determine_man_pages()

View File

@ -6,4 +6,4 @@ Copyright
pip and this documentation is:
Copyright © 2008-2020 The pip developers (see `AUTHORS.txt <https://github.com/pypa/pip/blob/master/AUTHORS.txt>`_ file). All rights reserved.
Copyright © 2008-2020 The pip developers (see `AUTHORS.txt <https://github.com/pypa/pip/blob/main/AUTHORS.txt>`_ file). All rights reserved.

View File

@ -51,7 +51,6 @@ The ``README``, license, ``pyproject.toml``, ``setup.py``, and so on are in the
* ``functional/`` *[functional tests of pips CLI -- end-to-end, invoke pip in subprocess & check results of execution against desired result. This also is what makes test suite slow]*
* ``lib/`` *[helpers for tests]*
* ``unit/`` *[unit tests -- fast and small and nice!]*
* ``yaml/`` *[resolver tests! Theyre written in YAML. This folder just contains .yaml files -- actual code for reading/running them is in lib/yaml.py . This is fine!]*
* ``tools`` *[misc development workflow tools, like requirements files & Travis CI files & helpers for tox]*
* ``.azure-pipelines``
@ -105,5 +104,5 @@ Within ``src/``:
.. _`tracking issue`: https://github.com/pypa/pip/issues/6831
.. _GitHub repository: https://github.com/pypa/pip/
.. _tox.ini: https://github.com/pypa/pip/blob/master/tox.ini
.. _tox.ini: https://github.com/pypa/pip/blob/main/tox.ini
.. _improving the pip dependency resolver: https://github.com/pypa/pip/issues/988

View File

@ -30,7 +30,8 @@ candidate.
``--upgrade-strategy``
This option affects which packages are allowed to be installed. It is only
relevant if ``--upgrade`` is specified. The base behaviour is to allow
relevant if ``--upgrade`` is specified (except for the ``to-satisfy-only``
option mentioned below). The base behaviour is to allow
packages specified on pip's command line to be upgraded. This option controls
what *other* packages can be upgraded:
@ -43,9 +44,15 @@ what *other* packages can be upgraded:
pip command or a requirement file (i.e, they are direct requirements), or
an upgraded parent needs a later version of the dependency than is
currently installed.
* ``to-satisfy-only`` (**undocumented**) - packages are not upgraded (not
even direct requirements) unless the currently installed version fails to
satisfy a requirement (either explicitly specified or a dependency).
* ``to-satisfy-only`` (**undocumented, please avoid**) - packages are not
upgraded (not even direct requirements) unless the currently installed
version fails to satisfy a requirement (either explicitly specified or a
dependency).
* This is actually the "default" upgrade strategy when ``--upgrade`` is
*not set*, i.e. ``pip install AlreadyInstalled`` and
``pip install --upgrade --upgrade-strategy=to-satisfy-only AlreadyInstalled``
yield the same behavior.
``--force-reinstall``

View File

@ -1,7 +1,8 @@
.. note::
This section of the documentation is currently being written. pip
developers welcome your help to complete this documentation. If
This section of the documentation is currently out of date.
pip developers welcome your help to update this documentation. If
you're interested in helping out, please let us know in the
`tracking issue`_, or just submit a pull request and mention it in
that tracking issue.
@ -133,11 +134,11 @@ Actual testing
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
| MacOS +----------+-------+---------------+-----------------+
| | | CP3.6 | Azure | Azure |
| | | CP3.6 | Github | Github |
| | +-------+---------------+-----------------+
| | x64 | CP3.7 | Azure | Azure |
| | x64 | CP3.7 | Github | Github |
| | +-------+---------------+-----------------+
| | | CP3.8 | Azure | Azure |
| | | CP3.8 | Github | Github |
| | +-------+---------------+-----------------+
| | | PyPy3 | | |
+-----------+----------+-------+---------------+-----------------+

View File

@ -11,7 +11,7 @@ We have an in-progress guide to the
Submitting Pull Requests
========================
Submit pull requests against the ``master`` branch, providing a good
Submit pull requests against the ``main`` branch, providing a good
description of what you're doing and why. You must have legal permission to
distribute any code you contribute to pip and it must be available under the
MIT License.
@ -39,7 +39,7 @@ separately, as a "formatting cleanup" PR, if needed.
Automated Testing
=================
All pull requests and merges to 'master' branch are tested using `Travis CI`_,
All pull requests and merges to 'main' branch are tested using `Travis CI`_,
`Azure Pipelines`_ and `GitHub Actions`_ based on our `.travis.yml`_,
`.azure-pipelines`_ and `.github/workflows`_ files. More details about pip's
Continuous Integration can be found in the `CI Documentation`_
@ -131,8 +131,8 @@ updating deprecation policy, etc.
Updating your branch
====================
As you work, you might need to update your local master branch up-to-date with
the ``master`` branch in the main pip repository, which moves forward as the
As you work, you might need to update your local main branch up-to-date with
the ``main`` branch in the main pip repository, which moves forward as the
maintainers merge pull requests. Most people working on the project use the
following workflow.
@ -160,24 +160,24 @@ First, fetch the latest changes from the main pip repository, ``upstream``:
git fetch upstream
Then, check out your local ``master`` branch, and rebase the changes on top of
Then, check out your local ``main`` branch, and rebase the changes on top of
it:
.. code-block:: console
git checkout master
git rebase upstream/master
git checkout main
git rebase upstream/main
At this point, you might have to `resolve merge conflicts`_. Once this is done,
push the updates you have just made to your local ``master`` branch to your
push the updates you have just made to your local ``main`` branch to your
``origin`` repository on GitHub:
.. code-block:: console
git checkout master
git push origin master
git checkout main
git push origin main
Now your local ``master`` branch and the ``master`` branch in your ``origin``
Now your local ``main`` branch and the ``main`` branch in your ``origin``
repo have been updated with the most recent changes from the main pip
repository.
@ -187,10 +187,10 @@ To keep your branches updated, the process is similar:
git checkout awesome-feature
git fetch upstream
git rebase upstream/master
git rebase upstream/main
Now your branch has been updated with the latest changes from the
``master`` branch on the upstream pip repository.
``main`` branch on the upstream pip repository.
It's good practice to back up your branches by pushing them to your
``origin`` on GitHub as you are working on them. To push a branch,
@ -230,7 +230,7 @@ If you get an error message like this:
Try force-pushing your branch with ``push -f``.
The ``master`` branch in the main pip repository gets updated frequently, so
The ``main`` branch in the main pip repository gets updated frequently, so
you might have to update your branch at least once while you are working on it.
Thank you for your contribution!
@ -267,9 +267,9 @@ will initiate a vote among the existing maintainers.
.. _`Travis CI`: https://travis-ci.org/
.. _`Azure Pipelines`: https://azure.microsoft.com/en-in/services/devops/pipelines/
.. _`GitHub Actions`: https://github.com/features/actions
.. _`.travis.yml`: https://github.com/pypa/pip/blob/master/.travis.yml
.. _`.azure-pipelines`: https://github.com/pypa/pip/blob/master/.azure-pipelines
.. _`.github/workflows`: https://github.com/pypa/pip/blob/master/.github/workflows
.. _`.travis.yml`: https://github.com/pypa/pip/blob/main/.travis.yml
.. _`.azure-pipelines`: https://github.com/pypa/pip/blob/main/.azure-pipelines
.. _`.github/workflows`: https://github.com/pypa/pip/blob/main/.github/workflows
.. _`CI Documentation`: https://pip.pypa.io/en/latest/development/ci/
.. _`towncrier`: https://pypi.org/project/towncrier/
.. _`Testing the next-gen pip dependency resolver`: https://pradyunsg.me/blog/2020/03/27/pip-resolver-testing/

View File

@ -229,7 +229,7 @@ Examples:
(`link <https://github.com/pypa/pip/issues/6498#issuecomment-513501112>`__)
- get-pip on system with no ``/usr/lib64``
(`link <https://github.com/pypa/pip/issues/5379#issuecomment-515270576>`__)
- reproducing with ``pip`` from master branch
- reproducing with ``pip`` from current development branch
(`link <https://github.com/pypa/pip/issues/6707#issue-467770959>`__)
@ -285,7 +285,7 @@ An issue may be considered resolved and closed when:
- already tracked by another issue
- A project-specific issue has been identified and the issue no
longer occurs as of the latest commit on the master branch.
longer occurs as of the latest commit on the main branch.
- An enhancement or feature request no longer has a proponent and the maintainers
don't think it's worth keeping open.

View File

@ -7,7 +7,7 @@ Release process
Release Cadence
===============
The pip project has a release cadence of releasing whatever is on ``master``
The pip project has a release cadence of releasing whatever is on ``main``
every 3 months. This gives users a predictable pattern for when releases
are going to happen and prevents locking up improvements for fixes for long
periods of time, while still preventing massively fracturing the user base
@ -22,8 +22,8 @@ The release manager may, at their discretion, choose whether or not there
will be a pre-release period for a release, and if there is may extend that
period into the next month if needed.
Because releases are made direct from the ``master`` branch, it is essential
that ``master`` is always in a releasable state. It is acceptable to merge
Because releases are made direct from the ``main`` branch, it is essential
that ``main`` is always in a releasable state. It is acceptable to merge
PRs that partially implement a new feature, but only if the partially
implemented version is usable in that state (for example, with reduced
functionality or disabled by default). In the case where a merged PR is found
@ -116,13 +116,13 @@ Release Process
Creating a new release
----------------------
#. Checkout the current pip ``master`` branch.
#. Checkout the current pip ``main`` branch.
#. Ensure you have the latest ``nox`` installed.
#. Prepare for release using ``nox -s prepare-release -- YY.N``.
This will update the relevant files and tag the correct commit.
#. Build the release artifacts using ``nox -s build-release -- YY.N``.
This will checkout the tag, generate the distribution files to be
uploaded and checkout the master branch again.
uploaded and checkout the main branch again.
#. Upload the release to PyPI using ``nox -s upload-release -- YY.N``.
#. Push all of the changes including the tag.
#. Regenerate the ``get-pip.py`` script in the `get-pip repository`_ (as
@ -155,20 +155,20 @@ Creating a bug-fix release
Sometimes we need to release a bugfix release of the form ``YY.N.Z+1``. In
order to create one of these the changes should already be merged into the
``master`` branch.
``main`` branch.
#. Create a new ``release/YY.N.Z+1`` branch off of the ``YY.N`` tag using the
command ``git checkout -b release/YY.N.Z+1 YY.N``.
#. Cherry pick the fixed commits off of the ``master`` branch, fixing any
#. Cherry pick the fixed commits off of the ``main`` branch, fixing any
conflicts.
#. Run ``nox -s prepare-release -- YY.N.Z+1``.
#. Merge master into your release branch and drop the news files that have been
#. Merge main into your release branch and drop the news files that have been
included in your release (otherwise they would also appear in the ``YY.N+1``
changelog)
#. Push the ``release/YY.N.Z+1`` branch to github and submit a PR for it against
the ``master`` branch and wait for the tests to run.
#. Once tests run, merge the ``release/YY.N.Z+1`` branch into master, and follow
the above release process starting with step 4.
the ``main`` branch and wait for the tests to run.
#. Once tests run, merge the ``release/YY.N.Z+1`` branch into ``main``, and
follow the above release process starting with step 4.
.. _`get-pip repository`: https://github.com/pypa/get-pip
.. _`psf-salt repository`: https://github.com/python/psf-salt

48
docs/html/index.md Normal file
View File

@ -0,0 +1,48 @@
---
hide-toc: true
---
# pip
pip is the [package installer for Python][recommended]. You can use it to
install packages from the [Python Package Index][pypi] and other indexes.
```{toctree}
:hidden:
quickstart
installing
user_guide
cli/index
```
```{toctree}
:caption: Project
:hidden:
development/index
ux_research_design
news
Code of Conduct <https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md>
GitHub <https://github.com/pypa/pip>
```
If you want to learn about how to use pip, check out the following resources:
- [Quickstart](quickstart)
- [Python Packaging User Guide](https://packaging.python.org)
If you find bugs, need help, or want to talk to the developers, use our mailing
lists or chat rooms:
- [GitHub Issues][issue-tracker]
- [Discourse channel][packaging-discourse]
- [User IRC][irc-pypa]
- [Development IRC][irc-pypa-dev]
[recommended]: https://packaging.python.org/guides/tool-recommendations/
[pypi]: https://pypi.org/
[issue-tracker]: https://github.com/pypa/pip/issues/
[packaging-discourse]: https://discuss.python.org/c/packaging/14
[irc-pypa]: https://webchat.freenode.net/#pypa
[irc-pypa-dev]: https://webchat.freenode.net/#pypa-dev

View File

@ -1,63 +0,0 @@
==================================
pip - The Python Package Installer
==================================
pip is the `package installer`_ for Python. You can use pip to install packages from the `Python Package Index`_ and other indexes.
Please take a look at our documentation for how to install and use pip:
.. toctree::
:maxdepth: 1
quickstart
installing
user_guide
reference/index
development/index
ux_research_design
news
.. warning::
In pip 20.3, we've `made a big improvement to the heart of pip`_;
:ref:`Resolver changes 2020`. We want your input, so `sign up for
our user experience research studies`_ to help us do it right.
.. warning::
pip 21.0, in January 2021, removed Python 2 support, per pip's
:ref:`Python 2 Support` policy. Please migrate to Python 3.
If you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms:
* `Issue tracking`_
* `Discourse channel`_
* `User IRC`_
If you want to get involved, head over to GitHub to get the source code, and feel free to jump on the developer mailing lists and chat rooms:
* `GitHub page`_
* `Development mailing list`_
* `Development IRC`_
Code of Conduct
===============
Everyone interacting in the pip project's codebases, issue trackers, chat
rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.
.. _package installer: https://packaging.python.org/guides/tool-recommendations/
.. _Python Package Index: https://pypi.org
.. _made a big improvement to the heart of pip: https://pyfound.blogspot.com/2020/11/pip-20-3-new-resolver.html
.. _sign up for our user experience research studies: https://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html
.. _Installation: https://pip.pypa.io/en/stable/installing.html
.. _Documentation: https://pip.pypa.io/en/stable/
.. _Changelog: https://pip.pypa.io/en/stable/news.html
.. _GitHub page: https://github.com/pypa/pip
.. _Issue tracking: https://github.com/pypa/pip/issues
.. _Discourse channel: https://discuss.python.org/c/packaging
.. _Development mailing list: https://mail.python.org/mailman3/lists/distutils-sig.python.org/
.. _User IRC: https://webchat.freenode.net/?channels=%23pypa
.. _Development IRC: https://webchat.freenode.net/?channels=%23pypa-dev
.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md

View File

@ -9,4 +9,4 @@ Changelog
.. towncrier-draft-entries:: |release|, unreleased as on
.. include:: ../../NEWS.rst
.. pip-news-include:: ../../NEWS.rst

View File

@ -1,21 +1,11 @@
===============
Reference Guide
===============
:orphan:
.. toctree::
:maxdepth: 2
.. meta::
pip
pip_install
pip_download
pip_uninstall
pip_freeze
pip_list
pip_show
pip_search
pip_cache
pip_check
pip_config
pip_wheel
pip_hash
pip_debug
:http-equiv=refresh: 3; url=../cli/
This page has moved
===================
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/index`

View File

@ -1,255 +1,11 @@
===
pip
===
:orphan:
.. meta::
Usage
*****
:http-equiv=refresh: 3; url=../../cli/pip/
.. tab:: Unix/macOS
This page has moved
===================
.. code-block:: shell
python -m pip <command> [options]
.. tab:: Windows
.. code-block:: shell
py -m pip <command> [options]
Description
***********
.. _`Logging`:
Logging
=======
Console logging
~~~~~~~~~~~~~~~
pip offers :ref:`-v, --verbose <--verbose>` and :ref:`-q, --quiet <--quiet>`
to control the console log level. By default, some messages (error and warnings)
are colored in the terminal. If you want to suppress the colored output use
:ref:`--no-color <--no-color>`.
.. _`FileLogging`:
File logging
~~~~~~~~~~~~
pip offers the :ref:`--log <--log>` option for specifying a file where a maximum
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.
.. _`exists-action`:
--exists-action option
======================
This option specifies default behavior when path already exists.
Possible cases: downloading files or checking out repositories for installation,
creating archives. If ``--exists-action`` is not defined, pip will prompt
when decision is needed.
*(s)witch*
Only relevant to VCS checkout. Attempt to switch the checkout
to the appropriate URL and/or revision.
*(i)gnore*
Abort current operation (e.g. don't copy file, don't create archive,
don't modify a checkout).
*(w)ipe*
Delete the file or VCS checkout before trying to create, download, or checkout a new one.
*(b)ackup*
Rename the file or checkout to ``{name}{'.bak' * n}``, where n is some number
of ``.bak`` extensions, such that the file didn't exist at some point.
So the most recent backup will be the one with the largest number after ``.bak``.
*(a)abort*
Abort pip and return non-zero exit status.
.. _`build-interface`:
Build System Interface
======================
pip builds packages by invoking the build system. By default, builds will use
``setuptools``, but if a project specifies a different build system using a
``pyproject.toml`` file, as per :pep:`517`, pip will use that instead. As well
as package building, the build system is also invoked to install packages
direct from source. This is handled by invoking the build system to build a
wheel, and then installing from that wheel. The built wheel is cached locally
by pip to avoid repeated identical builds.
The current interface to the build system is via the ``setup.py`` command line
script - all build actions are defined in terms of the specific ``setup.py``
command line that will be run to invoke the required action.
Setuptools Injection
~~~~~~~~~~~~~~~~~~~~
When :pep:`517` is not used, the supported build system is ``setuptools``.
However, not all packages use ``setuptools`` in their build scripts. To support
projects that use "pure ``distutils``", pip injects ``setuptools`` into
``sys.modules`` before invoking ``setup.py``. The injection should be
transparent to ``distutils``-based projects, but 3rd party build tools wishing
to provide a ``setup.py`` emulating the commands pip requires may need to be
aware that it takes place.
Projects using :pep:`517` *must* explicitly use setuptools - pip does not do
the above injection process in this case.
Build System Output
~~~~~~~~~~~~~~~~~~~
Any output produced by the build system will be read by pip (for display to the
user if requested). In order to correctly read the build system output, pip
requires that the output is written in a well-defined encoding, specifically
the encoding the user has configured for text output (which can be obtained in
Python using ``locale.getpreferredencoding``). If the configured encoding is
ASCII, pip assumes UTF-8 (to account for the behaviour of some Unix systems).
Build systems should ensure that any tools they invoke (compilers, etc) produce
output in the correct encoding. In practice - and in particular on Windows,
where tools are inconsistent in their use of the "OEM" and "ANSI" codepages -
this may not always be possible. pip will therefore attempt to recover cleanly
if presented with incorrectly encoded build tool output, by translating
unexpected byte sequences to Python-style hexadecimal escape sequences
(``"\x80\xff"``, etc). However, it is still possible for output to be displayed
using an incorrect encoding (mojibake).
Under :pep:`517`, handling of build tool output is the backend's responsibility,
and pip simply displays the output produced by the backend. (Backends, however,
will likely still have to address the issues described above).
PEP 517 and 518 Support
~~~~~~~~~~~~~~~~~~~~~~~
As of version 10.0, pip supports projects declaring dependencies that are
required at install time using a ``pyproject.toml`` file, in the form described
in :pep:`518`. When building a project, pip will install the required
dependencies locally, and make them available to the build process.
Furthermore, from version 19.0 onwards, pip supports projects specifying the
build backend they use in ``pyproject.toml``, in the form described in
:pep:`517`.
When making build requirements available, pip does so in an *isolated
environment*. That is, pip does not install those requirements into the user's
``site-packages``, but rather installs them in a temporary directory which it
adds to the user's ``sys.path`` for the duration of the build. This ensures
that build requirements are handled independently of the user's runtime
environment. For example, a project that needs a recent version of setuptools
to build can still be installed, even if the user has an older version
installed (and without silently replacing that version).
In certain cases, projects (or redistributors) may have workflows that
explicitly manage the build environment. For such workflows, build isolation
can be problematic. If this is the case, pip provides a
``--no-build-isolation`` flag to disable build isolation. Users supplying this
flag are responsible for ensuring the build environment is managed
appropriately (including ensuring that all required build dependencies are
installed).
By default, pip will continue to use the legacy (direct ``setup.py`` execution
based) build processing for projects that do not have a ``pyproject.toml`` file.
Projects with a ``pyproject.toml`` file will use a :pep:`517` backend. Projects
with a ``pyproject.toml`` file, but which don't have a ``build-system`` section,
will be assumed to have the following backend settings::
[build-system]
requires = ["setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta:__legacy__"
.. note::
``setuptools`` 40.8.0 is the first version of setuptools that offers a
:pep:`517` backend that closely mimics directly executing ``setup.py``.
If a project has ``[build-system]``, but no ``build-backend``, pip will also use
``setuptools.build_meta:__legacy__``, but will expect the project requirements
to include ``setuptools`` and ``wheel`` (and will report an error if the
installed version of ``setuptools`` is not recent enough).
If a user wants to explicitly request :pep:`517` handling even though a project
doesn't have a ``pyproject.toml`` file, this can be done using the
``--use-pep517`` command line option. Similarly, to request legacy processing
even though ``pyproject.toml`` is present, the ``--no-use-pep517`` option is
available (although obviously it is an error to choose ``--no-use-pep517`` if
the project has no ``setup.py``, or explicitly requests a build backend). As
with other command line flags, pip recognises the ``PIP_USE_PEP517``
environment veriable and a ``use-pep517`` config file option (set to true or
false) to set this option globally. Note that overriding pip's choice of
whether to use :pep:`517` processing in this way does *not* affect whether pip
will use an isolated build environment (which is controlled via
``--no-build-isolation`` as noted above).
Except in the case noted above (projects with no :pep:`518` ``[build-system]``
section in ``pyproject.toml``), pip will never implicitly install a build
system. Projects **must** ensure that the correct build system is listed in
their ``requires`` list (this applies even if pip assumes that the
``setuptools`` backend is being used, as noted above).
.. _pep-518-limitations:
**Historical Limitations**:
* ``pip<18.0``: only supports installing build requirements from wheels, and
does not support the use of environment markers and extras (only version
specifiers are respected).
* ``pip<18.1``: build dependencies using .pth files are not properly supported;
as a result namespace packages do not work under Python 3.2 and earlier.
Future Developments
~~~~~~~~~~~~~~~~~~~
:pep:`426` notes that the intention is to add hooks to project metadata in
version 2.1 of the metadata spec, to explicitly define how to build a project
from its source. Once this version of the metadata spec is final, pip will
migrate to using that interface. At that point, the ``setup.py`` interface
documented here will be retained solely for legacy purposes, until projects
have migrated.
Specifically, applications should *not* expect to rely on there being any form
of backward compatibility guarantees around the ``setup.py`` interface.
Build Options
~~~~~~~~~~~~~
The ``--global-option`` and ``--build-option`` arguments to the ``pip install``
and ``pip wheel`` inject additional arguments into the ``setup.py`` command
(``--build-option`` is only available in ``pip wheel``). These arguments are
included in the command as follows:
.. tab:: Unix/macOS
.. code-block:: console
python setup.py <global_options> BUILD COMMAND <build_options>
.. tab:: Windows
.. code-block:: shell
py setup.py <global_options> BUILD COMMAND <build_options>
The options are passed unmodified, and presently offer direct access to the
distutils command line. Use of ``--global-option`` and ``--build-option``
should be considered as build system dependent, and may not be supported in the
current form if support for alternative build systems is added to pip.
.. _`General Options`:
General Options
***************
.. pip-general-options::
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip`

View File

@ -1,27 +1,11 @@
:orphan:
.. _`pip cache`:
.. meta::
pip cache
---------
:http-equiv=refresh: 3; url=../../cli/pip_cache/
This page has moved
===================
Usage
*****
.. tab:: Unix/macOS
.. pip-command-usage:: cache "python -m pip"
.. tab:: Windows
.. pip-command-usage:: cache "py -m pip"
Description
***********
.. pip-command-description:: cache
Options
*******
.. pip-command-options:: cache
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_cache`

View File

@ -1,87 +1,11 @@
.. _`pip check`:
:orphan:
=========
pip check
=========
.. meta::
:http-equiv=refresh: 3; url=../../cli/pip_check/
Usage
=====
This page has moved
===================
.. tab:: Unix/macOS
.. pip-command-usage:: check "python -m pip"
.. tab:: Windows
.. pip-command-usage:: check "py -m pip"
Description
===========
.. pip-command-description:: check
Examples
========
#. If all dependencies are compatible:
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip check
No broken requirements found.
$ echo $?
0
.. tab:: Windows
.. code-block:: console
C:\> py -m pip check
No broken requirements found.
C:\> echo %errorlevel%
0
#. If a package is missing:
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip check
pyramid 1.5.2 requires WebOb, which is not installed.
$ echo $?
1
.. tab:: Windows
.. code-block:: console
C:\> py -m pip check
pyramid 1.5.2 requires WebOb, which is not installed.
C:\> echo %errorlevel%
1
#. If a package has the wrong version:
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip check
pyramid 1.5.2 has requirement WebOb>=1.3.1, but you have WebOb 0.8.
$ echo $?
1
.. tab:: Windows
.. code-block:: console
C:\> py -m pip check
pyramid 1.5.2 has requirement WebOb>=1.3.1, but you have WebOb 0.8.
C:\> echo %errorlevel%
1
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_check`

View File

@ -1,30 +1,11 @@
:orphan:
.. _`pip config`:
.. meta::
==========
pip config
==========
:http-equiv=refresh: 3; url=../../cli/pip_config/
This page has moved
===================
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: config "python -m pip"
.. tab:: Windows
.. pip-command-usage:: config "py -m pip"
Description
===========
.. pip-command-description:: config
Options
=======
.. pip-command-options:: config
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_config`

View File

@ -1,35 +1,11 @@
.. _`pip debug`:
:orphan:
=========
pip debug
=========
.. meta::
:http-equiv=refresh: 3; url=../../cli/pip_debug/
Usage
=====
This page has moved
===================
.. tab:: Unix/macOS
.. pip-command-usage:: debug "python -m pip"
.. tab:: Windows
.. pip-command-usage:: debug "py -m pip"
.. warning::
This command is only meant for debugging.
Its options and outputs are provisional and may change without notice.
Description
===========
.. pip-command-description:: debug
Options
=======
.. pip-command-options:: debug
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_debug`

View File

@ -1,226 +1,11 @@
:orphan:
.. _`pip download`:
.. meta::
============
pip download
============
:http-equiv=refresh: 3; url=../../cli/pip_download/
This page has moved
===================
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: download "python -m pip"
.. tab:: Windows
.. pip-command-usage:: download "py -m pip"
Description
===========
.. pip-command-description:: download
Overview
--------
``pip download`` does the same resolution and downloading as ``pip install``,
but instead of installing the dependencies, it collects the downloaded
distributions into the directory provided (defaulting to the current
directory). This directory can later be passed as the value to ``pip install
--find-links`` to facilitate offline or locked down package installation.
``pip download`` with the ``--platform``, ``--python-version``,
``--implementation``, and ``--abi`` options provides the ability to fetch
dependencies for an interpreter and system other than the ones that pip is
running on. ``--only-binary=:all:`` or ``--no-deps`` is required when using any
of these options. It is important to note that these options all default to the
current system/interpreter, and not to the most restrictive constraints (e.g.
platform any, abi none, etc). To avoid fetching dependencies that happen to
match the constraint of the current interpreter (but not your target one), it
is recommended to specify all of these options if you are specifying one of
them. Generic dependencies (e.g. universal wheels, or dependencies with no
platform, abi, or implementation constraints) will still match an over-
constrained download requirement.
Options
=======
.. pip-command-options:: download
.. pip-index-options:: download
Examples
========
#. Download a package and all of its dependencies
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip download SomePackage
python -m pip download -d . SomePackage # equivalent to above
python -m pip download --no-index --find-links=/tmp/wheelhouse -d /tmp/otherwheelhouse SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip download SomePackage
py -m pip download -d . SomePackage # equivalent to above
py -m pip download --no-index --find-links=/tmp/wheelhouse -d /tmp/otherwheelhouse SomePackage
#. Download a package and all of its dependencies with OSX specific interpreter constraints.
This forces OSX 10.10 or lower compatibility. Since OSX deps are forward compatible,
this will also match ``macosx-10_9_x86_64``, ``macosx-10_8_x86_64``, ``macosx-10_8_intel``,
etc.
It will also match deps with platform ``any``. Also force the interpreter version to ``27``
(or more generic, i.e. ``2``) and implementation to ``cp`` (or more generic, i.e. ``py``).
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip download \
--only-binary=:all: \
--platform macosx-10_10_x86_64 \
--python-version 27 \
--implementation cp \
SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip download ^
--only-binary=:all: ^
--platform macosx-10_10_x86_64 ^
--python-version 27 ^
--implementation cp ^
SomePackage
#. Download a package and its dependencies with linux specific constraints.
Force the interpreter to be any minor version of py3k, and only accept
``cp34m`` or ``none`` as the abi.
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip download \
--only-binary=:all: \
--platform linux_x86_64 \
--python-version 3 \
--implementation cp \
--abi cp34m \
SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip download ^
--only-binary=:all: ^
--platform linux_x86_64 ^
--python-version 3 ^
--implementation cp ^
--abi cp34m ^
SomePackage
#. Force platform, implementation, and abi agnostic deps.
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip download \
--only-binary=:all: \
--platform any \
--python-version 3 \
--implementation py \
--abi none \
SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip download ^
--only-binary=:all: ^
--platform any ^
--python-version 3 ^
--implementation py ^
--abi none ^
SomePackage
#. Even when overconstrained, this will still correctly fetch the pip universal wheel.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip download \
--only-binary=:all: \
--platform linux_x86_64 \
--python-version 33 \
--implementation cp \
--abi cp34m \
pip>=8
.. code-block:: console
$ ls pip-8.1.1-py2.py3-none-any.whl
pip-8.1.1-py2.py3-none-any.whl
.. tab:: Windows
.. code-block:: console
C:\> py -m pip download ^
--only-binary=:all: ^
--platform linux_x86_64 ^
--python-version 33 ^
--implementation cp ^
--abi cp34m ^
pip>=8
.. code-block:: console
C:\> dir pip-8.1.1-py2.py3-none-any.whl
pip-8.1.1-py2.py3-none-any.whl
#. Download a package supporting one of several ABIs and platforms.
This is useful when fetching wheels for a well-defined interpreter, whose
supported ABIs and platforms are known and fixed, different than the one pip is
running under.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip download \
--only-binary=:all: \
--platform manylinux1_x86_64 --platform linux_x86_64 --platform any \
--python-version 36 \
--implementation cp \
--abi cp36m --abi cp36 --abi abi3 --abi none \
SomePackage
.. tab:: Windows
.. code-block:: console
C:> py -m pip download ^
--only-binary=:all: ^
--platform manylinux1_x86_64 --platform linux_x86_64 --platform any ^
--python-version 36 ^
--implementation cp ^
--abi cp36m --abi cp36 --abi abi3 --abi none ^
SomePackage
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_download`

View File

@ -1,74 +1,11 @@
:orphan:
.. _`pip freeze`:
.. meta::
==========
pip freeze
==========
:http-equiv=refresh: 3; url=../../cli/pip_freeze/
This page has moved
===================
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: freeze "python -m pip"
.. tab:: Windows
.. pip-command-usage:: freeze "py -m pip"
Description
===========
.. pip-command-description:: freeze
Options
=======
.. pip-command-options:: freeze
Examples
========
#. Generate output suitable for a requirements file.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip freeze
docutils==0.11
Jinja2==2.7.2
MarkupSafe==0.19
Pygments==1.6
Sphinx==1.2.2
.. tab:: Windows
.. code-block:: console
C:\> py -m pip freeze
docutils==0.11
Jinja2==2.7.2
MarkupSafe==0.19
Pygments==1.6
Sphinx==1.2.2
#. Generate a requirements file and then install from it in another environment.
.. tab:: Unix/macOS
.. code-block:: shell
env1/bin/python -m pip freeze > requirements.txt
env2/bin/python -m pip install -r requirements.txt
.. tab:: Windows
.. code-block:: shell
env1\bin\python -m pip freeze > requirements.txt
env2\bin\python -m pip install -r requirements.txt
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_freeze`

View File

@ -1,72 +1,11 @@
.. _`pip hash`:
:orphan:
========
pip hash
========
.. meta::
:http-equiv=refresh: 3; url=../../cli/pip_hash/
Usage
=====
This page has moved
===================
.. tab:: Unix/macOS
.. pip-command-usage:: hash "python -m pip"
.. tab:: Windows
.. pip-command-usage:: hash "py -m pip"
Description
===========
.. pip-command-description:: hash
Overview
--------
``pip hash`` is a convenient way to get a hash digest for use with
:ref:`hash-checking mode`, especially for packages with multiple archives. The
error message from ``pip install --require-hashes ...`` will give you one
hash, but, if there are multiple archives (like source and binary ones), you
will need to manually download and compute a hash for the others. Otherwise, a
spurious hash mismatch could occur when :ref:`pip install` is passed a
different set of options, like :ref:`--no-binary <install_--no-binary>`.
Options
=======
.. pip-command-options:: hash
Example
=======
Compute the hash of a downloaded archive:
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip download SomePackage
Collecting SomePackage
Downloading SomePackage-2.2.tar.gz
Saved ./pip_downloads/SomePackage-2.2.tar.gz
Successfully downloaded SomePackage
$ python -m pip hash ./pip_downloads/SomePackage-2.2.tar.gz
./pip_downloads/SomePackage-2.2.tar.gz:
--hash=sha256:93e62e05c7ad3da1a233def6731e8285156701e3419a5fe279017c429ec67ce0
.. tab:: Windows
.. code-block:: console
C:\> py -m pip download SomePackage
Collecting SomePackage
Downloading SomePackage-2.2.tar.gz
Saved ./pip_downloads/SomePackage-2.2.tar.gz
Successfully downloaded SomePackage
C:\> py -m pip hash ./pip_downloads/SomePackage-2.2.tar.gz
./pip_downloads/SomePackage-2.2.tar.gz:
--hash=sha256:93e62e05c7ad3da1a233def6731e8285156701e3419a5fe279017c429ec67ce0
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_hash`

File diff suppressed because it is too large Load Diff

View File

@ -1,201 +1,11 @@
.. _`pip list`:
:orphan:
========
pip list
========
.. meta::
:http-equiv=refresh: 3; url=../../cli/pip_list/
This page has moved
===================
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: list "python -m pip"
.. tab:: Windows
.. pip-command-usage:: list "py -m pip"
Description
===========
.. pip-command-description:: list
Options
=======
.. pip-command-options:: list
.. pip-index-options:: list
Examples
========
#. List installed packages.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list
docutils (0.10)
Jinja2 (2.7.2)
MarkupSafe (0.18)
Pygments (1.6)
Sphinx (1.2.1)
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list
docutils (0.10)
Jinja2 (2.7.2)
MarkupSafe (0.18)
Pygments (1.6)
Sphinx (1.2.1)
#. List outdated packages (excluding editables), and the latest version available.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --outdated
docutils (Current: 0.10 Latest: 0.11)
Sphinx (Current: 1.2.1 Latest: 1.2.2)
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --outdated
docutils (Current: 0.10 Latest: 0.11)
Sphinx (Current: 1.2.1 Latest: 1.2.2)
#. List installed packages with column formatting.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --format columns
Package Version
------- -------
docopt 0.6.2
idlex 1.13
jedi 0.9.0
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --format columns
Package Version
------- -------
docopt 0.6.2
idlex 1.13
jedi 0.9.0
#. List outdated packages with column formatting.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list -o --format columns
Package Version Latest Type
---------- ------- ------ -----
retry 0.8.1 0.9.1 wheel
setuptools 20.6.7 21.0.0 wheel
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list -o --format columns
Package Version Latest Type
---------- ------- ------ -----
retry 0.8.1 0.9.1 wheel
setuptools 20.6.7 21.0.0 wheel
#. List packages that are not dependencies of other packages. Can be combined with
other options.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --outdated --not-required
docutils (Current: 0.10 Latest: 0.11)
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --outdated --not-required
docutils (Current: 0.10 Latest: 0.11)
#. Use legacy formatting
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --format=legacy
colorama (0.3.7)
docopt (0.6.2)
idlex (1.13)
jedi (0.9.0)
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --format=legacy
colorama (0.3.7)
docopt (0.6.2)
idlex (1.13)
jedi (0.9.0)
#. Use json formatting
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --format=json
[{'name': 'colorama', 'version': '0.3.7'}, {'name': 'docopt', 'version': '0.6.2'}, ...
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --format=json
[{'name': 'colorama', 'version': '0.3.7'}, {'name': 'docopt', 'version': '0.6.2'}, ...
#. Use freeze formatting
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip list --format=freeze
colorama==0.3.7
docopt==0.6.2
idlex==1.13
jedi==0.9.0
.. tab:: Windows
.. code-block:: console
C:\> py -m pip list --format=freeze
colorama==0.3.7
docopt==0.6.2
idlex==1.13
jedi==0.9.0
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_list`

View File

@ -1,52 +1,11 @@
.. _`pip search`:
:orphan:
==========
pip search
==========
.. meta::
:http-equiv=refresh: 3; url=../../cli/pip_search/
This page has moved
===================
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: search "python -m pip"
.. tab:: Windows
.. pip-command-usage:: search "py -m pip"
Description
===========
.. pip-command-description:: search
Options
=======
.. pip-command-options:: search
Examples
========
#. Search for "peppercorn"
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip search peppercorn
pepperedform - Helpers for using peppercorn with formprocess.
peppercorn - A library for converting a token stream into [...]
.. tab:: Windows
.. code-block:: console
C:\> py -m pip search peppercorn
pepperedform - Helpers for using peppercorn with formprocess.
peppercorn - A library for converting a token stream into [...]
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_search`

View File

@ -1,154 +1,11 @@
.. _`pip show`:
:orphan:
========
pip show
========
.. meta::
:http-equiv=refresh: 3; url=../../cli/pip_show/
This page has moved
===================
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: show "python -m pip"
.. tab:: Windows
.. pip-command-usage:: show "py -m pip"
Description
===========
.. pip-command-description:: show
Options
=======
.. pip-command-options:: show
Examples
========
#. Show information about a package:
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip show sphinx
Name: Sphinx
Version: 1.4.5
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
Author-email: georg@python.org
License: BSD
Location: /my/env/lib/python2.7/site-packages
Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
.. tab:: Windows
.. code-block:: console
C:\> py -m pip show sphinx
Name: Sphinx
Version: 1.4.5
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
Author-email: georg@python.org
License: BSD
Location: /my/env/lib/python2.7/site-packages
Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
#. Show all information about a package
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip show --verbose sphinx
Name: Sphinx
Version: 1.4.5
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
Author-email: georg@python.org
License: BSD
Location: /my/env/lib/python2.7/site-packages
Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
Metadata-Version: 2.0
Installer:
Classifiers:
Development Status :: 5 - Production/Stable
Environment :: Console
Environment :: Web Environment
Intended Audience :: Developers
Intended Audience :: Education
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Framework :: Sphinx
Framework :: Sphinx :: Extension
Framework :: Sphinx :: Theme
Topic :: Documentation
Topic :: Documentation :: Sphinx
Topic :: Text Processing
Topic :: Utilities
Entry-points:
[console_scripts]
sphinx-apidoc = sphinx.apidoc:main
sphinx-autogen = sphinx.ext.autosummary.generate:main
sphinx-build = sphinx:main
sphinx-quickstart = sphinx.quickstart:main
[distutils.commands]
build_sphinx = sphinx.setup_command:BuildDoc
.. tab:: Windows
.. code-block:: console
C:\> py -m pip show --verbose sphinx
Name: Sphinx
Version: 1.4.5
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
Author-email: georg@python.org
License: BSD
Location: /my/env/lib/python2.7/site-packages
Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
Metadata-Version: 2.0
Installer:
Classifiers:
Development Status :: 5 - Production/Stable
Environment :: Console
Environment :: Web Environment
Intended Audience :: Developers
Intended Audience :: Education
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Framework :: Sphinx
Framework :: Sphinx :: Extension
Framework :: Sphinx :: Theme
Topic :: Documentation
Topic :: Documentation :: Sphinx
Topic :: Text Processing
Topic :: Utilities
Entry-points:
[console_scripts]
sphinx-apidoc = sphinx.apidoc:main
sphinx-autogen = sphinx.ext.autosummary.generate:main
sphinx-build = sphinx:main
sphinx-quickstart = sphinx.quickstart:main
[distutils.commands]
build_sphinx = sphinx.setup_command:BuildDoc
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_show`

View File

@ -1,58 +1,11 @@
.. _`pip uninstall`:
:orphan:
=============
pip uninstall
=============
.. meta::
:http-equiv=refresh: 3; url=../../cli/pip_uninstall/
This page has moved
===================
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: uninstall "python -m pip"
.. tab:: Windows
.. pip-command-usage:: uninstall "py -m pip"
Description
===========
.. pip-command-description:: uninstall
Options
=======
.. pip-command-options:: uninstall
Examples
========
#. Uninstall a package.
.. tab:: Unix/macOS
.. code-block:: console
$ python -m pip uninstall simplejson
Uninstalling simplejson:
/home/me/env/lib/python3.9/site-packages/simplejson
/home/me/env/lib/python3.9/site-packages/simplejson-2.2.1-py3.9.egg-info
Proceed (y/n)? y
Successfully uninstalled simplejson
.. tab:: Windows
.. code-block:: console
C:\> py -m pip uninstall simplejson
Uninstalling simplejson:
/home/me/env/lib/python3.9/site-packages/simplejson
/home/me/env/lib/python3.9/site-packages/simplejson-2.2.1-py3.9.egg-info
Proceed (y/n)? y
Successfully uninstalled simplejson
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_uninstall`

View File

@ -1,125 +1,11 @@
:orphan:
.. _`pip wheel`:
.. meta::
=========
pip wheel
=========
:http-equiv=refresh: 3; url=../../cli/pip_wheel/
This page has moved
===================
Usage
=====
.. tab:: Unix/macOS
.. pip-command-usage:: wheel "python -m pip"
.. tab:: Windows
.. pip-command-usage:: wheel "py -m pip"
Description
===========
.. pip-command-description:: wheel
Build System Interface
----------------------
In order for pip to build a wheel, ``setup.py`` must implement the
``bdist_wheel`` command with the following syntax:
.. tab:: Unix/macOS
.. code-block:: shell
python setup.py bdist_wheel -d TARGET
.. tab:: Windows
.. code-block:: shell
py setup.py bdist_wheel -d TARGET
This command must create a wheel compatible with the invoking Python
interpreter, and save that wheel in the directory TARGET.
No other build system commands are invoked by the ``pip wheel`` command.
Customising the build
^^^^^^^^^^^^^^^^^^^^^
It is possible using ``--global-option`` to include additional build commands
with their arguments in the ``setup.py`` command. This is currently the only
way to influence the building of C extensions from the command line. For
example:
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip wheel --global-option bdist_ext --global-option -DFOO wheel
.. tab:: Windows
.. code-block:: shell
py -m pip wheel --global-option bdist_ext --global-option -DFOO wheel
will result in a build command of
::
setup.py bdist_ext -DFOO bdist_wheel -d TARGET
which passes a preprocessor symbol to the extension build.
Such usage is considered highly build-system specific and more an accident of
the current implementation than a supported interface.
Options
=======
.. pip-command-options:: wheel
.. pip-index-options:: wheel
Examples
========
#. Build wheels for a requirement (and all its dependencies), and then install
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip wheel --wheel-dir=/tmp/wheelhouse SomePackage
python -m pip install --no-index --find-links=/tmp/wheelhouse SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip wheel --wheel-dir=/tmp/wheelhouse SomePackage
py -m pip install --no-index --find-links=/tmp/wheelhouse SomePackage
#. Build a wheel for a package from source
.. tab:: Unix/macOS
.. code-block:: shell
python -m pip wheel --no-binary SomePackage SomePackage
.. tab:: Windows
.. code-block:: shell
py -m pip wheel --no-binary SomePackage SomePackage
You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_wheel`

View File

@ -125,7 +125,7 @@ does not come with it included.
pip install keyring
echo your-password | keyring set pypi.company.com your-username
pip install your-package --extra-index-url https://pypi.company.com/
pip install your-package --index-url https://pypi.company.com/
.. _keyring: https://pypi.org/project/keyring/
@ -825,6 +825,21 @@ strategies supported:
The default strategy is ``only-if-needed``. This was changed in pip 10.0 due to
the breaking nature of ``eager`` when upgrading conflicting dependencies.
It is important to note that ``--upgrade`` affects *direct requirements* (e.g.
those specified on the command-line or via a requirements file) while
``--upgrade-strategy`` affects *indirect requirements* (dependencies of direct
requirements).
As an example, say ``SomePackage`` has a dependency, ``SomeDependency``, and
both of them are already installed but are not the latest avaialable versions:
- ``pip install SomePackage``: will not upgrade the existing ``SomePackage`` or
``SomeDependency``.
- ``pip install --upgrade SomePackage``: will upgrade ``SomePackage``, but not
``SomeDependency`` (unless a minimum requirement is not met).
- ``pip install --upgrade SomePackage --upgrade-strategy=eager``: upgrades both
``SomePackage`` and ``SomeDependency``.
As an historic note, an earlier "fix" for getting the ``only-if-needed``
behaviour was:
@ -1857,9 +1872,11 @@ We plan for the resolver changeover to proceed as follows, using
environments, pip defaults to the old resolver, and the new one is
available using the flag ``--use-feature=2020-resolver``.
* pip 21.0: pip uses new resolver, and the old resolver is no longer
available. Python 2 support is removed per our :ref:`Python 2
Support` policy.
* pip 21.0: pip uses new resolver by default, and the old resolver is
no longer supported. It will be removed after a currently undecided
amount of time, as the removal is dependent on pip's volunteer
maintainers' availability. Python 2 support is removed per our
:ref:`Python 2 Support` policy.
Since this work will not change user-visible behavior described in the
pip documentation, this change is not covered by the :ref:`Deprecation
@ -1885,6 +1902,6 @@ announcements on the `low-traffic packaging announcements list`_ and
.. _low-traffic packaging announcements list: https://mail.python.org/mailman3/lists/pypi-announce.python.org/
.. _our survey on upgrades that create conflicts: https://docs.google.com/forms/d/e/1FAIpQLSeBkbhuIlSofXqCyhi3kGkLmtrpPOEBwr6iJA6SzHdxWKfqdA/viewform
.. _the official Python blog: https://blog.python.org/
.. _requests: https://requests.readthedocs.io/en/master/user/authentication/#netrc-authentication
.. _requests: https://requests.readthedocs.io/en/latest/user/authentication/#netrc-authentication
.. _Python standard library: https://docs.python.org/3/library/netrc.html
.. _Python Windows launcher: https://docs.python.org/3/using/windows.html#launcher

View File

@ -1,32 +1,91 @@
"""pip sphinx extensions"""
import optparse
import pathlib
import re
import sys
from textwrap import dedent
from typing import Iterable, List, Optional
from docutils import nodes
from docutils import nodes, statemachine
from docutils.parsers import rst
from docutils.statemachine import ViewList
from docutils.statemachine import StringList, ViewList
from sphinx.application import Sphinx
from pip._internal.cli import cmdoptions
from pip._internal.commands import commands_dict, create_command
from pip._internal.req.req_file import SUPPORTED_OPTIONS
class PipNewsInclude(rst.Directive):
required_arguments = 1
def _is_version_section_title_underline(self, prev, curr):
"""Find a ==== line that marks the version section title."""
if prev is None:
return False
if re.match(r"^=+$", curr) is None:
return False
if len(curr) < len(prev):
return False
return True
def _iter_lines_with_refs(self, lines):
"""Transform the input lines to add a ref before each section title.
This is done by looking one line ahead and locate a title's underline,
and add a ref before the title text.
Dots in the version is converted into dash, and a ``v`` is prefixed.
This makes Sphinx use them as HTML ``id`` verbatim without generating
auto numbering (which would make the the anchors unstable).
"""
prev = None
for line in lines:
# Transform the previous line to include an explicit ref.
if self._is_version_section_title_underline(prev, line):
vref = prev.split(None, 1)[0].replace(".", "-")
yield f".. _`v{vref}`:"
yield "" # Empty line between ref and the title.
if prev is not None:
yield prev
prev = line
if prev is not None:
yield prev
def run(self):
source = self.state_machine.input_lines.source(
self.lineno - self.state_machine.input_offset - 1,
)
path = (
pathlib.Path(source)
.resolve()
.parent
.joinpath(self.arguments[0])
.resolve()
)
include_lines = statemachine.string2lines(
path.read_text(encoding="utf-8"),
self.state.document.settings.tab_width,
convert_whitespace=True,
)
include_lines = list(self._iter_lines_with_refs(include_lines))
self.state_machine.insert_input(include_lines, str(path))
return []
class PipCommandUsage(rst.Directive):
required_arguments = 1
optional_arguments = 3
def run(self):
def run(self) -> List[nodes.Node]:
cmd = create_command(self.arguments[0])
cmd_prefix = 'python -m pip'
cmd_prefix = "python -m pip"
if len(self.arguments) > 1:
cmd_prefix = " ".join(self.arguments[1:])
cmd_prefix = cmd_prefix.strip('"')
cmd_prefix = cmd_prefix.strip("'")
usage = dedent(
cmd.usage.replace('%prog', f'{cmd_prefix} {cmd.name}')
).strip()
usage = dedent(cmd.usage.replace("%prog", f"{cmd_prefix} {cmd.name}")).strip()
node = nodes.literal_block(usage, usage)
return [node]
@ -34,26 +93,28 @@ class PipCommandUsage(rst.Directive):
class PipCommandDescription(rst.Directive):
required_arguments = 1
def run(self):
def run(self) -> List[nodes.Node]:
node = nodes.paragraph()
node.document = self.state.document
desc = ViewList()
cmd = create_command(self.arguments[0])
assert cmd.__doc__ is not None
description = dedent(cmd.__doc__)
for line in description.split('\n'):
for line in description.split("\n"):
desc.append(line, "")
self.state.nested_parse(desc, 0, node)
return [node]
class PipOptions(rst.Directive):
def _format_option(self, option, cmd_name=None):
def _format_option(
self, option: optparse.Option, cmd_name: Optional[str] = None
) -> List[str]:
bookmark_line = (
".. _`{cmd_name}_{option._long_opts[0]}`:"
if cmd_name else
".. _`{option._long_opts[0]}`:"
).format(**locals())
f".. _`{cmd_name}_{option._long_opts[0]}`:"
if cmd_name
else f".. _`{option._long_opts[0]}`:"
)
line = ".. option:: "
if option._short_opts:
line += option._short_opts[0]
@ -62,22 +123,27 @@ class PipOptions(rst.Directive):
elif option._long_opts:
line += option._long_opts[0]
if option.takes_value():
metavar = option.metavar or option.dest.lower()
metavar = option.metavar or option.dest
assert metavar is not None
line += f" <{metavar.lower()}>"
# fix defaults
opt_help = option.help.replace('%default', str(option.default))
assert option.help is not None
# https://github.com/python/typeshed/pull/5080
opt_help = option.help.replace("%default", str(option.default)) # type: ignore
# fix paths with sys.prefix
opt_help = opt_help.replace(sys.prefix, "<sys.prefix>")
return [bookmark_line, "", line, "", " " + opt_help, ""]
def _format_options(self, options, cmd_name=None):
def _format_options(
self, options: Iterable[optparse.Option], cmd_name: Optional[str] = None
) -> None:
for option in options:
if option.help == optparse.SUPPRESS_HELP:
continue
for line in self._format_option(option, cmd_name):
self.view_list.append(line, "")
def run(self):
def run(self) -> List[nodes.Node]:
node = nodes.paragraph()
node.document = self.state.document
self.view_list = ViewList()
@ -87,19 +153,17 @@ class PipOptions(rst.Directive):
class PipGeneralOptions(PipOptions):
def process_options(self):
self._format_options(
[o() for o in cmdoptions.general_group['options']]
)
def process_options(self) -> None:
self._format_options([o() for o in cmdoptions.general_group["options"]])
class PipIndexOptions(PipOptions):
required_arguments = 1
def process_options(self):
def process_options(self) -> None:
cmd_name = self.arguments[0]
self._format_options(
[o() for o in cmdoptions.index_group['options']],
[o() for o in cmdoptions.index_group["options"]],
cmd_name=cmd_name,
)
@ -107,7 +171,7 @@ class PipIndexOptions(PipOptions):
class PipCommandOptions(PipOptions):
required_arguments = 1
def process_options(self):
def process_options(self) -> None:
cmd = create_command(self.arguments[0])
self._format_options(
cmd.parser.option_groups[0].option_list,
@ -116,49 +180,128 @@ class PipCommandOptions(PipOptions):
class PipReqFileOptionsReference(PipOptions):
def determine_opt_prefix(self, opt_name):
def determine_opt_prefix(self, opt_name: str) -> str:
for command in commands_dict:
cmd = create_command(command)
if cmd.cmd_opts.has_option(opt_name):
return command
raise KeyError(f'Could not identify prefix of opt {opt_name}')
raise KeyError(f"Could not identify prefix of opt {opt_name}")
def process_options(self):
def process_options(self) -> None:
for option in SUPPORTED_OPTIONS:
if getattr(option, 'deprecated', False):
if getattr(option, "deprecated", False):
continue
opt = option()
opt_name = opt._long_opts[0]
if opt._short_opts:
short_opt_name = '{}, '.format(opt._short_opts[0])
short_opt_name = "{}, ".format(opt._short_opts[0])
else:
short_opt_name = ''
short_opt_name = ""
if option in cmdoptions.general_group['options']:
prefix = ''
if option in cmdoptions.general_group["options"]:
prefix = ""
else:
prefix = '{}_'.format(self.determine_opt_prefix(opt_name))
prefix = "{}_".format(self.determine_opt_prefix(opt_name))
self.view_list.append(
'* :ref:`{short}{long}<{prefix}{opt_name}>`'.format(
"* :ref:`{short}{long}<{prefix}{opt_name}>`".format(
short=short_opt_name,
long=opt_name,
prefix=prefix,
opt_name=opt_name
opt_name=opt_name,
),
"\n"
"\n",
)
def setup(app):
app.add_directive('pip-command-usage', PipCommandUsage)
app.add_directive('pip-command-description', PipCommandDescription)
app.add_directive('pip-command-options', PipCommandOptions)
app.add_directive('pip-general-options', PipGeneralOptions)
app.add_directive('pip-index-options', PipIndexOptions)
class PipCLIDirective(rst.Directive):
"""
- Only works when used in a MyST document.
- Requires sphinx-inline-tabs' tab directive.
"""
has_content = True
optional_arguments = 1
def run(self) -> List[nodes.Node]:
node = nodes.paragraph()
node.document = self.state.document
os_variants = {
"Linux": {
"highlighter": "console",
"executable": "python",
"prompt": "$",
},
"MacOS": {
"highlighter": "console",
"executable": "python",
"prompt": "$",
},
"Windows": {
"highlighter": "doscon",
"executable": "py",
"prompt": "C:>",
},
}
if self.arguments:
assert self.arguments == ["in-a-venv"]
in_virtual_environment = True
else:
in_virtual_environment = False
lines = []
# Create a tab for each OS
for os, variant in os_variants.items():
# Unpack the values
prompt = variant["prompt"]
highlighter = variant["highlighter"]
if in_virtual_environment:
executable = "python"
pip_spelling = "pip"
else:
executable = variant["executable"]
pip_spelling = f"{executable} -m pip"
# Substitute the various "prompts" into the correct variants
substitution_pipeline = [
(
r"(^|(?<=\n))\$ python",
f"{prompt} {executable}",
),
(
r"(^|(?<=\n))\$ pip",
f"{prompt} {pip_spelling}",
),
]
content = self.block_text
for pattern, substitution in substitution_pipeline:
content = re.sub(pattern, substitution, content)
# Write the tab
lines.append(f"````{{tab}} {os}")
lines.append(f"```{highlighter}")
lines.append(f"{content}")
lines.append("```")
lines.append("````")
string_list = StringList(lines)
self.state.nested_parse(string_list, 0, node)
return [node]
def setup(app: Sphinx) -> None:
app.add_directive("pip-command-usage", PipCommandUsage)
app.add_directive("pip-command-description", PipCommandDescription)
app.add_directive("pip-command-options", PipCommandOptions)
app.add_directive("pip-general-options", PipGeneralOptions)
app.add_directive("pip-index-options", PipIndexOptions)
app.add_directive(
'pip-requirements-file-options-ref-list', PipReqFileOptionsReference
"pip-requirements-file-options-ref-list", PipReqFileOptionsReference
)
app.add_directive('pip-news-include', PipNewsInclude)
app.add_directive("pip-cli", PipCLIDirective)

1
news/4390.bugfix.rst Normal file
View File

@ -0,0 +1 @@
Fixed ``--target`` to work with ``--editable`` installs.

View File

@ -0,0 +1,2 @@
Update "setuptools extras" link to match upstream.

1
news/6409.bugfix.rst Normal file
View File

@ -0,0 +1 @@
Add a warning, discouraging the usage of pip as root, outside a virtual environment.

1
news/6720.doc.rst Normal file
View File

@ -0,0 +1 @@
Improve SSL Certificate Verification docs and ``--cert`` help text.

2
news/7269.bugfix.rst Normal file
View File

@ -0,0 +1,2 @@
Ignore ``.dist-info`` directories if the stem is not a valid Python distribution
name, so they don't show up in e.g. ``pip freeze``.

1
news/8418.bugfix.rst Normal file
View File

@ -0,0 +1 @@
Fix ``pip freeze`` permission denied error in order to display an understandable error message and offer solutions.

1
news/8418.doc.rst Normal file
View File

@ -0,0 +1 @@
Add a section in the documentation to suggest solutions to the ``pip freeze`` permission denied issue.

1
news/8733.bugfix.rst Normal file
View File

@ -0,0 +1 @@
Correctly uninstall script files (from setuptools' ``scripts`` argument), when installed with ``--user``.

4
news/9091.feature.rst Normal file
View File

@ -0,0 +1,4 @@
Add a feature ``--use-feature=in-tree-build`` to build local projects in-place
when installing. This is expected to become the default behavior in pip 21.3;
see `Installing from local packages <https://pip.pypa.io/en/stable/user_guide/#installing-from-local-packages>`_
for more information.

1
news/9139.feature.rst Normal file
View File

@ -0,0 +1 @@
Bring back the "(from versions: ...)" message, that was shown on resolution failures.

2
news/9300.bugfix.rst Normal file
View File

@ -0,0 +1,2 @@
New resolver: Show relevant entries from user-supplied constraint files in the
error message to improve debuggability.

2
news/9348.bugfix.rst Normal file
View File

@ -0,0 +1,2 @@
Avoid parsing version to make the version check more robust against lousily
debundled downstream distributions.

1
news/9541.bugfix.rst Normal file
View File

@ -0,0 +1 @@
Fix incorrect reporting on ``Requires-Python`` conflicts.

1
news/9547.feature.rst Normal file
View File

@ -0,0 +1 @@
Add support for editable installs for project with only setup.cfg files.

1
news/9565.bugfix.rst Normal file
View File

@ -0,0 +1 @@
Make wheel compatibility tag preferences more important than the build tag

3
news/9617.process.rst Normal file
View File

@ -0,0 +1,3 @@
Start installation scheme migration from ``distutils`` to ``sysconfig``. A
warning is implemented to detect differences between the two implementations to
encourage user reports, so we can avoid breakages before they happen.

1
news/9647.doc.rst Normal file
View File

@ -0,0 +1 @@
Add warning about ``--extra-index-url`` and dependency confusion

2
news/9692.doc.rst Normal file
View File

@ -0,0 +1,2 @@
Describe ``--upgrade-strategy`` and direct requirements explicitly; add a brief
example.

1
news/9748.feature.rst Normal file
View File

@ -0,0 +1 @@
Improve performance when picking the best file from indexes during `pip install`.

View File

@ -0,0 +1 @@
Update urllib3 to 1.26.4 to fix CVE-2021-28363

View File

@ -0,0 +1 @@
Upgrade vendored resolvelib to 0.5.5.

View File

@ -10,9 +10,11 @@ from typing import Iterator, List, Tuple
import nox
# fmt: off
sys.path.append(".")
from tools.automation import release # isort:skip # noqa
from tools import release # isort:skip # noqa
sys.path.pop()
# fmt: on
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["lint"]
@ -75,17 +77,16 @@ def test(session):
# type: (nox.Session) -> None
# Get the common wheels.
if should_update_common_wheels():
# fmt: off
run_with_protected_pip(
session,
"wheel",
"-w", LOCATIONS["common-wheels"],
"-r", REQUIREMENTS["common-wheels"],
)
# fmt: on
else:
msg = (
"Re-using existing common-wheels at {}."
.format(LOCATIONS["common-wheels"])
)
msg = f"Re-using existing common-wheels at {LOCATIONS['common-wheels']}."
session.log(msg)
# Build source distribution
@ -93,11 +94,14 @@ def test(session):
sdist_dir = os.path.join(session.virtualenv.location, "sdist") # type: ignore
if os.path.exists(sdist_dir):
shutil.rmtree(sdist_dir, ignore_errors=True)
# fmt: off
session.run(
"python", "setup.py", "sdist",
"--formats=zip", "--dist-dir", sdist_dir,
"python", "setup.py", "sdist", "--formats=zip", "--dist-dir", sdist_dir,
silent=True,
)
# fmt: on
generated_files = os.listdir(sdist_dir)
assert len(generated_files) == 1
generated_sdist = os.path.join(sdist_dir, generated_files[0])
@ -129,6 +133,7 @@ def docs(session):
# can not use a different configuration directory vs source directory
# on RTD currently. So, we'll pass "-c docs/html" here.
# See https://github.com/rtfd/readthedocs.org/issues/1543.
# fmt: off
return [
"sphinx-build",
"-W",
@ -138,11 +143,28 @@ def docs(session):
"docs/" + kind,
"docs/build/" + kind,
]
# fmt: on
session.run(*get_sphinx_build_command("html"))
session.run(*get_sphinx_build_command("man"))
@nox.session(name="docs-live")
def docs_live(session):
# type: (nox.Session) -> None
session.install("-e", ".")
session.install("-r", REQUIREMENTS["docs"], "sphinx-autobuild")
session.run(
"sphinx-autobuild",
"-d=docs/build/doctrees/livehtml",
"-b=dirhtml",
"docs/html",
"docs/build/livehtml",
*session.posargs,
)
@nox.session
def lint(session):
# type: (nox.Session) -> None
@ -152,7 +174,6 @@ def lint(session):
args = session.posargs + ["--all-files"]
else:
args = ["--all-files", "--show-diff-on-failure"]
args.append("--hook-stage=manual")
session.run("pre-commit", "run", *args)
@ -168,11 +189,14 @@ def vendoring(session):
def pinned_requirements(path):
# type: (Path) -> Iterator[Tuple[str, str]]
for line in path.read_text().splitlines():
one, two = line.split("==", 1)
for line in path.read_text().splitlines(keepends=False):
one, sep, two = line.partition("==")
if not sep:
continue
name = one.strip()
version = two.split("#")[0].strip()
yield name, version
version = two.split("#", 1)[0].strip()
if name and version:
yield name, version
vendor_txt = Path("src/pip/_vendor/vendor.txt")
for name, old_version in pinned_requirements(vendor_txt):
@ -227,9 +251,7 @@ def prepare_release(session):
session.log(f"# Updating {AUTHORS_FILE}")
release.generate_authors(AUTHORS_FILE)
if release.modified_files_in_git():
release.commit_file(
session, AUTHORS_FILE, message=f"Update {AUTHORS_FILE}",
)
release.commit_file(session, AUTHORS_FILE, message=f"Update {AUTHORS_FILE}")
else:
session.log(f"# No changes to {AUTHORS_FILE}")
@ -276,7 +298,7 @@ def build_release(session):
tmp_dist_paths = (build_dir / p for p in tmp_dists)
session.log(f"# Copying dists from {build_dir}")
os.makedirs('dist', exist_ok=True)
os.makedirs("dist", exist_ok=True)
for dist, final in zip(tmp_dist_paths, tmp_dists):
session.log(f"# Copying {dist} to {final}")
shutil.copy(dist, final)
@ -291,7 +313,7 @@ def build_dists(session):
has_forbidden_git_untracked_files = any(
# Don't report the environment this session is running in
not untracked_file.startswith('.nox/build-release/')
not untracked_file.startswith(".nox/build-release/")
for untracked_file in release.get_git_untracked_files()
)
if has_forbidden_git_untracked_files:
@ -337,9 +359,7 @@ def upload_release(session):
f"pip-{version}.tar.gz",
]
if sorted(distfile_names) != sorted(expected_distribution_files):
session.error(
f"Distribution files do not seem to be for {version} release."
)
session.error(f"Distribution files do not seem to be for {version} release.")
session.log("# Upload distributions")
session.run("twine", "upload", *distribution_files)

View File

@ -9,7 +9,7 @@ filename = "NEWS.rst"
directory = "news/"
title_format = "{version} ({project_date})"
issue_format = "`#{issue} <https://github.com/pypa/pip/issues/{issue}>`_"
template = "tools/automation/news/template.rst"
template = "tools/news/template.rst"
type = [
{ name = "Process", directory = "process", showcontent = true },
{ name = "Deprecations and Removals", directory = "removal", showcontent = true },
@ -26,7 +26,7 @@ requirements = "src/pip/_vendor/vendor.txt"
namespace = "pip._vendor"
protected-files = ["__init__.py", "README.rst", "vendor.txt"]
patches-dir = "tools/automation/vendoring/patches"
patches-dir = "tools/vendoring/patches"
[tool.vendoring.transformations]
substitute = [

View File

@ -36,10 +36,23 @@ disallow_untyped_defs = True
disallow_any_generics = True
warn_unused_ignores = True
[mypy-pip/_vendor/*]
follow_imports = skip
[mypy-pip._vendor.*]
ignore_errors = True
# These vendored libraries use runtime magic to populate things and don't sit
# well with static typing out of the box. Eventually we should provide correct
# typing information for their public interface and remove these configs.
[mypy-pip._vendor.colorama]
follow_imports = skip
[mypy-pip._vendor.pkg_resources]
follow_imports = skip
[mypy-pip._vendor.progress.*]
follow_imports = skip
[mypy-pip._vendor.requests.*]
follow_imports = skip
[mypy-pip._vendor.retrying]
follow_imports = skip
[tool:pytest]
addopts = --ignore src/pip/_vendor --ignore tests/tests_cache -r aR
markers =
@ -53,7 +66,6 @@ markers =
svn: VCS: Subversion
mercurial: VCS: Mercurial
git: VCS: git
yaml: yaml based tests
search: tests for 'pip search'
[coverage:run]

Some files were not shown because too many files have changed in this diff Show More