Skip to content

Commit fddb518

Browse files
committed
docs: added pre-commit uv-lock and uv-export hooks to docs
1 parent 5903ce5 commit fddb518

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/guides/integration/pre-commit.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
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
7+
pre-commit, add the following to the `.pre-commit-config.yaml`:
8+
9+
```yaml title=".pre-commit-config.yaml"
10+
- repo: https://github.com/astral-sh/uv-pre-commit
11+
# uv version.
12+
rev: 0.5.8
13+
hooks:
14+
- id: uv-lock
15+
```
16+
17+
To keep your `requirements.txt` file updated using pre-commit:
18+
19+
```yaml title=".pre-commit-config.yaml"
20+
- repo: https://github.com/astral-sh/uv-pre-commit
21+
# uv version.
22+
rev: 0.5.8
23+
hooks:
24+
- id: uv-export
25+
```
26+
627
To compile requirements via pre-commit, add the following to the `.pre-commit-config.yaml`:
728

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

0 commit comments

Comments
 (0)