Skip to content

Commit 4b7838a

Browse files
authored
docs: added pre-commit uv-lock and uv-export hooks to docs
1 parent 5903ce5 commit 4b7838a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/guides/integration/pre-commit.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@
33
An official pre-commit hook is provided at
44
[`astral-sh/uv-pre-commit`](https://github.com/astral-sh/uv-pre-commit).
55

6+
To make sure your `uv.lock` file is up to date even if your `pyporject.toml` file was changed via pre-commit, add the following to the `.pre-commit-config.yaml`:
7+
8+
```yaml title=".pre-commit-config.yaml"
9+
- repo: https://github.com/astral-sh/uv-pre-commit
10+
# uv version.
11+
rev: 0.5.8
12+
hooks:
13+
- id: uv-lock
14+
```
15+
16+
To keep your `requirements.txt` file updated using pre-commit:
17+
18+
```yaml title=".pre-commit-config.yaml"
19+
- repo: https://github.com/astral-sh/uv-pre-commit
20+
# uv version.
21+
rev: 0.5.8
22+
hooks:
23+
- id: uv-export
24+
```
25+
626
To compile requirements via pre-commit, add the following to the `.pre-commit-config.yaml`:
727

828
```yaml title=".pre-commit-config.yaml"

0 commit comments

Comments
 (0)