Giter Club home page Giter Club logo

python-black-configparser's Introduction

Build Status Code Coverage PyPI - Python Version PyPI MIT License Automatic PyPI Release

black-configparser

Seamless proxy CLI for black ("The uncompromising code formatter") with support for non-pyproject.toml config files.

Table of Contents

  1. About the Project
  2. Installation
  3. Usage
  4. Known issues
  5. License

About the Project

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.

Why it is different?

Unlike other tools, tries to stay dumb simple and add only minimum needed overhead to black usage.

  1. It is seamless - it works on the same CLI command - black - just passing logic through some extra code!
  2. There is no complex argument processing, if config file is present, the values set there are passed directly to black.
  3. Code of this tool is independent from black insides and will work properly as long as black won't make any braking changes in its command line options.

Installation

$ pip install black-configparser

Usage

  • 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 to black command, for example:
    $ black --no-config-file --check ./path/to/file.py
    

Example configuration

[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.

Known issues

  • Undefined behavior, when running with one of allowed CLI arguments which is also set in the config file.
  • After black-configparser package is uninstalled, the black command does not work anymore and black package must be reinstalled.

License

MIT

python-black-configparser's People

Contributors

danie1k avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.