astral-sh / astral-sh/uv-pre-commit

Feature request: Release to PyPI to allow for local pre-commit execution

Open
#31 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
348
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Hi, I was wondering if you would consider releasing this to PyPI to allow for local execution. This is required for some organizations, where the CI cannot reach out to Github to retrieve the hook.

Example usage for `ruff`:
```
repos:
- repo: local
hooks:
- id: ruff
name: Run ruff linter
entry: ruff
args: [ "check", "--no-cache" ]
language: python
types: [ file, python ]
files: .*\.py$
```

If I use the following to try and use the regular `uv lock` (file names are provided to specify it should run only when one of those files is changed):
```
- id: check-uv-lock
name: UV lock file check
entry: uv lock --check
language: python
files: pyproject\.toml|uv\.lock
```

then notice that the file name is passed to the hook and it fails, which is of course the expected behaviour:

```
UV lock file check.......................................................Failed
- hook id: check-uv-lock
- exit code: 2

error: unexpected argument 'pyproject.toml'' found

Usage: uv lock [OPTIONS]

For more information, try '--help'.
```

Not providing `files` does not solve the problem, because then the hook is run on all files and their names are passed to `uv lock` as well.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue mentions pyproject.toml, uv.lock, and a pre-commit hook using `uv lock --check`; start by inspecting the repository's packaging and hook entry points. Confirm the release configuration and local hook behavior, then verify that a PyPI release can run without GitHub access and does not receive file names as arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
release, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.