Skip to content

Instantly share code, notes, and snippets.

@Michael0x2a
Last active June 8, 2018 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Michael0x2a/36c5948a7ea571b722686226639b0859 to your computer and use it in GitHub Desktop.
Save Michael0x2a/36c5948a7ea571b722686226639b0859 to your computer and use it in GitHub Desktop.
Proposed mypy '--help' output
usage: mypy [-h] [-v] [-V] [--config-file CONFIG_FILE] [--warn-unused-configs]
[--ignore-missing-imports]
[--follow-imports {normal,silent,skip,error}]
[--python-executable EXECUTABLE] [--no-site-packages]
[--python-version x.y] [-2] [--platform PLATFORM]
[--always-true NAME] [--always-false NAME]
[--disallow-any-unimported] [--disallow-any-expr]
[--disallow-any-decorated] [--disallow-any-explicit]
[--disallow-any-generics] [--disallow-untyped-calls]
[--disallow-untyped-defs] [--disallow-incomplete-defs]
[--check-untyped-defs] [--warn-incomplete-stub]
[--no-implicit-optional] [--no-strict-optional]
[--strict-optional-whitelist [GLOB [GLOB ...]]]
[--warn-redundant-casts] [--no-warn-no-return] [--warn-return-any]
[--warn-unused-ignores] [--disallow-subclassing-any]
[--disallow-untyped-decorators] [--no-incremental]
[--cache-dir DIR] [--cache-fine-grained] [--quick-and-dirty]
[--skip-version-check] [--pdb] [--show-traceback]
[--custom-typing MODULE] [--custom-typeshed-dir DIR]
[--shadow-file SOURCE_FILE SHADOW_FILE] [--show-error-context]
[--show-column-numbers] [--stats] [--inferstats]
[--find-occurrences CLASS.MEMBER] [--strict]
[--any-exprs-report DIR] [--cobertura-xml-report DIR]
[--html-report DIR] [--linecount-report DIR]
[--linecoverage-report DIR] [--memory-xml-report DIR]
[--txt-report DIR] [--xml-report DIR] [--xslt-html-report DIR]
[--xslt-txt-report DIR] [--junit-xml JUNIT_XML]
[--scripts-are-modules] [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT]
[files [files ...]]
optional arguments:
-h, --help show this help message and exit
-v, --verbose more verbose messages
-V, --version show program's version number and exit
config file:
Use a config file instead of command line arguments.
--config-file CONFIG_FILE
configuration file, must have a [mypy] section
(defaults to mypy.ini, setup.cfg, ~/.mypy.ini)
--warn-unused-configs warn about unused '[mypy-<pattern>]' config
sections (inverse: --no-warn-unused-configs)
import discovery:
Configure how imports are discovered and followed.
--ignore-missing-imports silently ignore imports of missing modules
--follow-imports {normal,silent,skip,error}
how to treat imports (default normal)
--python-executable EXECUTABLE
Python executable used for finding PEP 561
compliant installed packages and stubs
--no-site-packages do not search for installed PEP 561 compliant
packages
platform configuration:
Typecheck code assuming certain runtime conditions.
--python-version x.y typecheck code assuming it will be running on
Python x.y
-2, --py2 use Python 2 mode (same as --python-version 2.7)
--platform PLATFORM typecheck special-cased code for the given OS
platform (defaults to sys.platform)
--always-true NAME additional variable to be considered True (may be
repeated)
--always-false NAME additional variable to be considered False (may be
repeated)
disallow any:
Disallow the use of the 'Any' type under certain conditions.
--disallow-any-unimported
disallow Any types resulting from unfollowed
imports
--disallow-any-expr disallow all expressions that have type Any
--disallow-any-decorated disallow functions that have Any in their
signature after decorator transformation
--disallow-any-explicit disallow explicit Any in type positions
--disallow-any-generics disallow usage of generic types that do not
specify explicit type parameters
untyped definitions and calls:
Configure how untyped definitions and calls are handled.
--disallow-untyped-calls disallow calling functions without type
annotations from functions with type annotations
(inverse: --allow-untyped-calls)
--disallow-untyped-defs disallow defining functions without type
annotations or with incomplete type annotations
(inverse: --allow-untyped-defs)
--disallow-incomplete-defs
disallow defining functions with incomplete type
annotations (inverse: --allow-incomplete-defs)
--check-untyped-defs type check the interior of functions without type
annotations (inverse: --no-check-untyped-defs)
--warn-incomplete-stub warn if missing type annotation in typeshed, only
relevant with --check-untyped-defs enabled
(inverse: --no-warn-incomplete-stub)
handle None and Optional:
Adjust how values of type 'None' are handled.
--no-implicit-optional don't assume arguments with default values of None
are Optional (inverse: --implicit-optional)
--no-strict-optional disable strict Optional checks (inverse: --strict-
optional)
--strict-optional-whitelist [GLOB [GLOB ...]]
suppress strict Optional errors in all but the
provided files (experimental -- read documentation
before using!). Implies --strict-optional. Has the
undesirable side-effect of suppressing other
errors in non-whitelisted files.
warnings:
Detect code that is sound but redundant or problematic.
--warn-redundant-casts warn about casting an expression to its inferred
type (inverse: --no-warn-redundant-casts)
--no-warn-no-return do not warn about functions that end without
returning (inverse: --warn-no-return)
--warn-return-any warn about returning values of type Any from non-
Any typed functions (inverse: --no-warn-return-
any)
--warn-unused-ignores warn about unneeded '# type: ignore' comments
(inverse: --no-warn-unused-ignores)
other strictness checks:
Other miscellaneous strictness checks.
--disallow-subclassing-any
disallow subclassing values of type 'Any' when
defining classes (inverse: --allow-subclassing-
any)
--disallow-untyped-decorators
disallow decorating typed functions with untyped
decorators (inverse: --allow-untyped-decorators)
--strict strict mode; enables the following flags: --warn-
unused-configs, --disallow-untyped-calls,
--disallow-untyped-defs, --disallow-incomplete-
defs, --check-untyped-defs, --no-implicit-
optional, --warn-redundant-casts, --warn-return-
any, --warn-unused-ignores, --disallow-
subclassing-any, --disallow-untyped-decorators
incremental mode:
Adjust how mypy incremental typechecks and caches modules.
--no-incremental disable module cache, (inverse: --incremental)
--cache-dir DIR store module cache info in the given folder in
incremental mode (defaults to '.mypy_cache')
--cache-fine-grained include fine-grained dependency information in the
cache
--quick-and-dirty use cache even if dependencies out of date
(implies --incremental)
--skip-version-check allow using cache written by older mypy version
mypy internals:
Debug and customize mypy internals.
--pdb invoke pdb on fatal error
--show-traceback, --tb show traceback on fatal error
--custom-typing MODULE use a custom typing module
--custom-typeshed-dir DIR
use the custom typeshed in DIR
--shadow-file SOURCE_FILE SHADOW_FILE
when encountering SOURCE_FILE, read and typecheck
the contents of SHADOW_FILE instead.
error reporting:
Adjust the amount of detail shown in error messages.
--show-error-context precede errors with "note:" messages explaining
context (inverse: --hide-error-context)
--show-column-numbers show column numbers in error messages (inverse:
--hide-column-numbers)
extra analysis:
Extract additional information and analysis.
--stats dump stats
--inferstats dump type inference stats
--find-occurrences CLASS.MEMBER
print out all usages of a class member
(experimental)
report generation:
Generate a report in the specified format.
--any-exprs-report DIR
--cobertura-xml-report DIR
--html-report DIR
--linecount-report DIR
--linecoverage-report DIR
--memory-xml-report DIR
--txt-report DIR
--xml-report DIR
--xslt-html-report DIR
--xslt-txt-report DIR
miscellaneous:
Other miscellaneous flags.
--junit-xml JUNIT_XML write junit.xml to the given file
--scripts-are-modules script x becomes module x instead of __main__
How to specify the code to type check:
-m MODULE, --module MODULE
type-check module; can repeat for more modules
-p PACKAGE, --package PACKAGE
type-check package recursively; can be repeated
-c PROGRAM_TEXT, --command PROGRAM_TEXT
type-check program passed in as string
files type-check given files or directories
environment variables: MYPYPATH additional module search path
@gvanrossum
Copy link

@Michael0x2a I wonder if it would be better not to show the initial summary -- it just scrolls by. Does argparse have a way to alter that?

@gvanrossum
Copy link

(Other than that, I love the new output!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment