-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support reading options from a config file, default mypy.ini. (#2148)
Also support reading command line flags using `mypy @flagsfile`. Addresses #1249 (but does not completely fix it). The mypy.ini file has the format: ``` [mypy] silent_imports = True python_version = 2.7 ``` Errors in this config file are non-fatal. Comments and blank lines are supported. There are also sections with glob patterns for per-file options, e.g. `[mypy-dir1/*,dir2/*]` (I'll document those later). The `@flagsfile` option reads additional argparse-style flags, including filenames, from `flagsfile`, one per line. This is typically used for passing in a list of files, but it can also be used for passing flags: ``` --silent-imports --py2 mypy ``` This format does not allow comments or blank lines. Each option must appear on a line by itself. Errors are fatal. The mypy.ini file serves as a set of defaults that can be overridden (or in some cases extended) by command line flags. An alternate config file may be specified using a command line flag: `--config-file anywhere.ini`. (There's a trick involved in making this work, read the source. :-)
- Loading branch information
1 parent
1555ed6
commit 2fbb724
Showing
9 changed files
with
344 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
PYTHON2_VERSION = (2, 7) | ||
PYTHON3_VERSION = (3, 5) | ||
MYPY_CACHE = '.mypy_cache' | ||
CACHE_DIR = '.mypy_cache' | ||
CONFIG_FILE = 'mypy.ini' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.