Skip to content

Commit c48a7f7

Browse files
authored
Merge branch 'master' into remove_legacy_resolver
2 parents 42e64ae + baaf66f commit c48a7f7

File tree

177 files changed

+2045
-2640
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+2045
-2640
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,30 @@ about: Something is not working correctly.
44
title: ""
55
labels: "S: needs triage, type: bug"
66
issue_body: true # default: true, adds a classic WSYWIG textarea, if on
7-
inputs:
8-
- type: description
7+
body:
8+
- type: markdown
99
attributes:
1010
value: |
1111
1212
If you're reporting an issue for `--use-feature=2020-resolver`,
1313
use the "Dependency resolver failures / errors" template instead.
14-
- type: description
14+
- type: markdown
1515
attributes:
1616
value: "**Environment**"
1717
- type: input
1818
attributes:
1919
label: pip version
20+
validations:
2021
required: true
2122
- type: input
2223
attributes:
2324
label: Python version
25+
validations:
2426
required: true
2527
- type: input
2628
attributes:
2729
label: OS
30+
validations:
2831
required: true
2932
- type: textarea
3033
attributes:
@@ -72,7 +75,7 @@ inputs:
7275
Read the [PSF Code of Conduct][CoC] first.
7376
7477
[CoC]: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
75-
choices:
78+
options:
7679
- label: I agree to follow the PSF Code of Conduct
7780
required: true
7881
...

.pre-commit-config.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,12 @@ repos:
2323
exclude: |
2424
(?x)
2525
^docs/|
26-
^src/pip/_internal/cli|
2726
^src/pip/_internal/commands|
28-
^src/pip/_internal/distributions|
2927
^src/pip/_internal/index|
3028
^src/pip/_internal/models|
3129
^src/pip/_internal/network|
3230
^src/pip/_internal/operations|
3331
^src/pip/_internal/req|
34-
^src/pip/_internal/resolution|
35-
^src/pip/_internal/utils|
3632
^src/pip/_internal/vcs|
3733
^src/pip/_internal/\w+\.py$|
3834
^src/pip/__main__.py$|
@@ -47,7 +43,6 @@ repos:
4743
^tests/functional/test_install|
4844
# Files in the root of the repository
4945
^setup.py|
50-
^noxfile.py|
5146
# A blank ignore, to avoid merge conflicts later.
5247
^$
5348
@@ -74,6 +69,7 @@ repos:
7469
- id: mypy
7570
exclude: docs|tests
7671
args: ["--pretty"]
72+
additional_dependencies: ['nox==2020.12.31']
7773

7874
- repo: https://github.com/pre-commit/pygrep-hooks
7975
rev: v1.7.0

docs/docs_feedback_sphinxext.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
from __future__ import annotations
44

55
from itertools import chain
6-
from typing import TYPE_CHECKING
7-
8-
if TYPE_CHECKING:
9-
from typing import Dict, List, Union
10-
11-
from sphinx.application import Sphinx
6+
from typing import Dict, List, Union
127

8+
from sphinx.application import Sphinx
139

1410
DEFAULT_DOC_LINES_THRESHOLD = 250
1511
RST_INDENT = 4

docs/html/reference/pip_install.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,15 @@ You can install local projects by specifying the project path to pip:
808808
During regular installation, pip will copy the entire project directory to a
809809
temporary location and install from there. The exception is that pip will
810810
exclude .tox and .nox directories present in the top level of the project from
811-
being copied.
811+
being copied. This approach is the cause of several performance and correctness
812+
issues, so it is planned that pip 21.3 will change to install directly from the
813+
local project directory. Depending on the build backend used by the project,
814+
this may generate secondary build artifacts in the project directory, such as
815+
the ``.egg-info`` and ``build`` directories in the case of the setuptools
816+
backend.
817+
818+
To opt in to the future behavior, specify the ``--use-feature=in-tree-build``
819+
option in pip's command line.
812820

813821

814822
.. _`editable-installs`:

docs/pip_sphinxext.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ class PipOptions(rst.Directive):
5050

