klen / pylama

Code audit tool for python.
MIT License
1.05k stars 99 forks source link

8.3.8: breakage with pyflakes 2.5.0 #224

Closed bje- closed 2 years ago

bje- commented 2 years ago

Running pylama with pyflakes 2.5.0 installed gives:

Traceback (most recent call last):
  File "/home/bje/.local/bin/pylama", line 5, in <module>
    from pylama.main import shell
  File "/home/bje/.local/lib/python3.8/site-packages/pylama/main.py", line 11, in <module>
    from pylama.check_async import check_async
  File "/home/bje/.local/lib/python3.8/site-packages/pylama/check_async.py", line 8, in <module>
    from pylama.config import Namespace
  File "/home/bje/.local/lib/python3.8/site-packages/pylama/config.py", line 13, in <module>
    from pylama.lint import LINTERS
  File "/home/bje/.local/lib/python3.8/site-packages/pylama/lint/__init__.py", line 56, in <module>
    import_module(f"{__name__}.{pname}")
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/bje/.local/lib/python3.8/site-packages/pylama/lint/pylama_pyflakes.py", line 12, in <module>
    m.RedefinedInListComp.message: "W0621",
AttributeError: module 'pyflakes.messages' has no attribute 'RedefinedInListComp'
luto commented 2 years ago

FYI: how to fix this in pre-commit for now

  - repo: https://github.com/klen/pylama
    rev: 8.3.8
    hooks:
      - id: pylama
        additional_dependencies:
          - pyflakes==2.4.0

==2.4.0 is not optimal, but at the time of writing it's the newest working version and I prefer pinning a specific, working on in this case.

bje- commented 2 years ago

Thanks! Will a new pylama version go up on PyPI soon?

Mausy5043 commented 1 year ago

I'm getting still this error with pyflakes v3.0.1 called by pylama v7.7.1.

Is the advise to pin pyflakes at v2.4.0 still valid?

Traceback (most recent call last):
  File "/Users/maurice/miniconda3/envs/lektrix/bin/pylama", line 6, in <module>
    from pylama.main import shell
  File "/Users/maurice/miniconda3/envs/lektrix/lib/python3.9/site-packages/pylama/main.py", line 8, in <module>
    from .config import parse_options, CURDIR, setup_logger
  File "/Users/maurice/miniconda3/envs/lektrix/lib/python3.9/site-packages/pylama/config.py", line 12, in <module>
    from .lint.extensions import LINTERS
  File "/Users/maurice/miniconda3/envs/lektrix/lib/python3.9/site-packages/pylama/lint/extensions.py", line 32, in <module>
    from pylama.lint.pylama_pyflakes import Linter
  File "/Users/maurice/miniconda3/envs/lektrix/lib/python3.9/site-packages/pylama/lint/pylama_pyflakes.py", line 10, in <module>
    checker.messages.RedefinedInListComp.message = "W0621 list comprehension redefines %r from line %r"
AttributeError: module 'pyflakes.messages' has no attribute 'RedefinedInListComp'
wjandrea commented 1 year ago

@Mausy5043 You installed Pylama from conda-forge, eh? It's outdated there. You could install it with pip instead; that's what I did.