Add pre-commit to automatically run formatting when committing

This commit is contained in:
Vincent Emonet 2023-07-23 13:24:15 +02:00
parent 7d07967574
commit 25168ba6e1
14 changed files with 74 additions and 34 deletions

View file

@ -33,6 +33,8 @@ git clone https://github.com/LibreTranslate/LibreTranslate.git
cd LibreTranslate
```
Hatch will automatically install the required dependencies in a virtual environment, and enable [`pre-commit`](https://pre-commit.com/), which will run before each commit to run formatting.
Run in development:
```bash
@ -72,6 +74,12 @@ You can also run the tests on multiple python versions:
hatch run all:test
```
You can clean the virtual environment with:
```bash
hatch env prune
```
## Run with Docker
Linux/macOS: `./run.sh [args]`
@ -125,4 +133,4 @@ This occurs when your operating system depends on and manages Python for core fu
This prevents pip packages from being installed system-wide. This way, there are no risks of pip packages conflicting between multiple projects or the operating system.
References:
* [Python venv documentation](https://docs.python.org/library/venv.html)
* [Python venv documentation](https://docs.python.org/library/venv.html)