Skip to content

Conversation

jamesbraza
Copy link
Collaborator

This PR upgrades our developer tooling:

  • Modernizes our setup-uv parameters
    • UV_PROJECT_ENVIRONMENT --> activate-environment parameter
    • uv python pin --> python-version parameter
  • Having pre-commit config use uv-managed venv for mypy, decoupling from local venv
  • Moves from pre-commit to its Rust port prek for speed (and 🌲)

@jamesbraza jamesbraza self-assigned this Sep 22, 2025
@jamesbraza jamesbraza added the enhancement New feature or request label Sep 22, 2025
@Copilot Copilot AI review requested due to automatic review settings September 22, 2025 18:29
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 22, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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 with prek for improved performance
  • Updates GitHub Actions to use modern setup-uv parameters (python-version and activate-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.

Copy link

dosubot bot commented Sep 22, 2025

Related Documentation

Checked 1 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

@jamesbraza jamesbraza force-pushed the prek branch 4 times, most recently from 12c5246 to bd492d8 Compare September 22, 2025 19:23
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Sep 22, 2025
@jamesbraza jamesbraza changed the title Adopting prek over pre-commit Adopting prek over pre-commit, setup-uv's python-version Sep 22, 2025
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Sep 22, 2025
- 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
Copy link
Collaborator Author

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`
Copy link
Collaborator Author

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

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 22, 2025
@jamesbraza jamesbraza merged commit ec78894 into main Sep 24, 2025
9 of 10 checks passed
@jamesbraza jamesbraza deleted the prek branch September 24, 2025 02:48
Copy link

dosubot bot commented Sep 24, 2025

Documentation Updates

Checked 1 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants