Skip to content

Commit 4428130

Browse files
committed
Suppress pkg_resources deprecation warning
1 parent f1a7a6f commit 4428130

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/pip/_internal/cli/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
import os
66
import sys
7+
import warnings
78
from typing import List, Optional
89

910
from pip._internal.cli.autocompletion import autocomplete
@@ -46,6 +47,14 @@ def main(args: Optional[List[str]] = None) -> int:
4647
if args is None:
4748
args = sys.argv[1:]
4849

50+
# Suppress the pkg_resources deprecation warning
51+
# Note - we use a module of .*pkg_resources to cover
52+
# the normal case (pip._vendor.pkg_resources) and the
53+
# devendored case (a bare pkg_resources)
54+
warnings.filterwarnings(
55+
action="ignore", category=DeprecationWarning, module=".*pkg_resources"
56+
)
57+
4958
# Configure our deprecation warnings to be sent through loggers
5059
deprecation.install_warning_logger()
5160

0 commit comments

Comments
 (0)