mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-15 15:05:03 +00:00
docs: Explicitly specify to add a new repo entry to the repos list item in the .pre-commit-config.yaml
(#10243)
<!-- Thank you for contributing to uv! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary When creating the `.pre-commit-config.yaml` from scratch, although following https://pre-commit.com/, it might be easy to overlook that the pre-commit repo examples need to be added below the `repos` list item to get a valid `yaml` file. Additionally, updated the version of the first two examples. ## Test Plan I followed the `CONTRIBUTING.md` and the result looked fine. --------- Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
parent
2db1630f54
commit
df00189ec5
1 changed files with 8 additions and 6 deletions
|
@ -10,8 +10,10 @@ description:
|
||||||
An official pre-commit hook is provided at
|
An official pre-commit hook is provided at
|
||||||
[`astral-sh/uv-pre-commit`](https://github.com/astral-sh/uv-pre-commit).
|
[`astral-sh/uv-pre-commit`](https://github.com/astral-sh/uv-pre-commit).
|
||||||
|
|
||||||
To make sure your `uv.lock` file is up to date even if your `pyproject.toml` file was changed via
|
To use uv with pre-commit, add one of the following examples to the `repos` list in the
|
||||||
pre-commit, add the following to the `.pre-commit-config.yaml`:
|
`.pre-commit-config.yaml`.
|
||||||
|
|
||||||
|
To make sure your `uv.lock` file is up to date even if your `pyproject.toml` file was changed:
|
||||||
|
|
||||||
```yaml title=".pre-commit-config.yaml"
|
```yaml title=".pre-commit-config.yaml"
|
||||||
repos:
|
repos:
|
||||||
|
@ -22,7 +24,7 @@ repos:
|
||||||
- id: uv-lock
|
- id: uv-lock
|
||||||
```
|
```
|
||||||
|
|
||||||
To keep your `requirements.txt` file updated using pre-commit:
|
To keep a `requirements.txt` file in sync with your `uv.lock` file:
|
||||||
|
|
||||||
```yaml title=".pre-commit-config.yaml"
|
```yaml title=".pre-commit-config.yaml"
|
||||||
repos:
|
repos:
|
||||||
|
@ -33,7 +35,7 @@ repos:
|
||||||
- id: uv-export
|
- id: uv-export
|
||||||
```
|
```
|
||||||
|
|
||||||
To compile requirements via pre-commit, add the following to the `.pre-commit-config.yaml`:
|
To compile requirements files:
|
||||||
|
|
||||||
```yaml title=".pre-commit-config.yaml"
|
```yaml title=".pre-commit-config.yaml"
|
||||||
repos:
|
repos:
|
||||||
|
@ -46,7 +48,7 @@ repos:
|
||||||
args: [requirements.in, -o, requirements.txt]
|
args: [requirements.in, -o, requirements.txt]
|
||||||
```
|
```
|
||||||
|
|
||||||
To compile alternative files, modify `args` and `files`:
|
To compile alternative requirements files, modify `args` and `files`:
|
||||||
|
|
||||||
```yaml title=".pre-commit-config.yaml"
|
```yaml title=".pre-commit-config.yaml"
|
||||||
repos:
|
repos:
|
||||||
|
@ -60,7 +62,7 @@ repos:
|
||||||
files: ^requirements-dev\.(in|txt)$
|
files: ^requirements-dev\.(in|txt)$
|
||||||
```
|
```
|
||||||
|
|
||||||
To run the hook over multiple files at the same time:
|
To run the hook over multiple files at the same time, add additional entries:
|
||||||
|
|
||||||
```yaml title=".pre-commit-config.yaml"
|
```yaml title=".pre-commit-config.yaml"
|
||||||
repos:
|
repos:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue