{"library":"pre-commit-uv","title":"pre-commit-uv","description":"pre-commit-uv is a Python library that patches the `pre-commit` framework to use `uv` for creating virtual environments and installing packages for its hooks. This integration significantly speeds up the initial setup and caching operations of `pre-commit` hooks. Currently at version 4.2.1, the library is actively maintained with regular updates.","language":"python","status":"active","last_verified":"Wed Apr 15","install":{"commands":["pip install pre-commit-uv"],"cli":{"name":"pre-commit","version":"pre-commit 4.6.0 (pre-commit-uv=4.2.1, uv=0.11.14)"}},"imports":[],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"# 1. Install uv (if you haven't already)\n# curl -LsSf https://astral.sh/uv/install.sh | sh\n\n# 2. Install pre-commit with pre-commit-uv using uv's tool installer\nuv tool install pre-commit --with pre-commit-uv\n\n# 3. Initialize git repository (if not already one)\ngit init\n\n# 4. Create a .pre-commit-config.yaml file in your project root\n#    (e.g., to use ruff for formatting and linting)\n# .pre-commit-config.yaml\n# ---\n# repos:\n#   - repo: https://github.com/astral-sh/ruff-pre-commit\n#     rev: v0.4.0 # Use 'pre-commit autoupdate' to keep this updated\n#     hooks:\n#       - id: ruff\n#         args: [--fix, --exit-non-zero-on-fix]\n#       - id: ruff-format\n\n# 5. Install the git hooks\npre-commit install\n\n# 6. (Optional) Run all hooks manually once\npre-commit run --all-files\n\n# Now, pre-commit will automatically use uv when running hooks.","lang":"bash","description":"To get started, install `pre-commit` using `uv`'s tool installer, ensuring `pre-commit-uv` is included as a plugin. Once installed, configure your `.pre-commit-config.yaml` with your desired hooks. `pre-commit-uv` automatically patches `pre-commit` to use `uv` for managing the hook environments, improving performance without changes to your hook configurations.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}