Christopher Tyler

Install pre-commit with uv

Nice short article from Adam. A good reminder that using uv to install tools is a great way to keep the tool up to date as opposed to installing the tool in each virtual environment. Below is an excerpt from Adam’s article.

1
$ uv tool install pre-commit --with pre-commit-uv

The install command also adds pre-commit-uv, a plugin that patches pre-commit to use uv to install Python-based tools. This drastically speeds up using Python-based hooks, a common use case. (Unfortunately, it seems pre-commit itself won’t be adding uv support.)

With pre-commit installed globally, you can now install its Git hook in relevant repositories per usual:

1
2
3
$ cd myrepo
$ pre-commit install
pre-commit installed at .git/hooks/pre-commit

<< Previous Post

|

Next Post >>

#Python #Pre-Commit #Uv #Adam Johnson