Skip to content
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

pre-commit fails locally on Python 3.12 #78

Open
cbm755 opened this issue Jul 7, 2024 · 2 comments
Open

pre-commit fails locally on Python 3.12 #78

cbm755 opened this issue Jul 7, 2024 · 2 comments

Comments

@cbm755
Copy link
Collaborator

cbm755 commented Jul 7, 2024

Just copy-pasting my comment from #72 (comment):

pylama has not kept up with recent Python versions and seems broken on Python 3.12: klen/pylama#254, klen/pylama#249

AFAICT, pylama is a frontend to a bunch of linters: we might need to use those directly if upstream pylama doesn't make a new release.


Relatedly, it would seem our CI does not run on multiple Python versions, or perhaps this Poetry environment stuff means that its only tested with Python 3.8 (?) But at least on my system, the pre-commit uses my system Python and at least sometimes my system Poetry.

@cbm755
Copy link
Collaborator Author

cbm755 commented Jul 7, 2024

Local output:

pre-commit run --all
poetry-check.............................................................Passed
poetry-lock..............................................................Passed
Sync with Poetry.........................................................Passed
isort (python)...........................................................Passed
black....................................................................Passed
prettier.................................................................Passed
rstcheck.................................................................Passed
pylama...................................................................Failed
- hook id: pylama
- exit code: 1

Traceback (most recent call last):
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/bin/pylama", line 5, in <module>
    from pylama.main import shell
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/main.py", line 11, in <module>
    from pylama.check_async import check_async
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/check_async.py", line 8, in <module>
    from pylama.config import Namespace
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/config.py", line 13, in <module>
    from pylama.lint import LINTERS
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/lint/__init__.py", line 10, in <module>
    from pkg_resources import iter_entry_points
ModuleNotFoundError: No module named 'pkg_resources'
Traceback (most recent call last):
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/bin/pylama", line 5, in <module>
    from pylama.main import shell
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/main.py", line 11, in <module>
    from pylama.check_async import check_async
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/check_async.py", line 8, in <module>
    from pylama.config import Namespace
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/config.py", line 13, in <module>
    from pylama.lint import LINTERS
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/lint/__init__.py", line 10, in <module>
    from pkg_resources import iter_entry_points
ModuleNotFoundError: No module named 'pkg_resources'
Traceback (most recent call last):
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/bin/pylama", line 5, in <module>
    from pylama.main import shell
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/main.py", line 11, in <module>
    from pylama.check_async import check_async
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/check_async.py", line 8, in <module>
    from pylama.config import Namespace
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/config.py", line 13, in <module>
    from pylama.lint import LINTERS
  File "/home/cbm/.cache/pypoetry/virtualenvs/req2flatpak-GZG_Py0G-py3.12/lib/python3.12/site-packages/pylama/lint/__init__.py", line 10, in <module>
    from pkg_resources import iter_entry_points
ModuleNotFoundError: No module named 'pkg_resources'

bandit...................................................................Passed

@johannesjh
Copy link
Owner

That's right, pylama looks unmaintained, unfortunately. I guess we should switch to individual linters. (Because even if there was another tool like pylama?, it could also go extinct soon... and our existing pre-commit setup makes it reasonably easy to use multiple independent linters)

@real-yfprojects I think you set up our linters a while ago (thank you!), I'd be interested to hear your opinion, what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants