Feature request: Support installing hooks from pypi #2520
stephenfin
started this conversation in
Ideas
Replies: 2 comments
|
Interesting idea, but it’d take a fair bit of refactoring. I’ll think it through. |
0 replies
|
Thanks for taking a look at this 🙏 Would you be open to a PR (or rather, series of PRs) that attempted to tackle this? My rust-fu is still so-so, but I believe virtually all of the required functionality (mainly creating and caching Python venvs) is already implemented or would be easy to do with the
I believe the changes to |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
prek, likepre-commit, uses git repos as the main "distribution mechanism" for.pre-commit-hooks.yamlfiles. The main disadvantage of this approach is that git repos don't generally contain built source. Instead, you must build the binary yourself. How this is achieved varies depending on the package.Python packages on PyPI can be used to distribute non-Python binaries (e.g. cmake). This appears to be specific to PyPI and the likes of Cargo or Maven don't appear to support this. Binaries provided this way don't need to be built, avoiding the need for hacks like https://github.com/astral-sh/ruff-pre-commit/. In addition, Python packages provide the ability to distribute files like
.pre-commit-hooks.yaml(via data files).Would it be possible to support installation of hooks from PyPI, perhaps with changes to
prek.tomllike below?We may wish to build on this further to add support for distributing plugins via other mechanisms that are well suited to binary distribution (GitHub Releases?) but that's out-of-scope for here.
All reactions