From f5add0ca5e2711396e033741375049d0454730f4 Mon Sep 17 00:00:00 2001 From: Udi Oron Date: Mon, 16 Dec 2024 21:38:57 +0200 Subject: [PATCH] docs: added pre-commit uv-lock and uv-export hooks to docs (#9872) ## Summary ## Test Plan --------- Co-authored-by: Jonne --- docs/guides/integration/pre-commit.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/guides/integration/pre-commit.md b/docs/guides/integration/pre-commit.md index e8a6ae9e1..8f91365af 100644 --- a/docs/guides/integration/pre-commit.md +++ b/docs/guides/integration/pre-commit.md @@ -3,6 +3,27 @@ An official pre-commit hook is provided at [`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 +pre-commit, add the following to the `.pre-commit-config.yaml`: + +```yaml title=".pre-commit-config.yaml" +- repo: https://github.com/astral-sh/uv-pre-commit + # uv version. + rev: 0.5.8 + hooks: + - id: uv-lock +``` + +To keep your `requirements.txt` file updated using pre-commit: + +```yaml title=".pre-commit-config.yaml" +- repo: https://github.com/astral-sh/uv-pre-commit + # uv version. + rev: 0.5.8 + hooks: + - id: uv-export +``` + To compile requirements via pre-commit, add the following to the `.pre-commit-config.yaml`: ```yaml title=".pre-commit-config.yaml"