Skip to content

Commit ac51fa4

Browse files
committed
freeze: make --all the default & deprecate it
1 parent 031c34e commit ac51fa4

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
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: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
from pip._internal.utils.compat import stdlib_pkgs
1010
from pip._internal.utils.deprecation import deprecated
1111

12-
DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel'}
13-
1412

1513
class FreezeCommand(Command):
1614
"""
@@ -58,10 +56,9 @@ def add_options(self):
5856
self.cmd_opts.add_option(cmdoptions.list_path())
5957
self.cmd_opts.add_option(
6058
'--all',
61-
dest='freeze_all',
59+
dest='freeze_all_used',
6260
action='store_true',
63-
help='Do not skip these packages in the output:'
64-
' {}'.format(', '.join(DEV_PKGS)))
61+
help='Deprecated - Does nothing.')
6562
self.cmd_opts.add_option(
6663
'--exclude-editable',
6764
dest='exclude_editable',
@@ -74,8 +71,13 @@ def add_options(self):
7471
def run(self, options, args):
7572
# type: (Values, List[str]) -> int
7673
skip = set(stdlib_pkgs)
77-
if not options.freeze_all:
78-
skip.update(DEV_PKGS)
74+
75+
if options.freeze_all_used:
76+
deprecated(
77+
"--all is now the default behavior and does nothing",
78+
None,
79+
gone_in="23.3",
80+
)
7981

8082
if options.excludes:
8183
skip.update(options.excludes)

tests/functional/test_freeze.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_basic_freeze(script):
7979

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

8585

@@ -93,13 +93,10 @@ def test_exclude_and_normalization(script, tmpdir):
9393
assert "Normalizable-Name" not in result.stdout
9494

9595

96-
def test_freeze_multiple_exclude_with_all(script, with_wheel):
97-
result = script.pip('freeze', '--all')
98-
assert 'pip==' in result.stdout
99-
assert 'wheel==' in result.stdout
100-
result = script.pip('freeze', '--all', '--exclude', 'pip', '--exclude', 'wheel')
101-
assert 'pip==' not in result.stdout
102-
assert 'wheel==' not in result.stdout
96+
def test_freeze_all_deprecated(script):
97+
"""Test that using --all option produces a warning"""
98+
result = script.pip('freeze', '--all', expect_stderr=True)
99+
assert '--all is now the default behavior and does nothing' in result.stderr
103100

104101

105102
def test_freeze_with_invalid_names(script):

0 commit comments

Comments
 (0)