A pre-commit hook that ensures uv is installed and available.
Works with both pre-commit and prek.
Add this to your .pre-commit-config.yaml:
repos:
- repo: https://github.com/bitflight-devops/pre-commit-ensure-uv
rev: v0.1.0
hooks:
- id: ensure-uvPlace it first in your repos list so uv is available for subsequent hooks.
| Condition | Action |
|---|---|
| uv in PATH | Pass silently |
| uv installed, not in PATH | Re-run hooks with corrected PATH |
| uv not installed | Install uv, then re-run with corrected PATH |
When uv needs to be added to PATH, the hook automatically re-runs all hooks with the corrected environment. No shell restart required.
- Linux
- macOS
- Windows
Uses the official uv installer:
- Unix:
curl -LsSf https://astral.sh/uv/install.sh | sh - Windows:
powershell irm https://astral.sh/uv/install.ps1 | iex
MIT