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

Remove --no-python-version-warning as Python 2 is dead #13180

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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/13154.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove the ``no-python-version-warning`` flag as it was a relic of the Python
2 sunset transition.
9 changes: 0 additions & 9 deletions src/pip/_internal/cli/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
NetworkConnectionError,
PreviousBuildDirError,
)
from pip._internal.utils.deprecation import deprecated
from pip._internal.utils.filesystem import check_path_owner
from pip._internal.utils.logging import BrokenStdoutLoggingError, setup_logging
from pip._internal.utils.misc import get_prog, normalize_path
Expand Down Expand Up @@ -229,12 +228,4 @@ def _main(self, args: List[str]) -> int:
)
options.cache_dir = None

if options.no_python_version_warning:
deprecated(
reason="--no-python-version-warning is deprecated.",
replacement="to remove the flag as it's a no-op",
gone_in="25.1",
issue=13154,
)

return self._run_wrapper(level_number, options, args)
12 changes: 0 additions & 12 deletions src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,17 +983,6 @@ def check_list_path_option(options: Values) -> None:
help="Exclude specified package from the output",
)


no_python_version_warning: Callable[..., Option] = partial(
Option,
"--no-python-version-warning",
dest="no_python_version_warning",
action="store_true",
default=False,
help="Silence deprecation warnings for upcoming unsupported Pythons.",
)


# Features that are now always on. A warning is printed if they are used.
ALWAYS_ENABLED_FEATURES = [
"truststore", # always on since 24.2
Expand Down Expand Up @@ -1058,7 +1047,6 @@ def check_list_path_option(options: Values) -> None:
no_cache,
disable_pip_version_check,
no_color,
no_python_version_warning,
use_new_feature,
use_deprecated_feature,
],
Expand Down
18 changes: 0 additions & 18 deletions tests/functional/test_warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,6 @@ def test_deprecation_warnings_can_be_silenced(
assert result.stderr == ""


DEPRECATION_TEXT = "drop support for Python 2.7"
CPYTHON_DEPRECATION_TEXT = "January 1st, 2020"


def test_version_warning_is_not_shown_if_python_version_is_not_2(
script: PipTestEnvironment,
) -> None:
result = script.pip("debug", allow_stderr_warning=True)
assert DEPRECATION_TEXT not in result.stderr, str(result)
assert CPYTHON_DEPRECATION_TEXT not in result.stderr, str(result)


def test_flag_does_nothing_if_python_version_is_not_2(
script: PipTestEnvironment,
) -> None:
script.pip("list", "--no-python-version-warning")


@pytest.mark.skipif(
sys.version_info >= (3, 10), reason="distutils is deprecated in 3.10+"
)
Expand Down
Loading