-
Notifications
You must be signed in to change notification settings - Fork 88
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
Repo versions <=13.0: pylint in pre-commit broken on Python 3.11 #174
Comments
I think the option 2 seems the best for current development environments, where older versions of Python are not available. |
Option 2 should be reasonably safe, since we enable pylint-odoo checks explicitly, so if there are no bugs in pylint-odoo, upgrading pylint-odoo should not trigger new errors. OTOH, it's only a matter of time until a pinned hook version will break with a new python version, especially since (like it or not) python is accelerating the deprecation rate of very old stdlib components. So since we already require python 3.6, it may be better to pin to that version for all hooks, so I lean towards option 1. |
Maybe we just don't need to pin python versions. After all, pre-commit hooks are related to the dev env, not to odoo itself. Odoo should be version-pinned indeed. But you can't expect today's dev laptops to have python 3.6. Since the template update is manual, made on demand, old repos will keep using old python versions for linters until updated. When updated, they'll use modern versions. And also there'll be some new linter/formatter violations, but again, since it's a manual process, it'll be fixed during that same process. Makes sense? |
I contest this. You need an older version of Python to develop Odoo 12 anyway. This means either:
So it's reasonably likely to assume that the people working on Odoo 12 modules have access to an old version of Python. If we don't pin the version in pre-commit, it will default to I admit, though, that pinning a specific version of Python in pre-commit is rather stupid and ugly. But something needs to give somewhere. |
Sorry, you're right. I've been for long time without a specific python interpreter installed because my dev docker image contained the appropriate one for Odoo. However indeed, pinning the python version in OTOH it's really not necessary to have linters run in the same python version as Odoo. Linters running under python 3.11 are perfectly able to analyze code written for python 3.6. As @sbidoul said, this problem is only gonna get worse as Python releases and deprecation cycles is faster now. Please check #175 where I propose a viable definitive solution to all these problems. |
So we agree to pin on python 3.6 for Odoo < 14 and the pre-commit job? BTW, we also need to pin the GitHub action image to ubuntu-20.04 here. |
Module
The name of the module that has a bug.
Tested on https://github.com/OCA/cooperative
Describe the bug
A clear and concise description of what the bug is.
On Fedora 37 with Python 3.11, when running pre-commit, the pylint step breaks.
Output
To Reproduce
Affected versions: 13.0 and lower. I've only tested 12.0.
Steps to reproduce the behavior:
pre-commit run --all-files
Expected behavior
A clear and concise description of what you expected to happen.
The test works.
Additional context
Add any other context about the problem here. (e.g. OS, Python version, ...)
Fedora 37, Python 3.11.
Related to GrahamDumpleton/wrapt#196
Snippet of the broken hook:
I see three solutions:
The text was updated successfully, but these errors were encountered: