Update pre-commit default language version#2185
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the pre-commit configuration to use a generic python3 version instead of the hardcoded python3.10, resolving an error for developers using Python 3.11 or other supported versions.
Key Changes:
- Changed
default_language_version.pythonfrompython3.10topython3to allow pre-commit to use any available Python 3 interpreter
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2185 +/- ##
=======================================
Coverage 97.84% 97.84%
=======================================
Files 94 94
Lines 6038 6038
=======================================
Hits 5908 5908
Misses 130 130 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| # See https://pre-commit.com/hooks.html for more hooks | ||
| default_language_version: | ||
| python: python3.10 | ||
| python: python3 |
There was a problem hiding this comment.
This fails if the person has Python 3.9 installed their local environment. We can pin to another version
There was a problem hiding this comment.
Python 3.9 has reached EOL, and we decided to drop support for Python 3.9
There was a problem hiding this comment.
I have a Python 3.11 virtual environment, and I'm hitting an issue. I try to follow the Airflow setting https://github.com/apache/airflow/blob/main/.pre-commit-config.yaml, but please let me know if you want me to test for some other version
There was a problem hiding this comment.
@pankajastro I fully understand, but developers may still have Python 3.9 installed in their local environment, and - this happened to me - unless we tell pre-commit, it may get the incorrect version of Python, which will conflict with pre-commit hooks that do not support that version.
It would be great if we set the minimum acceptable version, or at least the same version that the CI uses. I'm happy for that to be Python 3.11.
To set just Python 3 is not sufficient, I'm afraid
There was a problem hiding this comment.
developers may still have Python 3.9 installed in their local environment
I think they should move to Python 3.10 or newer, given pre-commit needs Python 3.10 or newer https://github.com/pre-commit/pre-commit/blob/main/setup.cfg#L26
It would be great if we set the minimum acceptable version
I checked the docs but could not find a way to set the Python min version. Maybe if we want, we can have a local pre-commit
at least the same version that the CI uses
Which CI job are you referring to? I think we run with multiple Python versions, except fews jobs
I'm happy for that to be Python 3.11.
If we set the default to Python 3.11, then it may cause issues for the contributor having Python version 3.10, or 3.12
Please do let me know how we should handle this.
3cda897 to
4cdb139
Compare
|
Closing this since the issue was solved in #2190 |
|
@pankajastro @tatiana -- I am not sure if this PR could solve the issue, or if we need another fix. But my local commits with branches cut from the latest |
@pankajkoti I tested this PR locally using a Python 3.11 virtual environment, and it worked. I'm also using |
I'm using Python 3.11 virtual environment and getting below error
Changed default_language_version.python from python3.10 to python3 to allow pre-commit to use any available Python 3 interpreter