From d18fca10cc5b4c597cf2c8488be4e7b1d4968355 Mon Sep 17 00:00:00 2001 From: Richard Si Date: Sun, 12 Jan 2025 00:25:33 -0500 Subject: [PATCH] Deprecate Python 2 relic --no-python-version-warning --- news/13154.removal.rst | 2 ++ src/pip/_internal/cli/base_command.py | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 news/13154.removal.rst diff --git a/news/13154.removal.rst b/news/13154.removal.rst new file mode 100644 index 00000000000..c41e92bf1f7 --- /dev/null +++ b/news/13154.removal.rst @@ -0,0 +1,2 @@ +Deprecate the ``no-python-version-warning`` flag as it has long done nothing +since Python 2 support was removed in pip 21.0. diff --git a/src/pip/_internal/cli/base_command.py b/src/pip/_internal/cli/base_command.py index bc1ab65949d..5d69fcefc25 100644 --- a/src/pip/_internal/cli/base_command.py +++ b/src/pip/_internal/cli/base_command.py @@ -29,6 +29,7 @@ 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 @@ -228,4 +229,12 @@ def _main(self, args: List[str]) -> int: ) options.cache_dir = None + if options.no_python_version_warning: + deprecated( + reason="--no-python-verison-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)