5151
def _format_option(self, option, cmd_name=None):
5252
bookmark_line = (
53-
".. _`{cmd_name}_{option._long_opts[0]}`:"
53+
f".. _`{cmd_name}_{option._long_opts[0]}`:"
5454
if cmd_name else
55-
".. _`{option._long_opts[0]}`:"
56-
).format(**locals())
55+
f".. _`{option._long_opts[0]}`:"
56+
)
5757
line = ".. option:: "
5858
if option._short_opts:
5959
line += option._short_opts[0]

news/0a741827-049c-4d5d-b44d-daea0c2fd01a.trivial.rst

Whitespace-only changes.

news/11e1b2eb-6433-4f15-b70d-c2c514f72ebd.trivial.rst

Whitespace-only changes.

news/151a1e46-d005-46ca-b1ae-a3811357dba3.trivial.rst

Whitespace-only changes.

news/40711960-12d9-4e58-8322-21e5975a804e.trivial.rst

Whitespace-only changes.

news/5be04056-e1d6-4f9a-bf46-8938d1936d9e.trivial.rst

Whitespace-only changes.

news/9091.feature.rst

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

news/917ab6ff-72ea-4db5-846a-30273dac1c0c.trivial.rst

Whitespace-only changes.

news/a06e528d-1172-4012-a0a5-0fc42264a70d.trivial.rst

Whitespace-only changes.

news/adba2b7a-af01-49c9-9b72-2d3d4a89b11a.trivial.rst

Whitespace-only changes.

news/d0935419-2486-45dc-b8dc-d2a5b9197ca4.trivial.rst

Whitespace-only changes.

news/dfaa54d4-21e2-460f-9d80-455ff318c713.trivial.rst

Whitespace-only changes.

news/fc6b6951-9a1a-453e-af98-bbb35f7c3e66.trivial.rst

Whitespace-only changes.

news/fd62a11c-018c-4fde-ac8d-f674c6d9d190.trivial.rst

Whitespace-only changes.

noxfile.py

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
"""Automation using nox.
22
"""
33

4-
# The following comment should be removed at some point in the future.
5-
# mypy: disallow-untyped-defs=False
6-
74
import glob
85
import os
96
import shutil
107
import sys
118
from pathlib import Path
9+
from typing import Iterator, List, Tuple
1210

1311
import nox
1412

13+
# fmt: off
1514
sys.path.append(".")
1615
from tools.automation import release # isort:skip # noqa
1716
sys.path.pop()
17+
# fmt: on
1818

1919
nox.options.reuse_existing_virtualenvs = True
2020
nox.options.sessions = ["lint"]
@@ -34,20 +34,22 @@
3434

3535

3636
def run_with_protected_pip(session, *arguments):
37+
# type: (nox.Session, *str) -> None
3738
"""Do a session.run("pip", *arguments), using a "protected" pip.
3839
3940
This invokes a wrapper script, that forwards calls to original virtualenv
4041
(stable) version, and not the code being tested. This ensures pip being
4142
used is not the code being tested.
4243
"""
43-
env = {"VIRTUAL_ENV": session.virtualenv.location}
44+
# https://github.com/theacodes/nox/pull/377
45+
env = {"VIRTUAL_ENV": session.virtualenv.location} # type: ignore
4446

4547
command = ("python", LOCATIONS["protected-pip"]) + arguments
46-
kwargs = {"env": env, "silent": True}
47-
session.run(*command, **kwargs)
48+
session.run(*command, env=env, silent=True)
4849

4950

5051
def should_update_common_wheels():
52+
# type: () -> bool
5153
# If the cache hasn't been created, create it.
5254
if not os.path.exists(LOCATIONS["common-wheels"]):
5355
return True
@@ -72,30 +74,34 @@ def should_update_common_wheels():
7274
# -----------------------------------------------------------------------------
7375
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "pypy3"])
7476
def test(session):
77+
# type: (nox.Session) -> None
7578
# Get the common wheels.
7679
if should_update_common_wheels():
80+
# fmt: off
7781
run_with_protected_pip(
7882
session,
7983
"wheel",
8084
"-w", LOCATIONS["common-wheels"],
8185
"-r", REQUIREMENTS["common-wheels"],
8286
)
87+
# fmt: on
8388
else:
84-
msg = (
85-
"Re-using existing common-wheels at {}."
86-
.format(LOCATIONS["common-wheels"])
87-
)
89+
msg = f"Re-using existing common-wheels at {LOCATIONS['common-wheels']}."
8890
session.log(msg)
8991

