From e76f77d7111bb227f6d563ce91d102a0708581f4 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 30 Sep 2024 14:42:59 -0500 Subject: [PATCH] Use uv in contribution document (#13540) --- CONTRIBUTING.md | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 79554593a2..8e0f6295d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,16 +29,14 @@ You'll also need [Insta](https://insta.rs/docs/) to update snapshot tests: cargo install cargo-insta ``` -And you'll need pre-commit to run some validation checks: - -```shell -pipx install pre-commit # or `pip install pre-commit` if you have a virtualenv -``` +You'll need [uv](https://docs.astral.sh/uv/getting-started/installation/) (or `pipx` and `pip`) to +run Python utility commands. You can optionally install pre-commit hooks to automatically run the validation checks when making a commit: ```shell +uv tool install pre-commit pre-commit install ``` @@ -66,7 +64,7 @@ and that it passes both the lint and test validation checks: ```shell cargo clippy --workspace --all-targets --all-features -- -D warnings # Rust linting RUFF_UPDATE_SCHEMA=1 cargo test # Rust testing and updating ruff.schema.json -pre-commit run --all-files --show-diff-on-failure # Rust and Python formatting, Markdown and Python linting, etc. +uvx pre-commit run --all-files --show-diff-on-failure # Rust and Python formatting, Markdown and Python linting, etc. ``` These checks will run on GitHub Actions when you open your pull request, but running them locally @@ -267,26 +265,20 @@ To preview any changes to the documentation locally: 1. Install the [Rust toolchain](https://www.rust-lang.org/tools/install). -1. Install MkDocs and Material for MkDocs with: - - ```shell - pip install -r docs/requirements.txt - ``` - 1. Generate the MkDocs site with: ```shell - python scripts/generate_mkdocs.py + uv run --no-project --isolated --with-requirements docs/requirements.txt scripts/generate_mkdocs.py ``` 1. Run the development server with: ```shell # For contributors. - mkdocs serve -f mkdocs.public.yml + uvx --with-requirements docs/requirements.txt -- mkdocs serve -f mkdocs.public.yml # For members of the Astral org, which has access to MkDocs Insiders via sponsorship. - mkdocs serve -f mkdocs.insiders.yml + uvx --with-requirements docs/requirements-insiders.txt -- mkdocs serve -f mkdocs.insiders.yml ``` The documentation should then be available locally at @@ -368,9 +360,8 @@ GitHub Actions will run your changes against a number of real-world projects fro report on any linter or formatter differences. You can also run those checks locally via: ```shell -pip install -e ./python/ruff-ecosystem -ruff-ecosystem check ruff "./target/debug/ruff" -ruff-ecosystem format ruff "./target/debug/ruff" +uvx --from ./python/ruff-ecosystem ruff-ecosystem check ruff "./target/debug/ruff" +uvx --from ./python/ruff-ecosystem ruff-ecosystem format ruff "./target/debug/ruff" ``` See the [ruff-ecosystem package](https://github.com/astral-sh/ruff/tree/main/python/ruff-ecosystem) for more details.