Skip to content

mypy

mypy documentation

footman._stubs.mypy.Mypy

Bases: Tool

__call__

__call__(
    *args: str,
    allow_redefinition: _Flag = ...,
    allow_redefinition_new: _Flag = ...,
    allow_redefinition_old: _Flag = ...,
    allow_untyped_globals: _Flag = ...,
    always_false: _Value = ...,
    always_true: _Value = ...,
    any_exprs_report: _Value = ...,
    cache_dir: _Value = ...,
    cache_fine_grained: _Flag = ...,
    check_untyped_defs: _Flag = ...,
    cobertura_xml_report: _Value = ...,
    command: _Value = ...,
    config_file: _Value = ...,
    custom_typeshed_dir: _Value = ...,
    custom_typing_module: _Value = ...,
    deprecated_calls_exclude: _Value = ...,
    disable_error_code: _Value = ...,
    disallow_any_decorated: _Flag = ...,
    disallow_any_explicit: _Flag = ...,
    disallow_any_expr: _Flag = ...,
    disallow_any_generics: _Flag = ...,
    disallow_any_unimported: _Flag = ...,
    disallow_incomplete_defs: _Flag = ...,
    disallow_subclassing_any: _Flag = ...,
    disallow_untyped_calls: _Flag = ...,
    disallow_untyped_decorators: _Flag = ...,
    disallow_untyped_defs: _Flag = ...,
    enable_error_code: _Value = ...,
    enable_incomplete_feature: _Flag = ...,
    exclude: _Value = ...,
    exclude_gitignore: _Flag = ...,
    explicit_package_bases: _Flag = ...,
    extra_checks: _Flag = ...,
    find_occurrences: _Value = ...,
    follow_imports: _Flag = ...,
    follow_untyped_imports: _Flag = ...,
    hide_error_codes: _Flag = ...,
    html_report: _Value = ...,
    ignore_missing_imports: _Flag = ...,
    implicit_optional: _Flag = ...,
    install_types: _Flag = ...,
    junit_format: _Flag = ...,
    junit_xml: _Value = ...,
    linecount_report: _Value = ...,
    linecoverage_report: _Value = ...,
    lineprecision_report: _Value = ...,
    module: _Value = ...,
    native_parser: _Flag = ...,
    no_color_output: _Flag = ...,
    no_error_summary: _Flag = ...,
    no_fixed_format_cache: _Flag = ...,
    no_implicit_reexport: _Flag = ...,
    no_incremental: _Flag = ...,
    no_namespace_packages: _Flag = ...,
    no_silence_site_packages: _Flag = ...,
    no_site_packages: _Flag = ...,
    no_strict_bytes: _Flag = ...,
    no_strict_optional: _Flag = ...,
    no_warn_no_return: _Flag = ...,
    non_interactive: _Flag = ...,
    num_workers: _Value = ...,
    package: _Value = ...,
    pdb: _Flag = ...,
    platform: _Value = ...,
    pretty: _Flag = ...,
    python_executable: _Value = ...,
    python_version: _Value = ...,
    raise_exceptions: _Flag = ...,
    report_deprecated_as_note: _Flag = ...,
    scripts_are_modules: _Flag = ...,
    shadow_file: _Value = ...,
    show_absolute_path: _Flag = ...,
    show_column_numbers: _Flag = ...,
    show_error_code_links: _Flag = ...,
    show_error_context: _Flag = ...,
    show_error_end: _Flag = ...,
    show_traceback: _Flag = ...,
    skip_cache_mtime_checks: _Flag = ...,
    skip_version_check: _Flag = ...,
    sqlite_cache: _Flag = ...,
    strict: _Flag = ...,
    strict_equality: _Flag = ...,
    strict_equality_for_none: _Flag = ...,
    txt_report: _Value = ...,
    untyped_calls_exclude: _Value = ...,
    warn_incomplete_stub: _Flag = ...,
    warn_redundant_casts: _Flag = ...,
    warn_return_any: _Flag = ...,
    warn_unreachable: _Flag = ...,
    warn_unused_configs: _Flag = ...,
    warn_unused_ignores: _Flag = ...,
    xml_report: _Value = ...,
    xslt_html_report: _Value = ...,
    xslt_txt_report: _Value = ...,
    **flags: Any,
) -> Result

[-m MODULE][-p PACKAGE] [-c PROGRAM_TEXT][files ...]

Parameters:

Name Type Description Default
allow_redefinition _Flag

Allow flexible variable redefinition with a new type (inverse: --disallow-redefinition).

