single |
![Black Logo]
The Uncompromising Code Formatter
[image]
[image]
[image]
[image]
[image]
[image]
[image]
[image]
[image]
> “Any color you like.”
_Black_ is the uncompromising Python code formatter. By using it, you agree
to cede
control over minutiae of hand-formatting. In return, _Black_ gives you
speed,
determinism, and freedom from `pycodestyle` nagging about formatting. You
will save time
and mental energy for more important matters.
Blackened code looks the same regardless of the project you're reading.
Formatting
becomes transparent after a while and you can focus on the content instead.
_Black_ makes code review faster by producing the smallest diffs possible.
Try it out now using the [Black Playground]. Watch the
[PyCon 2019 talk] to learn more.
---
_Contents:_ **[Installation and usage]** |
**[Code style]** | **[Pragmatism]** |
**[pyproject.toml]** | **[Editor integration]** |
**[blackd]** | **[black-primer]** |
**[Version control integration]** |
**[GitHub Actions]** |
**[Ignoring unmodified files]** | **[Used by]** |
**[Testimonials]** | **[Show your style]** |
**[Contributing]** | **[Change log]** |
**[Authors]**
---
## Installation and usage
### Installation
_Black_ can be installed by running `pip install black`. It requires Python
3.6.0+ to
run but you can reformat Python 2 code with it, too.
#### Install from GitHub
If you can't wait for the latest _hotness_ and want to install from GitHub,
use:
`pip install git+git://github.com/psf/black`
### Usage
To get started right away with sensible defaults:
```sh
black {source_file_or_directory}
```
You can run _Black_ as a package if running it as a script doesn't work:
```sh
python -m black {source_file_or_directory}
```
### Command line options
_Black_ doesn't provide many options. You can list them by running `black
--help`:
```text
Usage: black [OPTIONS] [SRC]```
Looks like this:
[![Code style: black]](https://github.com/psf/black)
## License
MIT
## Contributing to _Black_
In terms of inspiration, _Black_ is about as configurable as _gofmt_. This
is
deliberate.
|