FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Pre Commits Hooks fails when installed with Python-3.12.1 · Issue #207 · s3rius/FastAPI-template · GitHub

Pre Commits Hooks fails when installed with Python-3.12.1 #207

Description

Hello,

Flake8, add-trailing-comma, pre-commit-hooks, and language-formatters-pre-commit-hooks versions need to be updated. Otherwise fails with following errors on a newly generated project:

boilerplate (master) ✗ poetry run pre-commit install
pre-commit installed at .git/hooks/pre-commit
 boilerplate (master) ✗ poetry run pre-commit run -a
Check python ast.........................................................Passed
Trim Trailing Whitespace.................................................Passed
Check Toml...............................................................Passed
Fix End of Files.........................................................Passed
Add trailing commas......................................................Failed
- hook id: add-trailing-comma
- exit code: 1

Traceback (most recent call last):
  File "/Users/m4hi2/.cache/pre-commit/repoqonxr4s2/py_env-python3.12/bin/add-trailing-comma", line 5, in <module>
    from add_trailing_comma._main import main
ModuleNotFoundError: No module named 'add_trailing_comma'
Traceback (most recent call last):
  File "/Users/m4hi2/.cache/pre-commit/repoqonxr4s2/py_env-python3.12/bin/add-trailing-comma", line 5, in <module>
    from add_trailing_comma._main import main
ModuleNotFoundError: No module named 'add_trailing_comma'
Traceback (most recent call last):
  File "/Users/m4hi2/.cache/pre-commit/repoqonxr4s2/py_env-python3.12/bin/add-trailing-comma", line 5, in <module>
    from add_trailing_comma._main import main
ModuleNotFoundError: No module named 'add_trailing_comma'
Traceback (most recent call last):
  File "/Users/m4hi2/.cache/pre-commit/repoqonxr4s2/py_env-python3.12/bin/add-trailing-comma", line 5, in <module>
    from add_trailing_comma._main import main
ModuleNotFoundError: No module named 'add_trailing_comma'
Traceback (most recent call last):
  File "/Users/m4hi2/.cache/pre-commit/repoqonxr4s2/py_env-python3.12/bin/add-trailing-comma", line 5, in <module>
    from add_trailing_comma._main import main
ModuleNotFoundError: No module named 'add_trailing_comma'
Traceback (most recent call last):
  File "/Users/m4hi2/.cache/pre-commit/repoqonxr4s2/py_env-python3.12/bin/add-trailing-comma", line 5, in <module>
    from add_trailing_comma._main import main
ModuleNotFoundError: No module named 'add_trailing_comma'
Traceback (most recent call last):
  File "/Users/m4hi2/.cache/pre-commit/repoqonxr4s2/py_env-python3.12/bin/add-trailing-comma", line 5, in <module>
    from add_trailing_comma._main import main
ModuleNotFoundError: No module named 'add_trailing_comma'
Traceback (most recent call last):
  File "/Users/m4hi2/.cache/pre-commit/repoqonxr4s2/py_env-python3.12/bin/add-trailing-comma", line 5, in <module>
    from add_trailing_comma._main import main
ModuleNotFoundError: No module named 'add_trailing_comma'

Pretty format YAML.......................................................Failed
- hook id: pretty-format-yaml
- exit code: 1

Traceback (most recent call last):
  File "/Users/m4hi2/.cache/pre-commit/repoh6sog_z7/py_env-python3.12/bin/pretty-format-yaml", line 5, in <module>
    from language_formatters_pre_commit_hooks.pretty_format_yaml import pretty_format_yaml
  File "/Users/m4hi2/.cache/pre-commit/repoh6sog_z7/py_env-python3.12/lib/python3.12/site-packages/language_formatters_pre_commit_hooks/__init__.py", line 8, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
Traceback (most recent call last):
  File "/Users/m4hi2/.cache/pre-commit/repoh6sog_z7/py_env-python3.12/bin/pretty-format-yaml", line 5, in <module>
    from language_formatters_pre_commit_hooks.pretty_format_yaml import pretty_format_yaml
  File "/Users/m4hi2/.cache/pre-commit/repoh6sog_z7/py_env-python3.12/lib/python3.12/site-packages/language_formatters_pre_commit_hooks/__init__.py", line 8, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

autoflake................................................................Passed
Format with Black........................................................Passed
isort....................................................................Passed
Check with Flake8........................................................Failed
- hook id: flake8
- exit code: 1

Traceback (most recent call last):
  File "/Users/m4hi2/Library/Caches/pypoetry/virtualenvs/boilerplate-eD2Xgr7s-py3.12/bin/flake8", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/m4hi2/Library/Caches/pypoetry/virtualenvs/boilerplate-eD2Xgr7s-py3.12/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "/Users/m4hi2/Library/Caches/pypoetry/virtualenvs/boilerplate-eD2Xgr7s-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run
    self._run(argv)
  File "/Users/m4hi2/Library/Caches/pypoetry/virtualenvs/boilerplate-eD2Xgr7s-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run
    self.initialize(argv)
  File "/Users/m4hi2/Library/Caches/pypoetry/virtualenvs/boilerplate-eD2Xgr7s-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize
    self.find_plugins(config_finder)
  File "/Users/m4hi2/Library/Caches/pypoetry/virtualenvs/boilerplate-eD2Xgr7s-py3.12/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins
    self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/m4hi2/Library/Caches/pypoetry/virtualenvs/boilerplate-eD2Xgr7s-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__
    self.manager = PluginManager(
                   ^^^^^^^^^^^^^^
  File "/Users/m4hi2/Library/Caches/pypoetry/virtualenvs/boilerplate-eD2Xgr7s-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__
    self._load_entrypoint_plugins()
  File "/Users/m4hi2/Library/Caches/pypoetry/virtualenvs/boilerplate-eD2Xgr7s-py3.12/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins
    eps = importlib_metadata.entry_points().get(self.namespace, ())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'EntryPoints' object has no attribute 'get'

Validate types with MyPy.................................................Passed

Workaround, update Flake8 on pyproject.toml file, run poetry update and to update pre-commit hooks run:

poetry run pre-commit autoupdate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL