CI: Replace pre-commit with prek#119150
Conversation
akien-mga
left a comment
There was a problem hiding this comment.
Tested briefly, seems fine to me.
We need to update our documentation on how to set-up prek.
I was worried it would require users to have cargo to compile it, but it seems there's a lot of options (too many?) for binary installs: https://github.com/j178/prek#installation
We should figure out what to recommend for our contributors so the steps to set up prek aren't more complex than pre-commit (especially regarding having it in PATH). It seems it's provided as a pip package so pip install prek is at least something we can expect all contributors with a Python/SCons setup to be able to run.
|
For future reference, these are the hook runtimes on my system with prek using The two hooks that take the most time by a wide margin are Regarding the installation process, The DetailsPC specifications
|
Prek is the latest in a line of toolkits written in Rust meant to serve as drop-in replacements for industry-standard tools. This time, it's a replacement for pre-commit itself, and a damn good one at that. Comparing this repo's action runs, prek's action from a clean base took ~14 seconds, while pre-commit's cached action took ~25 seconds
Prek was ~11 seconds faster without a cache than pre-commit with a cache
It truly is a drop-in replacement, as the tool reads from
.pre-commit-config.yamlwithout issue. This means that users utilizingpre-commitdirectly may continue to do so at this time. It's entirely capable of reading from its own dedicated file—prek.toml—and supports unique configurations which aren't supported by pre-commit, but this PR aims to be as painless of a drop-in replacement as possible. It's unique options and dedicated file can be pursued in a followup, if desired