Update pre-commit
to use pinned version of dvc
and correct stage names
#10621
+7
β6
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.
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
1. Pin
rev
argument inpre-commit-config.yaml
writerThe
pre-commit
package recommends against using mutable references such asmain
, as the version of the package pulled in the hook (in this casedvc
), does not get updated after the first timepre-commit
installs it. This PR addresses this by instead pinning the hooks todvc
v3.56.0. This change is made with the goal of:pre-commit
warning, anddvc
version thatpre-commit
refers to whendvc
receives a new release.As a reference,
ruff
, the python linter and formatter, keeps its pre-commit hooks in a separate repository. This repository has its own pre-commit hooks that automatically pull the latest version ofruff
and updates the version pointer in thepre-commit-hooks.yaml
file. Maybedvc
could do something like this in the future to automate thepre-commit-hooks.yaml
update process.2. Update
stages
keywordsAdditionally,
pre-commit
has now deprecated the acceptable values for thestages
keyword forhooks
. I have updated thedvc install
command and thepre-commit-hooks.yaml
file to reflect this change.As this change was made in
pre-commit
v3.2.0, thedvc
hooks now requirepre-commit
to be updated to at least v3.2.0.Closes #9897.
Associated documentation PR: iterative/dvc.org#5323.