We are using [Black](https://github.com/python/black) formatter tool.
We are using [`pre-commit`](https://pre-commit.com/) tool to perform checks on staged changes before committing. Such as black formatting.
To have Black installed in your Poetry virtualenv, you will need Python v3.6 or greater.
Depending whether you prefer to work ouside or inside Poetry virtual environment, you should stick to one usage or use both to still have this usefull checks.
`pre-commit` can be used from the installation on your system or from inside Poetry virtual environment where it is installed.
To install the `git-hooks`, run:
```bash
pip3 install--user pre-commit
silkaj> pre-commit install
```
```bash
silkaj> poetry shell
(silkaj-58dUTebQ-py3.9) pre-commit install
```
### Black formatting
We are using [Black](https://github.com/psf/black) formatter tool.
Run Black on a Python file to format it:
Run Black on a Python file to format it:
```bash
```bash
poetry run black silkaj/cli.py
poetry run black silkaj/cli.py
```
```
With `pre-commit`, Black is called on staged files, so the commit should fail in case black would make changes.
### Pre-commit
Then, you can use the `pre-commit` tool to check staged changes before committing.
To do so, you need to run `pre-commit install` to install the git hook.
Black is called on staged files, so commit should fail in case black made changes.
You will have to add Black changes in order to commit your changes.
You will have to add Black changes in order to commit your changes.