Incompatible with click 8.1.0 (ImportError: cannot import name '_unicodefun' from 'click') · Issue #2964 · psf/black · GitHub
Skip to content

Incompatible with click 8.1.0 (ImportError: cannot import name '_unicodefun' from 'click') #2964

Description

@stumpylog

Please use Black 22.3.0 (or newer) which was just released to fix this issue or pin Click to 8.0.0, 8.0.1, 8.0.2, 8.0.3, or 8.0.4.

~ @ichard26 at March 28 3:15 PM EST


So hey y'all, CI is broken eh?

Anyway, we are aware the most recent release of Click, 8.1.0, is breaking Black. This is because Black imports an internal module so Python 3.6 users with misconfigured LANG continues to work mostly properly. The code that patches click was supposed to be resilient to the module disappearing but the code was catching the wrong exception.

To unbreak your CI, please pin Click to 8.0.0, 8.0.1, 8.0.2, 8.0.3, or 8.0.4. We are working on a more longterm fix (probably fixing the patching code or getting rid of it entirely) and will try to get a release out soon.

~ @ichard26 at March 28 2:29 PM EST


Describe the bug

The Github Action step:

- name: Run black
  uses: psf/black@stable
  with:
     options: "--check --diff"
      version: "22.1.0"

fails with the following trackeback:

Traceback (most recent call last):
  File "/home/runner/work/_actions/psf/black/stable/.black-env/bin/black", line 8, in <module>
    sys.exit(patched_main())
  File "src/black/__init__.py", line 1423, in patched_main
  File "src/black/__init__.py", line 1[40](https://github.com/stumpylog/paperless-ngx/runs/5724998040?check_suite_focus=true#step:7:40)9, in patch_click
ImportError: cannot import name '_unicodefun' from 'click' (/home/runner/work/_actions/psf/black/stable/.black-env/lib/python3.8/site-packages/click/__init__.py)

To Reproduce

Run the black action on a Github runner, configured as above.

Expected behavior

The action should only fail if files are not formatted.

Environment

OS: runs-on: ubuntu-20.04
Version: 22.1.0
Action: @stable
Python version: 3.8 I believe

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: packagingInstallation and packaging of BlackT: bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions