astral-sh / uv-pre-commit

Apache License 2.0
74 stars 7 forks source link

Running tools through pre-commit #14

Open eavanvalkenburg opened 2 months ago

eavanvalkenburg commented 2 months ago

I would like the ability to use uv tool run ruff with this! Especially ruff and mypy!

UnknownPlatypus commented 3 weeks ago

I don't understand the point of running uv tool via pre-commit. This seems like adding layers upon layers of indirection.

pre-commit is already a tool designed to install hook in isolated environment, similarly to what uv tool does.

Adding the feature you ask for would mean that pre-commit will create a venv inside which uv is installed to create a venv to install the tool you ask for. Maybe you are looking for https://github.com/tox-dev/pre-commit-uv, this project uses uv to handle the python venv creation inside pre-commit.

For ruff, I would recommended the supported pre-commit hook:

  - repo: https://github.com/charliermarsh/ruff-pre-commit
    rev: v0.6.1
    hooks:
      - id: ruff

For mypy there is https://github.com/pre-commit/mirrors-mypy (but mypy is slow, pre-commit is maybe not the right place to run it)