Flake8 plugin to reuse the same lint configuration across multiple Python projects
Project description
Flake8 plugin to reuse the same lint configuration across multiple Python projects.
A “nitpick code style” is a TOML file with settings that should be present in config files from other tools. E.g.:
pyproject.toml and setup.cfg (used by flake8, black, isort, mypy);
.pylintrc (used by pylint config);
more files to come.
Quick setup
Simply install the package (in a virtualenv or globally, wherever) and run flake8:
$ pip install -U flake8-nitpick
$ flake8
You will see warnings if your project configuration is different than the default style file.
Configure your own style file
Change your project config on pyproject.toml, and configure your own style like this:
[tool.nitpick]
style = "https://raw.githubusercontent.com/andreoliwa/flake8-nitpick/master/nitpick-style.toml"
You can set style with any local file or URL. E.g.: you can use the raw URL of a GitHub Gist.
Default search order for a style file
A file or URL configured in the pyproject.toml file, [tool.nitpick] section, style key, as described above.
Any nitpick-style.toml file found in the current directory (the one in which flake8 runs from) or above.
If no style is found, then the default style file from GitHub is used.
Style file syntax
A style file contains basically the configuration options you want to enforce in all your projects.
They are just the config to the tool, prefixed with the name of the config file.
E.g.: To configure the black formatter with a line length of 120, you use this in your pyproject.toml:
[tool.black]
line-length = 120
To enforce that all your projects use this same line length, add this to your nitpick-style.toml file:
["pyproject.toml".tool.black]
line-length = 120
It’s the same exact section/key, just prefixed with the config file name ("pyproject.toml".)
The same works for setup.cfg. To configure mypy to ignore missing imports in your project:
[mypy]
ignore_missing_imports = true
To enforce all your projects to ignore missing imports, add this to your nitpick-style.toml file:
["setup.cfg".mypy]
ignore_missing_imports = true
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for flake8_nitpick-0.3.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74acacea2df3cb8084e0b7de87b78de2e138fb187b39276621f152124ba29b24 |
|
MD5 | f4152715bd04a388ba5525f1ffb51c60 |
|
BLAKE2b-256 | 95bdfcf17529f6ed15bacf6fb9a0666deb685516831d6109b3f9c2ef7f0c3a8d |