-
Notifications
You must be signed in to change notification settings - Fork 775
Adopting prek
over pre-commit
, setup-uv
's python-version
#1098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-commit
dependency withprek
for improved performance - Updates GitHub Actions to use modern
setup-uv
parameters (python-version
andactivate-environment
) - Configures mypy to use uv-managed environment with
--frozen
flag 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-commit
prek
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We avoid this by just specifying the Python version to setup-uv
directly
This PR upgrades our developer tooling:
setup-uv
parametersUV_PROJECT_ENVIRONMENT
-->activate-environment
parameteruv python pin
-->python-version
parameterpre-commit
config useuv
-managed venv formypy
, decoupling from local venvpre-commit
to its Rust portprek
for speed (and 🌲)