Add opt-in hash-locked installs for Python hooks#3680
Closed
bc-lee wants to merge 4 commits into
Closed
Conversation
Contributor
Author
|
Just leaving a short comment and closing the issue does not seem right to me, even though this is your repository. I believe this is a legitimate use case, and I hope we can discuss it here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add opt-in
python_lockfilesupport forlanguage: pythonhooks.When set, pre-commit installs Python hook environments by:
python -mpip install --require-hashes -r <python_lockfile>python -mpip install --no-deps --no-build-isolation .The lockfile path is resolved relative to the config file, and its content SHA256 is included in the hook/cache identity. Default Python hook behavior is unchanged.
Why
additional_dependenciesis appended to the normalpip install .hook install. It can reference extra packages or a requirements file, but it does not provide the same behavior:This gives users an opt-in deterministic, hash-checked install path.
Fixes #3679