https://github.com/bitflight-devops/pre-commit-ensure-uv
Install Astral's uv if its not installed as a pre-commit/prek hook
https://github.com/bitflight-devops/pre-commit-ensure-uv
Last synced: 3 months ago
JSON representation
Install Astral's uv if its not installed as a pre-commit/prek hook
- Host: GitHub
- URL: https://github.com/bitflight-devops/pre-commit-ensure-uv
- Owner: bitflight-devops
- License: mit
- Created: 2025-12-08T14:32:37.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-12-11T19:59:15.000Z (6 months ago)
- Last Synced: 2025-12-12T18:11:17.943Z (6 months ago)
- Language: Python
- Size: 74.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pre-commit-ensure-uv
A [pre-commit](https://pre-commit.com/) hook that ensures [uv](https://github.com/astral-sh/uv) is installed and available.
Works with both [pre-commit](https://pre-commit.com/) and [prek](https://github.com/j178/prek).
## Usage
Add this to your `.pre-commit-config.yaml`:
```yaml
repos:
- repo: https://github.com/bitflight-devops/pre-commit-ensure-uv
rev: v0.1.0
hooks:
- id: ensure-uv
```
Place it **first** in your repos list so uv is available for subsequent hooks.
## Behavior
| 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.
## Platform Support
- Linux
- macOS
- Windows
## Installation Method
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`
## License
MIT