diff --git a/mypy.ini b/mypy.ini index 8b2d4388e6..062fa3ce89 100644 --- a/mypy.ini +++ b/mypy.ini @@ -14,19 +14,10 @@ disallow_any_generics = True warn_no_return = True no_implicit_optional = True -# The mypy daemon requires using local_partial_types. -local_partial_types = True - # It's useful to try this occasionally, and keep it clean; but when # someone fixes a type error we don't want to add a burden for them. #warn_unused_ignores = True -# Error on importing modules that are present but not part of the -# build. If the module can't reasonably be made to not error, errors -# can be suppressed with ignore_errors. -# (The mypy daemon only supports error and skip for follow_imports) -follow_imports = error - # We use a lot of third-party libraries we don't have stubs for, as # well as a handful of our own modules that we haven't told mypy how # to find. Ignore them. (For some details, see: @@ -60,49 +51,6 @@ ignore_errors = True ignore_errors = True -# -# -# SKIP IMPORTS -# -# - -[mypy-zulip] -# mypy is finding this module in the virtualenv. We should tell it -# about it on the command line; until we do, everything imported from -# it gets treated as Any, and we have to acknowledge it here. -# -# (The mypy daemon insists that everything it checks, it's told about -# in advance, which means setting follow_imports to either `skip` or -# `error`. Our global setting of `error` gets us an error if there's -# something it *could* check, because it can find the file, but we -# haven't told it to.) -follow_imports = skip - -[mypy-zulint] -follow_imports = skip - -[mypy-zulint.command] -follow_imports = skip - -[mypy-zulint.custom_rules] -follow_imports = skip - -[mypy-zulint.linters] -follow_imports = skip - -[mypy-zulint.lister] -follow_imports = skip - -[mypy-zulint.printer] -follow_imports = skip - -[mypy-zulip_bots.custom_exceptions] -follow_imports = skip - -[mypy-zulip_bots.lib] -follow_imports = skip - - # # # STRICT OPTIONAL diff --git a/tools/ci/backend b/tools/ci/backend index e180cf3343..91005d5e86 100755 --- a/tools/ci/backend +++ b/tools/ci/backend @@ -18,7 +18,8 @@ set -x # backend tests, which tend to uncover more serious problems, first. ./tools/run-mypy --version # We run mypy without daemon mode, since that's faster given that -# we're only going to run it once. +# we're only going to run it once, and catches more errors since +# daemon mode doesn't follow package imports. ./tools/run-mypy --no-daemon ./tools/test-migrations diff --git a/tools/run-mypy b/tools/run-mypy index 062f7c157b..975ea6888b 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -78,6 +78,7 @@ mypy_args = extra_args + python_files + pyi_files if args.no_daemon: rc = subprocess.call([mypy_command] + mypy_args) else: + mypy_args += ["--follow-imports=skip"] rc = subprocess.call([mypy_command, "status"], stdout=subprocess.PIPE) if rc != 0: print("Starting mypy daemon, this will take a minute...")