...
allow_redefinition_new _Flag

Deprecated alias for --allow-redefinition (inverse: --disallow-redefinition-new).

...
allow_redefinition_old _Flag

Allow restricted, unconditional variable redefinition with a new type (inverse: --disallow-redefinition-old).

...
allow_untyped_globals _Flag

Suppress toplevel errors caused by missing annotations (inverse: --disallow-untyped-globals).

...
always_false _Value

Additional variable to be considered False (may be repeated). May be repeated: a list emits the flag once per item.

...
always_true _Value

Additional variable to be considered True (may be repeated). May be repeated: a list emits the flag once per item.

...
cache_dir _Value

Store module cache info in the given folder in incremental mode (defaults to '.mypy_cache').

...
cache_fine_grained _Flag

Include fine-grained dependency information in the cache for the mypy daemon.

...
check_untyped_defs _Flag

Type check the interior of functions without type annotations (inverse: --no-check-untyped-defs).

...
command _Value

Type-check program passed in as string.

...
config_file _Value

Configuration file, must have a [mypy] section (defaults to mypy.ini, .mypy.ini, pyproject.toml, setup.cfg).

...
custom_typeshed_dir _Value

Use the custom typeshed in DIR.

...
custom_typing_module _Value

Use a custom typing module.

...
deprecated_calls_exclude _Value

Disable deprecated warnings for functions/methods coming from specific package, module, or class.

...
disable_error_code _Value

Disable a specific error code.

...
disallow_any_decorated _Flag

Disallow functions that have Any in their signature after decorator transformation.

...
disallow_any_explicit _Flag

Disallow explicit Any in type positions.

...
disallow_any_expr _Flag

Disallow all expressions that have type Any.

...
disallow_any_generics _Flag

Disallow usage of generic types that do not specify explicit type parameters (inverse: --allow-any-generics).

...
disallow_any_unimported _Flag

Disallow Any types resulting from unfollowed imports (inverse: --allow-any-unimported).

...
disallow_incomplete_defs _Flag

Disallow defining functions with incomplete type annotations (while still allowing entirely unannotated definitions) (inverse: --allow-incomplete-defs).

...
disallow_subclassing_any _Flag

Disallow subclassing values of type 'Any' when defining classes (inverse: --allow-subclassing-any).

...
disallow_untyped_calls _Flag

Disallow calling functions without type annotations from functions with type annotations (inverse: --allow-untyped-calls).

...
disallow_untyped_decorators _Flag

Disallow decorating typed functions with untyped decorators (inverse: --allow-untyped-decorators).

...
disallow_untyped_defs _Flag

Disallow defining functions without type annotations or with incomplete type annotations (inverse: --allow-untyped-defs).

...
enable_error_code _Value

Enable a specific error code.

...
enable_incomplete_feature _Flag

Enable support of incomplete/experimental features for early preview.

...
exclude _Value

Regular expression to match file names, directory names or paths which mypy should ignore while recursively discovering files to check, e.g. --exclude '/setup.py$'. May be repeated: a list emits the flag once per item.

...
exclude_gitignore _Flag

Use .gitignore file(s) to exclude files from checking (in addition to any explicit --exclude if present) (inverse: --no-exclude-gitignore).

...
explicit_package_bases _Flag

Use current directory and MYPYPATH to determine module names of files passed (inverse: --no-explicit-package-bases).

...
extra_checks _Flag

Enable additional checks that are technically correct but may be impractical in real code.

...
find_occurrences _Value

Print out all usages of a class member (experimental).

...
follow_imports _Flag

How to treat imports.

...
follow_untyped_imports _Flag

Typecheck modules without stubs or py.typed marker.

...
hide_error_codes _Flag

Hide error codes in error messages (inverse: --show-error-codes).

...
ignore_missing_imports _Flag

Silently ignore imports of missing modules.

...
implicit_optional _Flag

Assume arguments with default values of None are Optional (inverse: --no-implicit-optional).

...
install_types _Flag

Install detected missing library stub packages using pip (inverse: --no-install-types).

...
junit_format _Flag

If --junit-xml is set, specifies format.

...
junit_xml _Value

Write a JUnit XML test result document with type checking results to the given file.

...
module _Value

Type-check module; can repeat for more modules.

...
native_parser _Flag

Enable faster parser that parses directly to mypy AST (inverse: --no-native-parser).

...
no_color_output _Flag

Do not colorize error messages (inverse: --color-output).

...
no_error_summary _Flag

Do not show error stats summary (inverse: --error-summary).

...
no_fixed_format_cache _Flag

