| 1 |
Code style |
| 2 |
============ |
| 3 |
|
| 4 |
|
| 5 |
Black code formatter |
| 6 |
------------------------------- |
| 7 |
For Python code formatting, we use `Black code formatter <https://pypi.org/project/black/>`__, |
| 8 |
black settings are stored in the repository's pyproject.toml. |
| 9 |
|
| 10 |
We have GitHub workflow `ci-black-formatting` to maintain black formatting across the repository. |
| 11 |
|
| 12 |
``black`` can be installed using ``pip install black`` and files can be formatted with the following example command: |
| 13 |
|
| 14 |
.. code-block:: bash |
| 15 |
|
| 16 |
# Format the entire repository. |
| 17 |
# Should be used in 99% cases as the entire repository is already formatted using black. |
| 18 |
black . |
| 19 |
# Format only some specific file. |
| 20 |
black src/bonsai/bonsai/bim/module/qto/operator.py |
| 21 |
|