pyscaffold/pyscaffoldext-dsproject

.pre-commit-hooks.yaml does not exist

FlorianWilhelm opened this issue · 6 comments

Currently, the unit tests on master fail for Mac since .pre-commit-hooks.yaml does not exist when running pre-commit..
@abravalheri Do you have any idea why this happens for Mac? I am kind of lost on that one :-/

That is surprising! Specially because the logs clearly say it was created (create my_project/.pre-commit-config.yaml). It looks like there is a problem with the cwd (it is looking for /Users/anka/.cache/pre-commit/repo_du3uz9s/.pre-commit-hooks.yaml but I think the root directory should not be that one)... I will try to have a proper look on this issue later today or during the weekend. It is very weird indeed...

Correction:
/Users/anka/.cache/pre-commit/repo_du3uz9s/.pre-commit-hooks.yaml refers to the location pre-commit is downloading the hooks themselves not where we define things... I just faced the same problem in a draft PR in PyScaffold itself.
It seems that pre-commit released a new version 8 days ago... It might be the case the cache we keep in the CI is not compatible with the new version... Unfortunately I could not find a way of cleaning the cache in Cirrus, so what I might do is to comment out the cache part in the .cirrus-ci.yml file in a commit and then bring them back in the next commit. (But it is all speculation from my part)

So I ended up misusing a draft PR that I had open at PyScaffold to investigate this issue...
As I suspected, it seems that the cache is what is problematic. When I simply removed pre-commit caching, the tests worked, and then when I put it back, they stopped working (probably Cirrus CI downloaded an old cache?). The other solution is to keep the cache but use a fingerprint as indicated in this commit...

Wow, thanks! It's strange though that it only happens for MacOS. Should we better remove the cache then?

That is something I am still unsure...
In PyScaffold removing the cache increases the test times in a few minutes (2 to 3), but the alternative of using fingerprints adds complexity...

I guess we can remove it from the templates, until cirruslabs/cirrus-ci-docs#379 is available...

Hi @FlorianWilhelm, I released a v4.0rc2 just in case the main repository is blocking this issue, and I also see you did the changes in the dev branch.

Hopefully, everything is right now 🤞

Thanks, @abravalheri for finding out the reasons for this strange bug!