Steps to reproduce

  1. run pylint as pre-commit (using pre-commit/[email protected] on github actions)

Current behavior

Check for Odoo modules using pylint......................................Failed
- hook id: pylint_odoo
- exit code: 1
Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/__init__.py", line 32, in run_pylint
    from pylint.lint import Run as PylintRun
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/lint/__init__.py", line 19, in <module>
    from pylint.config.exceptions import ArgumentPreprocessingError
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/config/__init__.py", line 25, in <module>
    from pylint.config.arguments_provider import UnsupportedAction
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/config/arguments_provider.py", line 15, in <module>
    from pylint.config.arguments_manager import _ArgumentsManager
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/config/arguments_manager.py", line 25, in <module>
    from pylint import utils
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/utils/__init__.py", line 9, in <module>
    from pylint.utils.ast_walker import ASTWalker
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 13, in <module>
    from astroid import nodes
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/astroid/__init__.py", line 46, in <module>
    from astroid import inference, raw_building
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/astroid/inference.py", line 18, in <module>
    from astroid import bases, constraint, decorators, helpers, nodes, protocols, util
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/astroid/constraint.py", line 19, in <module>
    from typing_extensions import Self
ModuleNotFoundError: No module named 'typing_extensions'

Expected behavior

Should use astroid without exception being raised

pre-commit hook:

  - repo: https://github.com/OCA/pylint-odoo
    rev: v8.0.17
    hooks:
      - id: pylint_odoo
        args:
          - --rcfile=.pylintrc-mandatory
        files: ^src/ # only check Odoo code

Looks like the issue is because of this recent change: https://github.com/PyCQA/astroid/blame/6d936e8d29aa4eb45f55e2c42652715f26d73599/astroid/constraint.py#L19

Not sure how requirements are handled exactly there, but requirements_test_min.txt has typing-extension, yet requirements_test_pre_commit.txt does not. If pre-commit requirements one is only used to set up dependencies, this might be the problem?

1

Thank you for opening the issue. requirements_test_min.txt is used only in our continuous integration, so it was hiding the issue. With #1944 the CI correctly fail now.

0

I see, thanks for clarification

0

It was released in astroid 2.13.2, please update if you encounter the issue.

0

@Pierre-Sassoulas thanks, its working now.

1
© 2022 pullanswer.com - All rights reserved.