9092
# Build source distribution
91-
sdist_dir = os.path.join(session.virtualenv.location, "sdist")
93+
# https://github.com/theacodes/nox/pull/377
94+
sdist_dir = os.path.join(session.virtualenv.location, "sdist") # type: ignore
9295
if os.path.exists(sdist_dir):
9396
shutil.rmtree(sdist_dir, ignore_errors=True)
97+
98+
# fmt: off
9499
session.run(
95-
"python", "setup.py", "sdist",
96-
"--formats=zip", "--dist-dir", sdist_dir,
100+
"python", "setup.py", "sdist", "--formats=zip", "--dist-dir", sdist_dir,
97101
silent=True,
98102
)
103+
# fmt: on
104+
99105
generated_files = os.listdir(sdist_dir)
100106
assert len(generated_files) == 1
101107
generated_sdist = os.path.join(sdist_dir, generated_files[0])
@@ -117,14 +123,17 @@ def test(session):
117123

118124
@nox.session
119125
def docs(session):
126+
# type: (nox.Session) -> None
120127
session.install("-e", ".")
121128
session.install("-r", REQUIREMENTS["docs"])
122129

123130
def get_sphinx_build_command(kind):
131+
# type: (str) -> List[str]
124132
# Having the conf.py in the docs/html is weird but needed because we
125133
# can not use a different configuration directory vs source directory
126134
# on RTD currently. So, we'll pass "-c docs/html" here.
127135
# See https://github.com/rtfd/readthedocs.org/issues/1543.
136+
# fmt: off
128137
return [
129138
"sphinx-build",
130139
"-W",
@@ -134,13 +143,15 @@ def get_sphinx_build_command(kind):
134143
"docs/" + kind,
135144
"docs/build/" + kind,
136145
]
146+
# fmt: on
137147

138148
session.run(*get_sphinx_build_command("html"))
139149
session.run(*get_sphinx_build_command("man"))
140150

141151

142152
@nox.session
143153
def lint(session):
154+
# type: (nox.Session) -> None
144155
session.install("pre-commit")
145156

146157
if session.posargs:
@@ -154,18 +165,23 @@ def lint(session):
154165

155166
@nox.session
156167
def vendoring(session):
168+
# type: (nox.Session) -> None
157169
session.install("vendoring>=0.3.0")
158170

159171
if "--upgrade" not in session.posargs:
160172
session.run("vendoring", "sync", ".", "-v")
161173
return
162174

163175
def pinned_requirements(path):
164-
for line in path.read_text().splitlines():
165-
one, two = line.split("==", 1)
176+
# type: (Path) -> Iterator[Tuple[str, str]]
177+
for line in path.read_text().splitlines(keepends=False):
178+
one, sep, two = line.partition("==")
179+
if not sep:
180+
continue
166181
name = one.strip()
167-
version = two.split("#")[0].strip()
168-
yield name, version
182+
version = two.split("#", 1)[0].strip()
183+
if name and version:
184+
yield name, version
169185

170186
vendor_txt = Path("src/pip/_vendor/vendor.txt")
171187
for name, old_version in pinned_requirements(vendor_txt):
@@ -208,6 +224,7 @@ def pinned_requirements(path):
208224
# -----------------------------------------------------------------------------
209225
@nox.session(name="prepare-release")
210226
def prepare_release(session):
227+
# type: (nox.Session) -> None
211228
version = release.get_version_from_arguments(session)
212229
if not version:
213230
session.error("Usage: nox -s prepare-release -- <version>")
@@ -219,9 +236,7 @@ def prepare_release(session):
219236
session.log(f"# Updating {AUTHORS_FILE}")
220237
release.generate_authors(AUTHORS_FILE)
221238
if release.modified_files_in_git():
222-
release.commit_file(
223-
session, AUTHORS_FILE, message=f"Update {AUTHORS_FILE}",
224-
)
239+
release.commit_file(session, AUTHORS_FILE, message=f"Update {AUTHORS_FILE}")
225240
else:
226241
session.log(f"# No changes to {AUTHORS_FILE}")
227242