Do not use new fixed format cache (inverse: --fixed-format-cache).

...
no_implicit_reexport _Flag

Treat imports as private unless aliased (inverse: --implicit-reexport).

...
no_incremental _Flag

Disable module cache (inverse: --incremental).

...
no_namespace_packages _Flag

Disable support for namespace packages (PEP 420, init.py-less) (inverse: --namespace-packages).

...
no_silence_site_packages _Flag

Do not silence errors in PEP 561 compliant installed packages.

...
no_site_packages _Flag

Do not search for installed PEP 561 compliant packages.

...
no_strict_bytes _Flag

Treat bytearray and memoryview as subtypes of bytes (inverse: --strict-bytes).

...
no_strict_optional _Flag

Disable strict Optional checks (inverse: --strict-optional).

...
no_warn_no_return _Flag

Do not warn about functions that end without returning (inverse: --warn-no-return).

...
non_interactive _Flag

Install stubs without asking for confirmation and hide errors, with --install-types (inverse: --interactive).

...
num_workers _Value

Number of separate mypy worker processes (experimental).

...
package _Value

Type-check package recursively; can be repeated. May be repeated: a list emits the flag once per item.

...
pdb _Flag

Invoke pdb on fatal error.

...
platform _Value

Type check special-cased code for the given OS platform (defaults to sys.platform).

...
pretty _Flag

Use visually nicer output in error messages: Use soft word wrap, show source code snippets, and show error location markers (inverse: --no-pretty).

...
python_executable _Value

Python executable used for finding PEP 561 compliant installed packages and stubs.

...
python_version _Value

Type check code assuming it will be running on Python x.y.

...
raise_exceptions _Flag

Raise exception on fatal error.

...
report_deprecated_as_note _Flag

Report importing or using deprecated features as notes instead of errors (inverse: --no-report-deprecated-as-note).

...
scripts_are_modules _Flag

Script x becomes module x instead of main.

...
shadow_file _Value

When encountering SOURCE_FILE, read and type check the contents of SHADOW_FILE instead.

...
show_absolute_path _Flag

Show absolute paths to files (inverse: --hide-absolute-path).

...
show_column_numbers _Flag

Show column numbers in error messages (inverse: --hide-column-numbers).

...
show_error_code_links _Flag

Show links to error code documentation (inverse: --hide-error-code-links).

...
show_error_context _Flag

Precede errors with "note:" messages explaining context (inverse: --hide-error-context).

...
show_error_end _Flag

Show end line/end column numbers in error messages.

...
show_traceback _Flag

Show traceback on fatal error.

...
skip_cache_mtime_checks _Flag

Skip cache internal consistency checks based on mtime.

...
skip_version_check _Flag

Allow using cache written by older mypy version.

...
sqlite_cache _Flag

Use a sqlite database to store the cache (inverse: --no-sqlite-cache).

...
strict _Flag

Strict mode; enables the following flags: --disallow-any-generics, --disallow-subclassing-any, --disallow-untyped-calls, --disallow-untyped-defs, --disallow-incomplete- defs, --check-untyped-defs, --disallow-untyped-decorators, --warn-redundant-casts, --warn-unused-ignores, --warn-return-any, --no-implicit-reexport, --strict-equality, --extra-checks.

...
strict_equality _Flag

Prohibit equality, identity, and container checks for non-overlapping types (except None) (inverse: --no-strict-equality).

...
strict_equality_for_none _Flag

Extend --strict-equality for None checks (inverse: --no-strict-equality-for-none).

...
untyped_calls_exclude _Value

Disable --disallow-untyped-calls for functions/methods coming from specific package, module, or class.

...
warn_incomplete_stub _Flag

Warn if missing type annotation in typeshed, only relevant with --disallow-untyped-defs or --disallow-incomplete-defs enabled (inverse: --no-warn-incomplete-stub).

...
warn_redundant_casts _Flag

Warn about casting an expression to its inferred type (inverse: --no-warn-redundant-casts).

...
warn_return_any _Flag

Warn about returning values of type Any from non-Any typed functions (inverse: --no-warn-return-any).

...
warn_unreachable _Flag

Warn about statements or expressions inferred to be unreachable (inverse: --no-warn-unreachable).

...
warn_unused_configs _Flag

Warn about unused '[mypy-]' or '[[tool.mypy.overrides]]' config sections (inverse: --no-warn-unused-configs).

...
warn_unused_ignores _Flag

Warn about unneeded '# type: ignore' comments (inverse: --no-warn-unused-ignores).

...