GeezerVison is showing github.com — Allow to pass features to cargo install in rust hooks · Issue #3230 · pre-commit/pre-commit
Allow to pass features to cargo install in rust hooks #3230
Description
search you tried in the issue tracker
rust features
describe your actual problem
The rust hooks execute cargo install --bins --root <root-dir> <packages> (taken from here) to install the hook, however if a hook wants to use a different set of features than its default features it can't because there's no way to pass either additional flags to the install command or a --features <features> to cargo command.
See JohnnyMorganz/StyLua#867 for a real world example where this has become a limitation.
It would be great to have a way to configure a hook to pass cargo additional features when building the hook's package.
pre-commit --version
3.7.1
Activity
asottile commented on Jun 12, 2024
I suspect this should just work through additional_dependencies, similar to how it's used for python
Terseus commented on Jun 12, 2024
@asottile
I suspect this should just work through additional_dependencies, similar to how it's used for python
Right now in rust that option is already in use:
When specifying additional_dependencies for Rust, you can use the syntax {package_name}:{package_version} to specify a new library dependency (used to build your hook repo), or the special syntax cli:{package_name}:{package_version} for a CLI dependency (built separately, with binaries made available for use by hooks).
Maybe we could add a new syntax for additional_dependencies in that e.g. values like feature-name could be passed as --features name.
asottile commented on Jun 12, 2024
yes I mean I suspect we can just send any arguments along to cargo install that don't fit the current format
added 3 commits that reference this issue
on Jun 15, 2024This issue will close once commit 1e5fc7f is merged into the 'main' branch.1e5fc7f This issue will close once commit 19f46ae is merged into the 'main' branch.19f46ae This issue will close once commit bd153a6 is merged into the 'main' branch.bd153a6
Metadata
Metadata
Development
No branches or pull requestsIssue actions