-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
pre-commit fails to initialize due to python 3.8 dependency #12868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
I don't think we should hard-code the Python version used to run mypy at all. This was done in #12747 so that mypy catches old typing usage that doesn't exist in newer versions - but mypy already supports setting that independently from the version used to run it. @nicoddemus was this a deliberate decision, or were you just not aware of the mypy setting? To be fair I didn't test if it works with the scenario in #12744, but I'd expect it to. |
Opened #12869 to test in CI |
I was not aware at all, passing the argument is of course much better! 👍 |
Fixed by #12869. |
I wrestled with this pre-commit issue when trying to contribute a PR yesterday and could not find pointers in the issues or discussions, so I'm at least dumping my findings here. To be discussed if/how this has to be documented properly somewhere.
With #12747 (end of August) the pre-commit run explicitly depends on python 3.8:
pytest/.pre-commit-config.yaml
Lines 33 to 36 in a14c718
(python 3.8 is EOL since this week, but that's not the actual problem here, I would have had the same issue with 3.9)
Running pre-commit failed on me during pre-commit update, e.g.:
After some rabbit hole crawling I figured out that I have to make sure that virtualenv (used by pre-commit) is able to resolve "3.8" to an actual interpreter on my system.
from https://virtualenv.pypa.io/en/latest/user_guide.html#python-discovery:
I'm using asdf (which uses pyenv under the hood) and luckily had still a 3.8 version around. I found the direct (non-shimmed) path to the executable with
And appended the containing folder to my
PATH
when triggering the pre-commit update:pre-commit then could successfully update/install the hooks, and I could commit again
The text was updated successfully, but these errors were encountered: