One workaround that I used in the past was to force pre-commit to install current project. Be warned that while this works is not supported by the author of pre-commit in any way, in fact being actively discouraged, mainly because it prevents pre-commit from using immutable caches.
Once the virtualenv is created it will not be updated again and pre-commit does not have any command line option to tell to not trust local cache. If you get into errors your only option is to reset the entire pre-commit disk cache, this likely means removing gigabytes of data from ~/.cache./pre-commit
when you run pre-commit clean
. Doing that will slowdown running pre-commit on all other projects you have... :(
Ideally the tool should have an option to invalidate only the environments from the current project and not entire cache.
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v3.0.0a3
hooks:
- id: pylint
additional_dependencies:
- . # <-- that makes it install current project
- flaky