Sick of config file soup cluttering up your repo? Me too. However there is a way to at least clean it up for many python tools.
Some of the tools you might use and the config files they support...
With that mypy now also supports setup.cfg, and we can all remove many more config files.
The rules for precedence are easy:
## http://coverage.readthedocs.io/en/latest/config.html
#[coverage:run]
#timid = True
## http://pytest.org/latest/customize.html#adding-default-options
# [tool:pytest]
# addopts=-v --cov pygameweb pygameweb/ tests/
## http://mypy.readthedocs.io/en/latest/config_file.html
#[mypy]
#python_version = 2.7
#[flake8]
#max-line-length = 120
#max-complexity = 10
#exclude = build,dist,docs/conf.py,somepackage/migrations,*.egg-info
## Run with: pylint --rcfile=setup.cfg somepackage
#[pylint]
#disable = C0103,C0111
#ignore = migrations
#ignore-docstrings = yes
#output-format = colorized
Some of the tools you might use and the config files they support...
- flake8 -
.flake8
,setup.cfg
,tox.ini
, andconfig/flake8
on Windows - pytest -
pytest.ini
,tox.ini
,setup.cfg
- coverage.py -
.coveragerc
,setup.cfg
,tox.ini
- mypy -
setup.cfg
,mypy.ini
- tox -
tox.ini
OK, you've convinced me. -- Guido
With that mypy now also supports setup.cfg, and we can all remove many more config files.
The rules for precedence are easy:
- read
--config-file
option - if it's incorrect, exit - read
[tool].ini
- if correct, stop - read
setup.cfg
How to config with setup.cfg?
Here's a list to the configuration documentation for setup.cfg.What does a setup.cfg look like now?
Here's an example setup.cfg for you with various tools configured. (note these are nonsensical example configs, not what I suggest you use!)## http://coverage.readthedocs.io/en/latest/config.html
#[coverage:run]
#timid = True
## http://pytest.org/latest/customize.html#adding-default-options
# [tool:pytest]
# addopts=-v --cov pygameweb pygameweb/ tests/
## http://mypy.readthedocs.io/en/latest/config_file.html
#[mypy]
#python_version = 2.7
#[flake8]
#max-line-length = 120
#max-complexity = 10
#exclude = build,dist,docs/conf.py,somepackage/migrations,*.egg-info
## Run with: pylint --rcfile=setup.cfg somepackage
#[pylint]
#disable = C0103,C0111
#ignore = migrations
#ignore-docstrings = yes
#output-format = colorized