@@ -243,6 +258,7 @@ def prepare_release(session):
243258

244259
@nox.session(name="build-release")
245260
def build_release(session):
261+
# type: (nox.Session) -> None
246262
version = release.get_version_from_arguments(session)
247263
if not version:
248264
session.error("Usage: nox -s build-release -- YY.N[.P]")
@@ -267,21 +283,22 @@ def build_release(session):
267283

268284
tmp_dist_paths = (build_dir / p for p in tmp_dists)
269285
session.log(f"# Copying dists from {build_dir}")
270-
os.makedirs('dist', exist_ok=True)
286+
os.makedirs("dist", exist_ok=True)
271287
for dist, final in zip(tmp_dist_paths, tmp_dists):
272288
session.log(f"# Copying {dist} to {final}")
273289
shutil.copy(dist, final)
274290

275291

276292
def build_dists(session):
293+
# type: (nox.Session) -> List[str]
277294
"""Return dists with valid metadata."""
278295
session.log(
279296
"# Check if there's any Git-untracked files before building the wheel",
280297
)
281298

282299
has_forbidden_git_untracked_files = any(
283300
# Don't report the environment this session is running in
284-
not untracked_file.startswith('.nox/build-release/')
301+
not untracked_file.startswith(".nox/build-release/")
285302
for untracked_file in release.get_git_untracked_files()
286303
)
287304
if has_forbidden_git_untracked_files:
@@ -302,6 +319,7 @@ def build_dists(session):
302319

303320
@nox.session(name="upload-release")
304321
def upload_release(session):
322+
# type: (nox.Session) -> None
305323
version = release.get_version_from_arguments(session)
306324
if not version:
307325
session.error("Usage: nox -s upload-release -- YY.N[.P]")
@@ -320,15 +338,13 @@ def upload_release(session):
320338
f"Remove dist/ and run 'nox -s build-release -- {version}'"
321339
)
322340
# Sanity check: Make sure the files are correctly named.
323-
distfile_names = map(os.path.basename, distribution_files)
341+
distfile_names = (os.path.basename(fn) for fn in distribution_files)
324342
expected_distribution_files = [
325343
f"pip-{version}-py3-none-any.whl",
326344
f"pip-{version}.tar.gz",
327345
]
328346
if sorted(distfile_names) != sorted(expected_distribution_files):
329-
session.error(
330-
f"Distribution files do not seem to be for {version} release."
331-
)
347+
session.error(f"Distribution files do not seem to be for {version} release.")
332348

333349
session.log("# Upload distributions")
334350
session.run("twine", "upload", *distribution_files)

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ per-file-ignores =
3131
tests/*: B011
3232

3333
[mypy]
34-
follow_imports = silent
3534
ignore_missing_imports = True
3635
disallow_untyped_defs = True
3736
disallow_any_generics = True

setup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
# The following comment should be removed at some point in the future.
2-
# mypy: disallow-untyped-defs=False
3-
41
import os
52
import sys
63

74
from setuptools import find_packages, setup
85

96

107
def read(rel_path):
8+
# type: (str) -> str
119
here = os.path.abspath(os.path.dirname(__file__))
1210
# intentionally *not* adding an encoding option to open, See:
1311
# https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
14-
with open(os.path.join(here, rel_path), 'r') as fp:
12+
with open(os.path.join(here, rel_path)) as fp:
1513
return fp.read()
1614

1715

1816
def get_version(rel_path):
17+
# type: (str) -> str
1918
for line in read(rel_path).splitlines():
2019
if line.startswith('__version__'):
2120
# __version__ = "0.9"

0 commit comments

Comments
 (0)