Skip to content

Commit 60bcaeb

Browse files
committed
Remove --no-python-version-warning as Python 2 is dead
1 parent 984c399 commit 60bcaeb

File tree

4 files changed

+2
-39
lines changed

4 files changed

+2
-39
lines changed

news/13154.removal.rst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove the ``no-python-version-warning`` flag as it was a relic of the Python
2+
2 sunset transition.

src/pip/_internal/cli/base_command.py

-9
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
NetworkConnectionError,
3030
PreviousBuildDirError,
3131
)
32-
from pip._internal.utils.deprecation import deprecated
3332
from pip._internal.utils.filesystem import check_path_owner
3433
from pip._internal.utils.logging import BrokenStdoutLoggingError, setup_logging
3534
from pip._internal.utils.misc import get_prog, normalize_path
@@ -229,12 +228,4 @@ def _main(self, args: List[str]) -> int:
229228
)
230229
options.cache_dir = None
231230

232-
if options.no_python_version_warning:
233-
deprecated(
234-
reason="--no-python-version-warning is deprecated.",
235-
replacement="to remove the flag as it's a no-op",
236-
gone_in="25.1",
237-
issue=13154,
238-
)
239-
240231
return self._run_wrapper(level_number, options, args)

src/pip/_internal/cli/cmdoptions.py

-12
Original file line numberDiff line numberDiff line change
@@ -983,17 +983,6 @@ def check_list_path_option(options: Values) -> None:
983983
help="Exclude specified package from the output",
984984
)
985985

986-
987-
no_python_version_warning: Callable[..., Option] = partial(
988-
Option,
989-
"--no-python-version-warning",
990-
dest="no_python_version_warning",
991-
action="store_true",
992-
default=False,
993-
help="Silence deprecation warnings for upcoming unsupported Pythons.",
994-
)
995-
996-
997986
# Features that are now always on. A warning is printed if they are used.
998987
ALWAYS_ENABLED_FEATURES = [
999988
"truststore", # always on since 24.2
@@ -1058,7 +1047,6 @@ def check_list_path_option(options: Values) -> None:
10581047
no_cache,
10591048
disable_pip_version_check,
10601049
no_color,
1061-
no_python_version_warning,
10621050
use_new_feature,
10631051
use_deprecated_feature,
10641052
],

tests/functional/test_warning.py

-18
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,6 @@ def test_deprecation_warnings_can_be_silenced(
4343
assert result.stderr == ""
4444

4545

46-
DEPRECATION_TEXT = "drop support for Python 2.7"
47-
CPYTHON_DEPRECATION_TEXT = "January 1st, 2020"
48-
49-
50-
def test_version_warning_is_not_shown_if_python_version_is_not_2(
51-
script: PipTestEnvironment,
52-
) -> None:
53-
result = script.pip("debug", allow_stderr_warning=True)
54-
assert DEPRECATION_TEXT not in result.stderr, str(result)
55-
assert CPYTHON_DEPRECATION_TEXT not in result.stderr, str(result)
56-
57-
58-
def test_flag_does_nothing_if_python_version_is_not_2(
59-
script: PipTestEnvironment,
60-
) -> None:
61-
script.pip("list", "--no-python-version-warning")
62-
63-
6446
@pytest.mark.skipif(
6547
sys.version_info >= (3, 10), reason="distutils is deprecated in 3.10+"
6648
)

0 commit comments

Comments
 (0)