Skip to content

Fix calculation of PipProvider._known_depths #10438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9e88e87
Replace assert_raises_regexp function with pytest.raises
jdufresne Aug 29, 2021
a4cb77f
Update links of setuptools
dukecat0 Sep 4, 2021
1f817dc
Update a link of setuptools
dukecat0 Sep 4, 2021
95145c1
Fix known depths
notatallshaw Sep 4, 2021
d925e24
Link to PyPUG instead of Setuptools
dukecat0 Sep 5, 2021
8d4e075
Add news fragment
dukecat0 Sep 5, 2021
5144fbf
Add more information
dukecat0 Sep 5, 2021
c5a1048
Fix linting error
dukecat0 Sep 5, 2021
ca724ef
Fix known depths
notatallshaw Sep 4, 2021
389c6dc
Merge branch 'fix_known_depths' of https://github.com/notatallshaw/pi…
notatallshaw Sep 5, 2021
8c5d355
Fix failing test due to removed setuptools feature, use_2to3
jdufresne Sep 8, 2021
1ca0807
Merge pull request #10430 from meowmeowmeowcat/patch-1
uranusjr Sep 10, 2021
48dc9f4
Merge pull request #10447 from jdufresne/fix-test-fail
uranusjr Sep 10, 2021
a4f483e
Handle TODO comment in tests/functional/test_new_resolver.py
jdufresne Sep 10, 2021
5c61694
Remove unused class TestUpgradeDistributeToSetuptools
jdufresne Sep 8, 2021
f5e4b61
Merge pull request #10413 from jdufresne/raises
pradyunsg Sep 12, 2021
57ce346
Merge pull request #10457 from jdufresne/assert-todo
pradyunsg Sep 12, 2021
3b8113d
Bump to vendoring 1.0.x
pradyunsg Sep 11, 2021
dcbaa1d
Merge pull request #10466 from pradyunsg/vendoring-upgrade
pradyunsg Sep 13, 2021
58f1cda
Fix known depths
notatallshaw Sep 4, 2021
eab9ccf
Merge branch 'fix_known_depths' of https://github.com/notatallshaw/pi…
notatallshaw Sep 13, 2021
e37ad39
Simplify vendoring configuration
jdufresne Sep 14, 2021
a05e299
Merge pull request #10469 from jdufresne/vendored
pradyunsg Sep 14, 2021
0de0b8d
Merge pull request #10448 from jdufresne/unused-test-class
uranusjr Sep 15, 2021
502c3fb
Merge branch 'fix_known_depths' of https://github.com/notatallshaw/pi…
notatallshaw Sep 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/html/cli/pip_install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ Finding Packages

pip searches for packages on `PyPI`_ using the
`HTTP simple interface <https://pypi.org/simple/>`_,
which is documented `here <https://setuptools.readthedocs.io/en/latest/easy_install.html#package-index-api>`_
which is documented `here <https://packaging.python.org/specifications/simple-repository-api/>`_
and `there <https://www.python.org/dev/peps/pep-0503/>`_.

pip offers a number of package index options for modifying how packages are
Expand Down Expand Up @@ -620,7 +620,7 @@ option in pip's command line.
^^^^^^^^^^^^^^^^^^^

"Editable" installs are fundamentally `"setuptools develop mode"
<https://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode>`_
<https://setuptools.readthedocs.io/en/latest/userguide/development_mode.html>`_
installs.

You can install local projects or VCS projects in "editable" mode:
Expand Down Expand Up @@ -653,7 +653,7 @@ Controlling setup_requires
--------------------------

Setuptools offers the ``setup_requires`` `setup() keyword
<https://setuptools.readthedocs.io/en/latest/setuptools.html#new-and-changed-setup-keywords>`_
<https://setuptools.readthedocs.io/en/latest/userguide/keywords.html>`_
for specifying dependencies that need to be present in order for the
``setup.py`` script to run. Internally, Setuptools uses ``easy_install``
to fulfill these dependencies.
Expand Down Expand Up @@ -693,7 +693,7 @@ the following commands::

The ``egg_info`` command should create egg metadata for the package, as
described in the setuptools documentation at
https://setuptools.readthedocs.io/en/latest/setuptools.html#egg-info-create-egg-metadata-and-set-build-tags
https://setuptools.readthedocs.io/en/latest/userguide/commands.html#egg-info-create-egg-metadata-and-set-build-tags

The ``install`` command should implement the complete process of installing the
package to the target directory XXX.
Expand Down
2 changes: 1 addition & 1 deletion docs/html/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ In practice, there are 4 common uses of Requirements files:

It's important to be clear that pip determines package dependencies using
`install_requires metadata
<https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-dependencies>`_,
<https://setuptools.readthedocs.io/en/latest/userguide/dependency_management.html>`_,
not by discovering ``requirements.txt`` files embedded in projects.

See also:
Expand Down
1 change: 1 addition & 0 deletions news/10430.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update links of setuptools as setuptools moved these documents. The Simple Repository link now points to PyPUG as that is the canonical place of packaging specification, and setuptools's ``easy_install`` is deprecated.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def lint(session: nox.Session) -> None:

@nox.session
def vendoring(session: nox.Session) -> None:
session.install("vendoring>=0.3.0")
session.install("vendoring~=1.0.0")

if "--upgrade" not in session.posargs:
session.run("vendoring", "sync", ".", "-v")
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ distro = []

[tool.vendoring.license.directories]
setuptools = "pkg_resources"
msgpack-python = "msgpack"

[tool.vendoring.license.fallback-urls]
pytoml = "https://github.com/avakar/pytoml/raw/master/LICENSE"
resolvelib = "https://github.com/sarugaku/resolvelib/raw/master/LICENSE"
webencodings = "https://github.com/SimonSapin/python-webencodings/raw/master/LICENSE"
2 changes: 1 addition & 1 deletion src/pip/_internal/resolution/resolvelib/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def get_preference(
for _, parent in information[identifier]
)
inferred_depth = min(d for d in parent_depths) + 1.0
self._known_depths[identifier] = inferred_depth
else:
inferred_depth = 1.0
self._known_depths[identifier] = inferred_depth

requested_order = self._user_requested.get(identifier, math.inf)

Expand Down
1 change: 0 additions & 1 deletion src/pip/_vendor/idna.pyi

This file was deleted.

1 change: 0 additions & 1 deletion src/pip/_vendor/packaging.pyi

This file was deleted.

1 change: 0 additions & 1 deletion src/pip/_vendor/resolvelib.pyi

This file was deleted.

1 change: 0 additions & 1 deletion src/pip/_vendor/tenacity.pyi

This file was deleted.

1 change: 0 additions & 1 deletion src/pip/_vendor/tomli.pyi

This file was deleted.

4 changes: 2 additions & 2 deletions src/pip/_vendor/urllib3/contrib/pyopenssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
.. code-block:: python

try:
import urllib3.contrib.pyopenssl
urllib3.contrib.pyopenssl.inject_into_urllib3()
import pip._vendor.urllib3.contrib.pyopenssl as pyopenssl
pyopenssl.inject_into_urllib3()
except ImportError:
pass

Expand Down
4 changes: 2 additions & 2 deletions src/pip/_vendor/urllib3/contrib/securetransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

To use this module, simply import and inject it::

import urllib3.contrib.securetransport
urllib3.contrib.securetransport.inject_into_urllib3()
import pip._vendor.urllib3.contrib.securetransport as securetransport
securetransport.inject_into_urllib3()

Happy TLSing!

Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_install_reqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_requirements_file(script, with_wheel):
Test installing from a requirements file.

"""
other_lib_name, other_lib_version = "anyjson", "0.3"
other_lib_name, other_lib_version = "peppercorn", "0.6"
script.scratch_path.joinpath("initools-req.txt").write_text(
textwrap.dedent(
f"""\
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_multiple_requirements_files(script, tmpdir, with_wheel):
Test installing from multiple nested requirements files.

"""
other_lib_name, other_lib_version = "anyjson", "0.3"
other_lib_name, other_lib_version = "six", "1.16.0"
script.scratch_path.joinpath("initools-req.txt").write_text(
textwrap.dedent(
"""
Expand Down
49 changes: 0 additions & 49 deletions tests/functional/test_install_upgrade.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import itertools
import os
import sys
import textwrap

import pytest
Expand Down Expand Up @@ -352,54 +351,6 @@ def test_upgrade_vcs_req_with_dist_found(script):
assert "pypi.org" not in result.stdout, result.stdout


class TestUpgradeDistributeToSetuptools:
"""
From pip1.4 to pip6, pip supported a set of "hacks" (see Issue #1122) to
allow distribute to conflict with setuptools, so that the following would
work to upgrade distribute:

``pip install -U setuptools``

In pip7, the hacks were removed. This test remains to at least confirm pip
can upgrade distribute to setuptools using:

``pip install -U distribute``

The reason this works is that a final version of distribute (v0.7.3) was
released that is simple wrapper with:

install_requires=['setuptools>=0.7']

The test use a fixed set of packages from our test packages dir. Note that
virtualenv-1.9.1 contains distribute-0.6.34 and virtualenv-1.10 contains
setuptools-0.9.7
"""

def prep_ve(self, script, version, pip_src, distribute=False):
self.script = script
self.script.pip_install_local(f"virtualenv=={version}")
args = ["virtualenv", self.script.scratch_path / "VE"]
if distribute:
args.insert(1, "--distribute")
if version == "1.9.1" and not distribute:
# setuptools 0.6 didn't support PYTHONDONTWRITEBYTECODE
del self.script.environ["PYTHONDONTWRITEBYTECODE"]
self.script.run(*args)
if sys.platform == "win32":
bindir = "Scripts"
else:
bindir = "bin"
self.ve_bin = self.script.scratch_path / "VE" / bindir
self.script.run(self.ve_bin / "pip", "uninstall", "-y", "pip")
self.script.run(
self.ve_bin / "python",
"setup.py",
"install",
cwd=pip_src,
expect_stderr=True,
)


@pytest.mark.parametrize(
"req1, req2",
list(
Expand Down
Loading