diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index 11555c4ea89a..48fd22c0bd55 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -17,25 +17,23 @@ flag (or its long form ``--help``):: [--disallow-untyped-defs] [--disallow-incomplete-defs] [--check-untyped-defs] [--disallow-subclassing-any] [--warn-incomplete-stub] [--disallow-untyped-decorators] - [--warn-redundant-casts] [--no-warn-no-return] - [--warn-return-any] [--warn-unused-ignores] - [--warn-unused-configs] [--show-error-context] - [--no-implicit-optional] [-i] [--quick-and-dirty] - [--cache-dir DIR] [--cache-fine-grained] [--skip-version-check] - [--strict-optional] + [--warn-redundant-casts] [--no-warn-no-return] [--warn-return-any] + [--warn-unused-ignores] [--warn-unused-configs] + [--show-error-context] [--no-implicit-optional] [--no-incremental] + [--quick-and-dirty] [--cache-dir DIR] [--cache-fine-grained] + [--skip-version-check] [--strict-optional] [--strict-optional-whitelist [GLOB [GLOB ...]]] - [--always-true NAME] [--always-false NAME] - [--junit-xml JUNIT_XML] [--pdb] [--show-traceback] [--stats] - [--inferstats] [--custom-typing MODULE] - [--custom-typeshed-dir DIR] [--scripts-are-modules] - [--config-file CONFIG_FILE] [--show-column-numbers] - [--find-occurrences CLASS.MEMBER] [--strict] - [--shadow-file SOURCE_FILE SHADOW_FILE] [--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] [-m MODULE] - [-p PACKAGE] [-c PROGRAM_TEXT] + [--always-true NAME] [--always-false NAME] [--junit-xml JUNIT_XML] + [--pdb] [--show-traceback] [--stats] [--inferstats] + [--custom-typing MODULE] [--custom-typeshed-dir DIR] + [--scripts-are-modules] [--config-file CONFIG_FILE] + [--show-column-numbers] [--find-occurrences CLASS.MEMBER] + [--strict] [--shadow-file SOURCE_FILE SHADOW_FILE] + [--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] [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files [files ...]] (etc., too long to show everything here) @@ -339,12 +337,15 @@ Here are some more useful flags: .. _incremental: -- ``--incremental`` enables a module cache, using results from +- Incremental mode enables a module cache, using results from previous runs to speed up type checking. Incremental mode can help when most parts of your program haven't changed since the previous mypy run. -- ``--cache-dir DIR`` is a companion flag to ``-incremental``, which + Incremental mode is the default and may be disabled with + ``--no-incremental``. + +- ``--cache-dir DIR`` is a companion flag to incremental mode, which specifies where the cache files are written. By default this is ``.mypy_cache`` in the current directory. While the cache is only read in incremental mode, it is written even in non-incremental diff --git a/docs/source/config_file.rst b/docs/source/config_file.rst index 042b5b9142dc..0b6899045a7a 100644 --- a/docs/source/config_file.rst +++ b/docs/source/config_file.rst @@ -107,7 +107,7 @@ The following global flags may only be set in the global section - ``dump_inference_stats`` (Boolean, default False) dumps stats about type inference. -- ``incremental`` (Boolean, default False) enables :ref:`incremental +- ``incremental`` (Boolean, default True) enables :ref:`incremental mode `. - ``cache_dir`` (string, default ``.mypy_cache``) stores module cache diff --git a/mypy/main.py b/mypy/main.py index 1779c000ad1e..67f617ec67b4 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -314,9 +314,9 @@ def add_invertible_flag(flag: str, add_invertible_flag('--no-implicit-optional', default=False, strict_flag=True, help="don't assume arguments with default values of None are Optional") parser.add_argument('-i', '--incremental', action='store_true', - help="enable module cache, (inverse: --no-incremental)") - parser.add_argument('--no-incremental', action='store_false', dest='incremental', help=argparse.SUPPRESS) + parser.add_argument('--no-incremental', action='store_false', dest='incremental', + help="disable module cache, (inverse: --incremental)") parser.add_argument('--quick-and-dirty', action='store_true', help="use cache even if dependencies out of date " "(implies --incremental)") diff --git a/mypy/options.py b/mypy/options.py index a5eade051a21..71ab15c5beaf 100644 --- a/mypy/options.py +++ b/mypy/options.py @@ -149,7 +149,7 @@ def __init__(self) -> None: self.junit_xml = None # type: Optional[str] # Caching and incremental checking options - self.incremental = False + self.incremental = True self.cache_dir = defaults.CACHE_DIR self.debug_cache = False self.quick_and_dirty = False