Skip to content

Pre-commit failing due to black issue (#2966) #147

@speediedan

Description

@speediedan

🐛 Bug

An issue with black (introduced by click) was causing the pre-commit "Format Code" hook to fail. Version 22.3.0 of black was released and needs to be specified with the relevant pre-commit hook we're using. I've verified that updating the black version referenced in the pre-commit hook configuration addresses the issue.

To Reproduce

Steps to reproduce the behavior:
Check latest pre-commit "Code Formatting" logs or run pre-commit run --all-files with a black version < 22.3.0 referenced in the hook

Format code..............................................................Failed
- hook id: black
- exit code: 1

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repok0wbrcuc/py_env-python3.8/bin/black", line 8, in <module>
    sys.exit(patched_main())
  File "/home/runner/.cache/pre-commit/repok0wbrcuc/py_env-python3.8/lib/python3.8/site-packages/black/__init__.py", line 1372, in patched_main
    patch_click()
  File "/home/runner/.cache/pre-commit/repok0wbrcuc/py_env-python3.8/lib/python3.8/site-packages/black/__init__.py", line 1358, in patch_click
    from click import _unicodefun
ImportError: cannot import name '_unicodefun' from 'click' (/home/runner/.cache/pre-commit/repok0wbrcuc/py_env-python3.8/lib/python3.8/site-packages/click/__init__.py)

Expected behavior

The code format check should complete successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug / fixSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions