Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pre-commit.com: Same version in .pre-commit-config.yaml and requirements.txt

I would like to use the exactly same version of flake8 in requirements.txt and in .pre-commit-config.yaml.

To avoid redundancy I would like to keep the version number of flake8 exactly once in my repo.

Can pre-commit.com read the version number of flake8 from requirements.txt?

like image 515
guettli Avatar asked May 03 '26 19:05

guettli


1 Answers

it cannot

pre-commit intentionally does not read from the repository under test as this makes caching intractable

you can read more in this issue and the many duplicate issues linked there

for me, I no longer include flake8, etc. in my requirements files as pre-commit replaces the need to install linters / code formatters elsewhere


disclaimer: I created pre-commit

like image 167
Anthony Sottile Avatar answered May 05 '26 09:05

Anthony Sottile



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!