Newer
Older
[](https://black.readthedocs.io/en/stable/)
Run [Black](https://github.com/psf/black) on your Python code to ensure it complies with the coding
style guide. Black is configured with `--check --diff --quiet` rules.
1. Configure the black section of `pyproject.toml` in your repository's with your desired rules.
2. Include the Black template in your CI/CD configuration (see quick use above).
3. If you need to customize the job, check
the [jobs customization](https://docs.r2devops.io/get-started/use-templates/#job-templates-customization).
## Global Configuration of Black
To add configuration to `black` shared with any other usage of black (such as manual run,
pre-commit, etc), you can use `pyproject.toml` configuration file. Learn more
about [pyproject](https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/)
configuration files.
## Add a <a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a> badge to your project README.md
To display the use of Black in your project, you can add the following badge to your README.md:
```markdown
<a href="https://github.com/psf/black">
<img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg">
</a>
```