iterative / dvc

🦉 Data Versioning and ML Experiments
https://dvc.org
Apache License 2.0
13.96k stars 1.19k forks source link

Update `pre-commit` to use pinned version of `dvc` and correct stage names #10621

Closed mkdjr closed 1 week ago

mkdjr commented 2 weeks ago

1. Pin rev argument in pre-commit-config.yaml writer

The pre-commit package recommends against using mutable references such as main, as the version of the package pulled in the hook (in this case dvc), does not get updated after the first time pre-commit installs it. This PR addresses this by instead pinning the hooks to dvc v3.56.0. This change is made with the goal of:

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 of ruff and updates the version pointer in the pre-commit-hooks.yaml file. Maybe dvc could do something like this in the future to automate the pre-commit-hooks.yaml update process.

2. Update stages keywords

Additionally, pre-commit has now deprecated the acceptable values for the stages keyword for hooks. I have updated the dvc install command and the pre-commit-hooks.yaml file to reflect this change.

As this change was made in pre-commit v3.2.0, the dvc hooks now require pre-commit to be updated to at least v3.2.0.

Closes #9897.

Associated documentation PR: https://github.com/iterative/dvc.org/pull/5323.

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 91.01%. Comparing base (2431ec6) to head (6353ed5). Report is 4 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #10621 +/- ## ========================================== + Coverage 90.68% 91.01% +0.32% ========================================== Files 504 504 Lines 39795 39797 +2 Branches 3141 3141 ========================================== + Hits 36087 36220 +133 + Misses 3042 2948 -94 + Partials 666 629 -37 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

shcheklein commented 2 weeks ago

thanks @mkdjr ! Is it still in draft, needs more testing?

mkdjr commented 2 weeks ago

Oh yeah, I forgot to take it out of its drafted state. I think it's good to go, but should probably be followed up with a future PR to automate updating the rev field as dvc gets new releases.