OCA / oca-addons-repo-template

OCA Repository Template
MIT License
55 stars 88 forks source link

AttributeError: 'EntryPoints' object has no attribute 'get' #257

Open zamberjo opened 3 months ago

zamberjo commented 3 months ago

Error when executing pre-commit with python3.12 (odoov16 I don't know if the same thing happens in other versions, I haven't been able to test it yet)

trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
debug statements (python)................................................Passed
fix python encoding pragma...............................................Passed
check for case conflicts.................................................Passed
check docstring is first.................................................Passed
check that executables have shebangs.................(no files to check)Skipped
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
check xml................................................................Passed
mixed line ending........................................................Passed
pyupgrade................................................................Passed
isort except __init__.py.................................................Passed
Generate default setup.py for an addons directory........................Passed
Generate requirements.txt for an addons directory........................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

Traceback (most recent call last):
File "/root/.cache/pre-commit/repomm21bih1/py_env-python3/bin/flake8", line 8, in <module>
sys.exit(main())
^^^^^^
File "/root/.cache/pre-commit/repomm21bih1/py_env-python3/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main
app.run(argv)
File "/root/.cache/pre-commit/repomm21bih1/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 363, in run
self._run(argv)
File "/root/.cache/pre-commit/repomm21bih1/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 350, in _run
self.initialize(argv)
File "/root/.cache/pre-commit/repomm21bih1/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 330, in initialize
self.find_plugins(config_finder)
File "/root/.cache/pre-commit/repomm21bih1/py_env-python3/lib/python3.12/site-packages/flake8/main/application.py", line 153, in find_plugins
self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/pre-commit/repomm21bih1/py_env-python3/lib/python3.12/site-packages/flake8/plugins/manager.py", line 356, in __init__
self.manager = PluginManager(
^^^^^^^^^^^^^^
File "/root/.cache/pre-commit/repomm21bih1/py_env-python3/lib/python3.12/site-packages/flake8/plugins/manager.py", line 238, in __init__
self._load_entrypoint_plugins()
File "/root/.cache/pre-commit/repomm21bih1/py_env-python3/lib/python3.12/site-packages/flake8/plugins/manager.py", line 254, in _load_entrypoint_plugins
eps = importlib_metadata.entry_points().get(self.namespace, ())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'EntryPoints' object has no attribute 'get'

pylint with optional checks..............................................Passed
- hook id: pylint_odoo
- duration: 10.3s
Check for Odoo modules using pylint......................................Passed

I have checked that in python3.11 it works correctly, and that the python bin to use is python3, maybe we should pine it for the moment to python3.11?

PS: I got the trace from a docker container, not that I run it with root :P

legalsylvain commented 3 months ago

This looks quite similar to this PR, dont you think ?

https://github.com/OCA/oca-addons-repo-template/pull/243

Could you review it ? Thanks !

zamberjo commented 3 months ago

I had not seen it sorry, it looks pretty good, much better than pinning the Python version.

I'll check it out, thanks @legalsylvain