Skip to content
Snippets Groups Projects
README.md 1018 B
Newer Older
SErfort's avatar
SErfort committed
# pre-commit_template

## Getting started

1. (optional, recommended) create and activate Python virtual environment
SErfort's avatar
SErfort committed

    ```bash
    python -m venv <virtual env. path>
    . <virtual env. path>/bin/activate
    ```
SErfort's avatar
SErfort committed

2. install Python requirements
SErfort's avatar
SErfort committed

    ```bash
    pip install -r requirements.txt
    ```
SErfort's avatar
SErfort committed

3. follow steps from [pre-commit Quick start guide](https://pre-commit.com/#quick-start) to set it up and run it
    1. [add/edit pre-commit configuration](https://pre-commit.com/#2-add-a-pre-commit-configuration), for example Python code formatter [Black](https://github.com/psf/black) (notice the authors advise to use the mirror repo [black-pre-commit-mirror](https://github.com/psf/black-pre-commit-mirror))
    2. install Git hook scripts
SErfort's avatar
SErfort committed

SErfort's avatar
SErfort committed

       This creates a Git pre-commit hook that installs and runs pre-commit for other users of this repository as well.

SErfort's avatar
SErfort committed

        ```bash
        pre-commit run --all-files
        ```
SErfort's avatar
SErfort committed