Adopting prek over pre-commit, setup-uv's python-version#1098
Adopting prek over pre-commit, setup-uv's python-version#1098jamesbraza merged 9 commits intomainfrom
prek over pre-commit, setup-uv's python-version#1098Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR modernizes the developer tooling by transitioning from pre-commit to prek (a faster Rust implementation) and updating setup-uv configuration to use newer parameter names. The changes aim to improve developer experience through faster pre-commit hooks and simplified CI configuration.
- Replaces
pre-commitdependency withprekfor improved performance - Updates GitHub Actions to use modern
setup-uvparameters (python-versionandactivate-environment) - Configures mypy to use uv-managed environment with
--frozenflag to prevent local venv mutations
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pyproject.toml | Replaces pre-commit dependency with prek |
| .pre-commit-config.yaml | Updates mypy hook to use uv-managed environment and excludes uv.lock from checks |
| .github/workflows/tests.yml | Modernizes setup-uv configuration and switches to prek-action |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
12c5246 to
bd492d8
Compare
prek over pre-commitprek over pre-commit, setup-uv's python-version
| - uses: astral-sh/setup-uv@v6 | ||
| with: | ||
| enable-cache: true | ||
| - run: echo "UV_PROJECT_ENVIRONMENT=$(python -c "import sysconfig; print(sysconfig.get_config_var('prefix'))")" >> $GITHUB_ENV |
There was a problem hiding this comment.
This UV_PROJECT_ENVIRONMENT tricked uv into installing into system Python.
Using activate-environment from setup-uv eliminates the need for this complexity
| - run: echo "UV_PROJECT_ENVIRONMENT=$(python -c "import sysconfig; print(sysconfig.get_config_var('prefix'))")" >> $GITHUB_ENV | ||
| - run: uv python pin ${{ matrix.python-version }} # uv requires .python-version to match OS Python: https://github.com/astral-sh/uv/issues/11389 | ||
| - run: uv sync --python-preference only-system | ||
| - run: git checkout .python-version # For clean git diff given `pre-commit run --show-diff-on-failure` |
There was a problem hiding this comment.
We avoid this by just specifying the Python version to setup-uv directly
This PR upgrades our developer tooling:
setup-uvparametersUV_PROJECT_ENVIRONMENT-->activate-environmentparameteruv python pin-->python-versionparameterpre-commitconfig useuv-managed venv formypy, decoupling from local venvpre-committo its Rust portprekfor speed (and 🌲)