johannesjh / req2flatpak

Convert Python package requirements to Flatpak build manifests
https://johannesjh.github.io/req2flatpak/
MIT License
21 stars 2 forks source link

pre-commit fails locally on Python 3.12 #78

Open cbm755 opened 4 months ago

cbm755 commented 4 months ago

Just copy-pasting my comment from https://github.com/johannesjh/req2flatpak/issues/72#issuecomment-2212317971:

pylama has not kept up with recent Python versions and seems broken on Python 3.12: https://github.com/klen/pylama/pull/254, https://github.com/klen/pylama/issues/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 commented 4 months ago

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 commented 4 months ago

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?