Skip to content
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

freeze: make --all the default & deprecate it #9068

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
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",
pradyunsg marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gone_in="23.3",
gone_in="23.0",

Let's keep this for as little time as possible?

)

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