Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR for #8510 "[Feature-Request] Allow mypy.ini to be a dot file" #8515

Merged
merged 3 commits into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ Config file

This flag makes mypy read configuration settings from the given file.

By default settings are read from ``mypy.ini`` or ``setup.cfg`` in the
current directory, or ``.mypy.ini`` in the user's home directory.
Settings override mypy's built-in defaults and command line flags
can override settings.
By default settings are read from ``mypy.ini``, ``.mypy.ini``, or ``setup.cfg``
in the current directory. Settings override mypy's built-in defaults and
command line flags can override settings.

Specifying :option:`--config-file= <--config-file>` (with no filename) will ignore *all*
config files.
Expand Down
6 changes: 3 additions & 3 deletions docs/source/config_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ The mypy configuration file
===========================

Mypy supports reading configuration settings from a file. By default
it uses the file ``mypy.ini`` with fallback to ``setup.cfg`` in the current
directory, then ``$XDG_CONFIG_HOME/mypy/config``, then
it uses the file ``mypy.ini`` with a fallback to ``.mypy.ini``, then ``setup.cfg`` in
the current directory, then ``$XDG_CONFIG_HOME/mypy/config``, then
``~/.config/mypy/config``, and finally ``.mypy.ini`` in the user home directory
if none of them are found; the :option:`--config-file <mypy --config-file>` command-line flag can be used
to read a different file instead (see :ref:`config-file-flag`).
Expand All @@ -15,7 +15,7 @@ files, as it would lead to ambiguity. The :option:`--config-file <mypy --config
has the highest precedence and must be correct; otherwise mypy will report
an error and exit. Without command line option, mypy will look for defaults,
but will use only one of them. The first one to read is ``mypy.ini``,
and then ``setup.cfg``.
then ``.mypy.ini``, and finally ``setup.cfg``.

Most flags correspond closely to :ref:`command-line flags
<command-line>` but there are some differences in flag names and some
Expand Down
4 changes: 2 additions & 2 deletions mypy/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
PYTHON3_VERSION = (3, 6) # type: Final
PYTHON3_VERSION_MIN = (3, 4) # type: Final
CACHE_DIR = '.mypy_cache' # type: Final
CONFIG_FILE = 'mypy.ini' # type: Final
CONFIG_FILE = ['mypy.ini', '.mypy.ini'] # type: Final
SHARED_CONFIG_FILES = ['setup.cfg', ] # type: Final
USER_CONFIG_FILES = ['~/.config/mypy/config', '~/.mypy.ini', ] # type: Final
if os.environ.get('XDG_CONFIG_HOME'):
USER_CONFIG_FILES.insert(0, os.path.join(os.environ['XDG_CONFIG_HOME'], 'mypy/config'))

CONFIG_FILES = [CONFIG_FILE, ] + SHARED_CONFIG_FILES + USER_CONFIG_FILES # type: Final
CONFIG_FILES = CONFIG_FILE + SHARED_CONFIG_FILES + USER_CONFIG_FILES # type: Final

# This must include all reporters defined in mypy.report. This is defined here
# to make reporter names available without importing mypy.report -- this speeds
Expand Down