Merge pull request #999 from pipecat-ai/aleix/add-pre-commit-hooks
add pre-commit hooks
This commit is contained in:
7
.pre-commit-config.yaml
Normal file
7
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
repos:
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: ruff-format-hook
|
||||||
|
name: Check ruff formatting
|
||||||
|
entry: sh scripts/pre-commit.sh
|
||||||
|
language: system
|
||||||
13
README.md
13
README.md
@@ -160,15 +160,24 @@ From the root of this repo, run the following:
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
pip install -r dev-requirements.txt
|
pip install -r dev-requirements.txt
|
||||||
python -m build
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This builds the package. To use the package locally (e.g. to run sample files), run
|
This will install the necessary development dependencies. Also, make sure you install the git pre-commit hooks:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
pre-commit install
|
||||||
|
```
|
||||||
|
|
||||||
|
The hooks will just save you time when you submit a PR by making sure your code follows the project rules.
|
||||||
|
|
||||||
|
To use the package locally (e.g. to run sample files), run:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pip install --editable ".[option,...]"
|
pip install --editable ".[option,...]"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `--editable` option makes sure you don't have to run `pip install` again and you can just edit the project files locally.
|
||||||
|
|
||||||
If you want to use this package from another directory, you can run:
|
If you want to use this package from another directory, you can run:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
build~=1.2.2
|
build~=1.2.2
|
||||||
grpcio-tools~=1.69.0
|
grpcio-tools~=1.69.0
|
||||||
pip-tools~=7.4.1
|
pip-tools~=7.4.1
|
||||||
|
pre-commit~=4.0.1
|
||||||
pyright~=1.1.392
|
pyright~=1.1.392
|
||||||
pytest~=8.3.4
|
pytest~=8.3.4
|
||||||
ruff~=0.9.1
|
ruff~=0.9.1
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ local_scheme = "no-local-version"
|
|||||||
fallback_version = "0.0.0-dev"
|
fallback_version = "0.0.0-dev"
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
exclude = ["*_pb2.py"]
|
exclude = [".git", "*_pb2.py"]
|
||||||
line-length = 100
|
line-length = 100
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
|
|||||||
3
scripts/pre-commit.sh
Executable file
3
scripts/pre-commit.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
NO_COLOR=1 ruff format --diff
|
||||||
Reference in New Issue
Block a user