Skip to content

Commit c178119

Browse files
committed
freeze: make --all the default & deprecate it
1 parent 8ae1bd6 commit c178119

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

news/4256.removal.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Stop filtering the ``pip``, ``setuptools``, ``distribute`` and ``wheel`` packages from ``pip freeze``.
2+
The equivalent option ``--all`` is now deprecated and does nothing.

src/pip/_internal/commands/freeze.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
from pip._internal.models.format_control import FormatControl
1010
from pip._internal.operations.freeze import freeze
1111
from pip._internal.utils.compat import stdlib_pkgs
12+
from pip._internal.utils.deprecation import deprecated
1213
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
1314

14-
DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel'}
15-
1615
if MYPY_CHECK_RUNNING:
1716
from optparse import Values
1817
from typing import List
@@ -64,10 +63,9 @@ def add_options(self):
6463
self.cmd_opts.add_option(cmdoptions.list_path())
6564
self.cmd_opts.add_option(
6665
'--all',
67-
dest='freeze_all',
66+
dest='freeze_all_used',
6867
action='store_true',
69-
help='Do not skip these packages in the output:'
70-
' {}'.format(', '.join(DEV_PKGS)))
68+
help='Deprecated - Does nothing.')
7169
self.cmd_opts.add_option(
7270
'--exclude-editable',
7371
dest='exclude_editable',
@@ -80,9 +78,12 @@ def run(self, options, args):
8078
# type: (Values, List[str]) -> int
8179
format_control = FormatControl(set(), set())
8280
wheel_cache = WheelCache(options.cache_dir, format_control)
83-
skip = set(stdlib_pkgs)
84-
if not options.freeze_all:
85-
skip.update(DEV_PKGS)
81+
if options.freeze_all_used:
82+
deprecated(
83+
"--all is now the default behavior and does nothing",
84+
None,
85+
gone_in="23.3",
86+
)
8687

8788
cmdoptions.check_list_path_option(options)
8889

@@ -94,7 +95,7 @@ def run(self, options, args):
9495
paths=options.path,
9596
isolated=options.isolated_mode,
9697
wheel_cache=wheel_cache,
97-
skip=skip,
98+
skip=set(stdlib_pkgs),
9899
exclude_editable=options.exclude_editable,
99100
)
100101

tests/functional/test_freeze.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,16 @@ def test_basic_freeze(script):
7676

7777
def test_freeze_with_pip(script):
7878
"""Test pip shows itself"""
79-
result = script.pip('freeze', '--all')
79+
result = script.pip('freeze')
8080
assert 'pip==' in result.stdout
8181

8282

83+
def test_freeze_all_deprecated(script):
84+
"""Test that using --all option produces a warning"""
85+
result = script.pip('freeze', '--all', expect_stderr=True)
86+
assert '--all is now the default behavior and does nothing' in result.stderr
87+
88+
8389
def test_freeze_with_invalid_names(script):
8490
"""
8591
Test that invalid names produce warnings and are passed over gracefully.

0 commit comments

Comments
 (0)