Proposal: make language_version more intuitive or create minimum_language_version
See original GitHub issuePlease consider the situation below:
Hook creator knows that the hook cannot run on Python 2. The creator adds language_version: python3
to the hook definition.
User has two Python 3 versions installed: Python 3.9 and Python 3.10. Python 3.9 is the system default, but the user wants to run all hooks with Python 3.10. The user specifies default_language_version
to python3.10.
Hook runs on python3.9, because currently language_version
causes default_language_version
to be completely ignored.
Proposal:
If the default_language_version
matches language_version
, use the one that is more specific. In the case above it would be default_language_version
.
Example:
language_version
set to python3
default_language_version
set to python3.10
Expected result:
Run hook with python3.10 because default_language_version
matches language_version
. Do not run with python3.9 or any other version that does not match both language_version
and default_language_version
.
Example:
language_version
set to python3.10
default_language_version
set to python3.10.2
Expected result:
Run hook with python3.10.2 because default_language_version
matches language_version
. Do not run with python3.10.1 or any other version that does not match both language_version
and default_language_version
.
Example:
language_version
set to python3.7
default_language_version
set to python3.10
Expected result:
Run hook with python3.7 because default_language_version
does not match language_version
.
Another way that this issue could be solved:
Create minimum_language_version
parameter that will indicate minimum language version and let hook creators use it instead of language_version
for such cases.
Issue Analytics
- State:
- Created 9 months ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
version parsing for pre-commit versions is trivial because I control the version string
version parsing for version strings which are passed to arbitrary third party tools is intractable and trying to do so would be error prone, complicated, and confusing to end users
yeah again, not happening as decided before. please stop re litigating prior decisions