| 1 |
<!-- |
| 2 |
black documentation master file, created by |
| 3 |
sphinx-quickstart on Fri Mar 23 10:53:30 2018. |
| 4 |
--> |
| 5 |
|
| 6 |
# The uncompromising code formatter |
| 7 |
|
| 8 |
> “Any color you like.” |
| 9 |
|
| 10 |
By using _Black_, you agree to cede control over minutiae of hand-formatting. In return, |
| 11 |
_Black_ gives you speed, determinism, and freedom from `pycodestyle` nagging about |
| 12 |
formatting. You will save time and mental energy for more important matters. |
| 13 |
|
| 14 |
_Black_ makes code review faster by producing the smallest diffs possible. Blackened |
| 15 |
code looks the same regardless of the project you're reading. Formatting becomes |
| 16 |
transparent after a while and you can focus on the content instead. |
| 17 |
|
| 18 |
```{admonition} Note - Black is now stable! |
| 19 |
_Black_ is [successfully used](https://github.com/psf/black#used-by) by many projects, |
| 20 |
small and big. _Black_ has a comprehensive test suite, with efficient parallel tests, |
| 21 |
our own auto formatting and parallel Continuous Integration runner. Now that we have |
| 22 |
become stable, you should not expect large changes to formatting in the future. |
| 23 |
Stylistic changes will mostly be responses to bug reports and support for new Python |
| 24 |
syntax. |
| 25 |
|
| 26 |
Also, as a safety measure which slows down processing, _Black_ will check that the |
| 27 |
reformatted code still produces a valid AST that is effectively equivalent to the |
| 28 |
original (see the [Pragmatism](./the_black_code_style/current_style.md#pragmatism) |
| 29 |
section for details). If you're feeling confident, use `--fast`. |
| 30 |
``` |
| 31 |
|
| 32 |
```{note} |
| 33 |
{doc}`Black is licensed under the MIT license <license>`. |
| 34 |
``` |
| 35 |
|
| 36 |
## Testimonials |
| 37 |
|
| 38 |
**Mike Bayer**, author of [SQLAlchemy](https://www.sqlalchemy.org/): |
| 39 |
|
| 40 |
> _I can't think of any single tool in my entire programming career that has given me a |
| 41 |
> bigger productivity increase by its introduction. I can now do refactorings in about |
| 42 |
> 1% of the keystrokes that it would have taken me previously when we had no way for |
| 43 |
> code to format itself._ |
| 44 |
|
| 45 |
**Dusty Phillips**, |
| 46 |
[writer](https://smile.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=dusty+phillips): |
| 47 |
|
| 48 |
> _Black is opinionated so you don't have to be._ |
| 49 |
|
| 50 |
**Hynek Schlawack**, creator of [attrs](https://www.attrs.org/), core developer of |
| 51 |
Twisted and CPython: |
| 52 |
|
| 53 |
> _An auto-formatter that doesn't suck is all I want for Xmas!_ |
| 54 |
|
| 55 |
**Carl Meyer**, [Django](https://www.djangoproject.com/) core developer: |
| 56 |
|
| 57 |
> _At least the name is good._ |
| 58 |
|
| 59 |
**Kenneth Reitz**, creator of [requests](https://python-requests.org/) and |
| 60 |
[pipenv](https://docs.pipenv.org/): |
| 61 |
|
| 62 |
> _This vastly improves the formatting of our code. Thanks a ton!_ |
| 63 |
|
| 64 |
## Show your style |
| 65 |
|
| 66 |
Use the badge in your project's README.md: |
| 67 |
|
| 68 |
```md |
| 69 |
[](https://github.com/psf/black) |
| 70 |
``` |
| 71 |
|
| 72 |
Using the badge in README.rst: |
| 73 |
|
| 74 |
```rst |
| 75 |
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg |
| 76 |
:target: https://github.com/psf/black |
| 77 |
``` |
| 78 |
|
| 79 |
## Contents |
| 80 |
|
| 81 |
```{toctree} |
| 82 |
--- |
| 83 |
maxdepth: 3 |
| 84 |
includehidden: |
| 85 |
--- |
| 86 |
|
| 87 |
the_black_code_style/index |
| 88 |
``` |
| 89 |
|
| 90 |
```{toctree} |
| 91 |
--- |
| 92 |
maxdepth: 3 |
| 93 |
includehidden: |
| 94 |
caption: User Guide |
| 95 |
--- |
| 96 |
|
| 97 |
getting_started |
| 98 |
usage_and_configuration/index |
| 99 |
integrations/index |
| 100 |
guides/index |
| 101 |
faq |
| 102 |
``` |
| 103 |
|
| 104 |
```{toctree} |
| 105 |
--- |
| 106 |
maxdepth: 2 |
| 107 |
includehidden: |
| 108 |
caption: Development |
| 109 |
--- |
| 110 |
|
| 111 |
contributing/index |
| 112 |
change_log |
| 113 |
authors |
| 114 |
``` |
| 115 |
|
| 116 |
```{toctree} |
| 117 |
--- |
| 118 |
hidden: |
| 119 |
caption: Project Links |
| 120 |
--- |
| 121 |
|
| 122 |
GitHub <https://github.com/psf/black> |
| 123 |
PyPI <https://pypi.org/project/black> |
| 124 |
Chat <https://discord.gg/RtVdv86PrH> |
| 125 |
``` |
| 126 |
|
| 127 |
# Indices and tables |
| 128 |
|
| 129 |
- {ref}`genindex` |
| 130 |
- {ref}`search` |