setuptools-black

black command for setuptools


Keywords
black, setuptools, plugin, linter, python, python-library
License
MIT
Install
pip install setuptools-black==0.1.5

Documentation

PyPI PyPI - Status PyPI - License PyPI - Downloads Code style: black

Build Status GitHub Workflow Status Coverage Status codecov Maintainability Codacy Badge

Custom setuptools command for black formatting tool (see https://github.com/ambv/black).

This package adds the format command to setuptools, which uses black to reformat code:

> python setup.py format
running format
All done! ✨ 🍰 ✨
5 files left unchanged

You may also use customize the build command to enforce format validation at build time. Build will fail if there's any formatting error.

In your setup.py:

import setuptools_black
...
setuptools.setup(
...
    cmdclass={
        "build": setuptools_black.BuildCommand,
    },
...
)

Note

You'll have to install setuptools-black first, as setup_requires can't be used to install a package which must be imported by setup.py itself...