mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Don't exclude setuptools, distribute & wheel from freeze output on Python 3.12+
Due to the advent of build isolation, it is no longer necessary to install setuptools and wheel in an environment just to install other packages. Moreover, on Python 3.12 both ensurepip [1] and virtualenv [2] are to stop installing setuptools & wheel by default. This means that when those packages are present in a Python 3.12+ environment, it is reasonable to assume that they are runtime dependencies of the user's project, and therefore should be included in freeze output. distribute is just obsolete. [1] https://github.com/python/cpython/issues/95299 [2] https://github.com/pypa/virtualenv/pull/2558
This commit is contained in:
parent
4734c4c735
commit
5dc65eabb7
3
news/4256.removal.rst
Normal file
3
news/4256.removal.rst
Normal file
|
@ -0,0 +1,3 @@
|
|||
``freeze`` no longer excludes the ``setuptools``, ``distribute`` and ``wheel``
|
||||
packages from the output by default when running on Python 3.12 or later.
|
||||
Use ``--exclude`` if you wish to exclude any of these packages.
|
|
@ -8,7 +8,10 @@ from pip._internal.cli.status_codes import SUCCESS
|
|||
from pip._internal.operations.freeze import freeze
|
||||
from pip._internal.utils.compat import stdlib_pkgs
|
||||
|
||||
DEV_PKGS = {"pip", "setuptools", "distribute", "wheel"}
|
||||
DEV_PKGS = {"pip"}
|
||||
|
||||
if sys.version_info < (3, 12):
|
||||
DEV_PKGS |= {"setuptools", "distribute", "wheel"}
|
||||
|
||||
|
||||
class FreezeCommand(Command):
|
||||
|
|
|
@ -88,11 +88,29 @@ def test_basic_freeze(script: PipTestEnvironment) -> None:
|
|||
|
||||
|
||||
def test_freeze_with_pip(script: PipTestEnvironment) -> None:
|
||||
"""Test pip shows itself"""
|
||||
"""Test that pip shows itself only when --all is used"""
|
||||
result = script.pip("freeze")
|
||||
assert "pip==" not in result.stdout
|
||||
result = script.pip("freeze", "--all")
|
||||
assert "pip==" in result.stdout
|
||||
|
||||
|
||||
def test_freeze_with_setuptools(script: PipTestEnvironment) -> None:
|
||||
"""
|
||||
Test that pip shows setuptools only when --all is used
|
||||
or Python version is >=3.12
|
||||
"""
|
||||
|
||||
result = script.pip("freeze")
|
||||
if sys.version_info >= (3, 12):
|
||||
assert "setuptools==" in result.stdout
|
||||
else:
|
||||
assert "setuptools==" not in result.stdout
|
||||
|
||||
result = script.pip("freeze", "--all")
|
||||
assert "setuptools==" in result.stdout
|
||||
|
||||
|
||||
def test_exclude_and_normalization(script: PipTestEnvironment, tmpdir: Path) -> None:
|
||||
req_path = wheel.make_wheel(name="Normalizable_Name", version="1.0").save_to_dir(
|
||||
tmpdir
|
||||
|
|
Loading…
Reference in a new issue