refactor: move UV index config into pre-commit hook

Make uv-lock pre-commit hook smart about release branches by wrapping it
in a script that detects release branches and sets UV_EXTRA_INDEX_URL.

This allows the same pre-commit config to work locally and in CI without
special environment variable setup in workflows.

Changes:
- Add scripts/pre-commit-uv-lock.sh wrapper that detects release branches
- Move uv-lock from astral-sh/uv-pre-commit to local hook using wrapper
- Remove UV env var setup from pre-commit workflow (hook handles it)
- Regenerate uv.lock with test.pypi as extra index (not primary)
This commit is contained in:
Ashwin Bharambe 2025-10-31 07:37:20 -07:00
parent 8ebb9195a4
commit 83176acd88
4 changed files with 830 additions and 847 deletions

View file

@ -52,10 +52,6 @@ repos:
additional_dependencies:
- black==24.3.0
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.20
hooks:
- id: uv-lock
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.16.1
@ -78,6 +74,15 @@ repos:
- repo: local
hooks:
- id: uv-lock
name: uv-lock
additional_dependencies:
- uv==0.7.20
entry: ./scripts/pre-commit-uv-lock.sh
language: python
pass_filenames: false
require_serial: true
files: ^(pyproject\.toml|uv\.lock)$
- id: distro-codegen
name: Distribution Template Codegen
additional_dependencies: