Seamless proxy CLI for black ("The uncompromising code formatter")
with support for non-pyproject.toml
config files.
The black-configparser
is yet another tool (next to brunette,
white, and maybe a few more out there),
which tries to fill the gap of missing setup.cfg
(or just any other non-pyproject.toml
) config file.
Unlike other tools, tries to stay dumb simple and add only minimum needed overhead to black
usage.
- It is seamless - it works on the same CLI command -
black
- just passing logic through some extra code! - There is no complex argument processing, if config file is present, the values set there are passed directly to
black
. - Code of this tool is independent from
black
insides and will work properly as long asblack
won't make any braking changes in its command line options.
$ pip install black-configparser
- Supported configuration files:
setup.cfg
,tox.ini
. - Configuration file section:
[black]
or[tools:black]
.
Important!
- When you
black-configparser
finds black configuration in any of supported file(s), most black's built-in command line arguments become unavailable.
Exceptions:--check
--code
--diff
--help
--verbose
--version
- The
black-configparser
can be temporarily disabled, by adding--no-config-file
flag toblack
command, for example:$ black --no-config-file --check ./path/to/file.py
[black]
line-length = 120
target-version =
py27
py33
py34
py35
py36
py37
py38
pyi = True
skip-string-normalization = True
color = True
include = \.pyi?$
exclude = /(\.direnv|\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|\.svn|_build|buck-out|build|dist)/
force-exclude = lorem ipsum
quiet = True
verbose = True
- Almost any option available for black (
black --help
) can be put onto config file. - Values for multi-value arguments must be one per line (separated by
\n
char). - Flags (arguments without values) must be set in config file as
= True
.
- Undefined behavior, when running with one of allowed CLI arguments which is also set in the config file.
- After
black-configparser
package is uninstalled, theblack
command does not work anymore and black package must be reinstalled.
MIT