Install pre-commit with uv

Install pre-commit with uv

May 14, 2025

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.

$ 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:

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