Skip to content

Difference versus pre-commit: prek inherits UV_RESOLUTION from the environment when installing hooks #1299

@adamtheturtle

Description

@adamtheturtle

When UV_RESOLUTION=lowest-direct is set in the environment (e.g., for testing a project's dependencies with lowest compatible versions), prek passes this through to uv when installing hooks.

This causes hook dependencies to resolve to ancient versions that may not build on modern Python. For example, pre-commit-hooks depends on ruamel-yaml, and with lowest-direct resolution, uv picks ruamel-yaml==0.15.0 (from 2017), which fails to build on Python 3.12+ with:

NameError: name 'Str' is not defined

Reproduction:

UV_RESOLUTION=lowest-direct UV_PYTHON=3.12 prek run --all-files --hook-stage pre-commit

With a .pre-commit-config.yaml that uses https://github.com/pre-commit/pre-commit-hooks


Either this behaviour should be changed in prek, or https://prek.j178.dev/quickstart/#already-using-pre-commit should mention it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions