Closed hugovk closed 2 years ago
One thing to note is that, teyit requires 3.9+ to work. From what I can assume python3
would mean any supported Python version, no?
The pre-commit docs say language_version
is for when "you only want to run the hooks on a specific version", not for setting a minimum version:
Let's look at isort again. It supports Python 3.6+ but sets language_version: python3
.
And Black also supports Python 3.6, but they removed language_version: python3
(https://github.com/psf/black/pull/2430).
Similarly, https://github.com/pre-commit/pre-commit-hooks/blob/main/.pre-commit-hooks.yaml doesn't specify language_version
.
Because language_version
is to define a specific version, if we had teyit specifying 3.9, isort specifying 3.6, and let's imagine another specifying 3.7.
See the error in the first message.
To fix it, I'd need to split the CI into three different linting runs on the CI, each only running for a specific Python version.
And to commit locally, I'd potentially need three versions of Python installed when 3.10 should be enough.
I see. Let's merge it as is then, thanks for the explanation @hugovk!
Thanks!
language_version
has to be completely removed from hook definition in order to use default_language_version
in .pre-commit-config.yaml
.
I'm mostly using Python 3.10 locally and for CI linting, and currently it fails like this:
Setting just
python3
should be enough. For example, compare https://github.com/PyCQA/isort/blob/c6a41965247a858a0afd848fbebfca18b8983917/.pre-commit-hooks.yaml.