Skip to content

Commit

Permalink
freeze: make --all the default & deprecate it
Browse files Browse the repository at this point in the history
  • Loading branch information
xavfernandez committed Mar 6, 2021
1 parent 031c34e commit ac51fa4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
2 changes: 2 additions & 0 deletions news/4256.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Stop filtering the ``pip``, ``setuptools``, ``distribute`` and ``wheel`` packages from ``pip freeze``.
The equivalent option ``--all`` is now deprecated and does nothing.
16 changes: 9 additions & 7 deletions src/pip/_internal/commands/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from pip._internal.utils.compat import stdlib_pkgs
from pip._internal.utils.deprecation import deprecated

DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel'}


class FreezeCommand(Command):
"""
Expand Down Expand Up @@ -58,10 +56,9 @@ def add_options(self):
self.cmd_opts.add_option(cmdoptions.list_path())
self.cmd_opts.add_option(
'--all',
dest='freeze_all',
dest='freeze_all_used',
action='store_true',
help='Do not skip these packages in the output:'
' {}'.format(', '.join(DEV_PKGS)))
help='Deprecated - Does nothing.')
self.cmd_opts.add_option(
'--exclude-editable',
dest='exclude_editable',
Expand All @@ -74,8 +71,13 @@ def add_options(self):
def run(self, options, args):
# type: (Values, List[str]) -> int
skip = set(stdlib_pkgs)
if not options.freeze_all:
skip.update(DEV_PKGS)

if options.freeze_all_used:
deprecated(
"--all is now the default behavior and does nothing",
None,
gone_in="23.3",
)

if options.excludes:
skip.update(options.excludes)
Expand Down
13 changes: 5 additions & 8 deletions tests/functional/test_freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_basic_freeze(script):

def test_freeze_with_pip(script):
"""Test pip shows itself"""
result = script.pip('freeze', '--all')
result = script.pip('freeze')
assert 'pip==' in result.stdout


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


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


def test_freeze_with_invalid_names(script):
Expand Down

0 comments on commit ac51fa4

Please sign in to comment.