Skip to content

Commit e0151a2

Browse files
gvanrossumJukkaL
authored andcommitted
Make --use-mypy-path always print an error. Fixes #1411. (#1413)
1 parent 559ed14 commit e0151a2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mypy/main.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def parse_version(v):
155155
help="don't warn if typeshed is out of sync")
156156
parser.add_argument('--pdb', action='store_true', help="invoke pdb on fatal error")
157157
parser.add_argument('--use-python-path', action='store_true',
158-
help="search for modules in sys.path of running Python")
158+
help="an anti-pattern")
159159
parser.add_argument('--stats', action='store_true', help="dump stats")
160160
parser.add_argument('--inferstats', action='store_true', help="dump type inference stats")
161161
parser.add_argument('--custom-typing', metavar='MODULE', help="use a custom typing module")
@@ -180,6 +180,14 @@ def parse_version(v):
180180

181181
args = parser.parse_args()
182182

183+
# --use-python-path is no longer supported; explain why.
184+
if args.use_python_path:
185+
parser.error("Sorry, --use-python-path is no longer supported.\n"
186+
"If you are trying this because your code depends on a library module,\n"
187+
"you should really investigate how to obtain stubs for that module.\n"
188+
"See https://github.com/python/mypy/issues/1411 for more discussion."
189+
)
190+
183191
# Check for invalid argument combinations.
184192
code_methods = sum(bool(c) for c in [args.modules, args.command, args.package, args.files])
185193
if code_methods == 0:

0 commit comments

Comments
 (0)