Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name '_unicodefun' from 'click' #2976

Closed
enaskopelja opened this issue Mar 30, 2022 · 3 comments · Fixed by freeorion/freeorion#3846
Closed

ImportError: cannot import name '_unicodefun' from 'click' #2976

enaskopelja opened this issue Mar 30, 2022 · 3 comments · Fixed by freeorion/freeorion#3846
Labels
R: duplicate This issue or pull request already exists T: bug Something isn't working

Comments

@enaskopelja
Copy link

enaskopelja commented Mar 30, 2022

Describe the bug
A recent version of click has been released which removes _unicodefun, breaking black (see also dask/distributed#6013).

To Reproduce

docker run --rm -it python:3.9-alpine sh

In the container:

pip install "click==8.1.0" "black==22.1.0"
black .

The resulting error is:

Traceback (most recent call last):
  File "/usr/local/bin/black", line 8, in <module>
    sys.exit(patched_main())
  File "/usr/local/lib/python3.9/site-packages/black/__init__.py", line 1423, in patched_main
    patch_click()
  File "/usr/local/lib/python3.9/site-packages/black/__init__.py", line 1409, in patch_click
    from click import _unicodefun
ImportError: cannot import name '_unicodefun' from 'click' (/usr/local/lib/python3.9/site-packages/click/__init__.py)
@enaskopelja enaskopelja added the T: bug Something isn't working label Mar 30, 2022
@zerocewl
Copy link

zerocewl commented Mar 30, 2022

maybe pin click to the version before as first workaround? click==8.0.2

pip install --upgrade click==8.0.2

see also dask/distributed#6013

@Jackenmen
Copy link
Contributor

This has been fixed by Black 22.3.0. Versions before that won't work with click 8.1.0.

@felix-hilden
Copy link
Collaborator

Correct, see issue #2964 for more info.

@felix-hilden felix-hilden added the R: duplicate This issue or pull request already exists label Mar 30, 2022
vperron added a commit to gip-inclusion/les-emplois that referenced this issue Mar 30, 2022
beenje added a commit to beenje/grayskull that referenced this issue Apr 6, 2022
Update black to 22.3.0 to fix issue with click (psf/black#2976)
marcelotrevisani pushed a commit to conda/grayskull that referenced this issue Apr 6, 2022
Update black to 22.3.0 to fix issue with click (psf/black#2976)
badboy added a commit to mozilla/probe-scraper that referenced this issue Apr 6, 2022
goodspark added a commit to discord/black that referenced this issue Apr 15, 2022
Ref: psf#2976

Black was importing something incorrectly. Upgrading to the version with the fix also means dropping Python 2.7 support.
goodspark added a commit to discord/black that referenced this issue Apr 18, 2022
Ref: psf#2976

Black was importing something incorrectly. Upgrading to the version with the fix also means dropping Python 2.7 support.
laurensvalk added a commit to pybricks/pybricks-micropython that referenced this issue Apr 21, 2022
laurensvalk added a commit to pybricks/pybricks-micropython that referenced this issue Apr 21, 2022
laurensvalk added a commit to pybricks/pybricks-micropython that referenced this issue Apr 21, 2022
AndreCimander added a commit to AndreCimander/pytest-recording that referenced this issue May 2, 2022
coretl added a commit to DiamondLightSource/dls-python3-skeleton that referenced this issue May 3, 2022
coretl added a commit to DiamondLightSource/dls-python3-skeleton that referenced this issue May 3, 2022
fh-mlitkey added a commit to flatironhealth/ast-refactor that referenced this issue May 25, 2022
callumforrester added a commit to DiamondLightSource/hdf5-reader-service that referenced this issue Jun 22, 2022
* Drop support for Python 3.7

* Remvove script from setup.cfg

* Add CLI

* Update references to CLI

* Update CLI CI

* Only look for tests in src/ docs/ and tests/

* Specify python version when testing cli

* Enclose author & email in quotes

* Revert "Enclose author & email in quotes"

This reverts commit e10f52b.

* Bump black dependency

As per psf/black#2976

* Ignore localhost links for linkcheck

This excludes http://localhost from the periodic check for broken links

* Use 3.8

* Use 3.9

* Fix linting

* Correct executable

Co-authored-by: Tom Cobb <tom.cobb@diamond.ac.uk>
Co-authored-by: Garry O'Donnell <garry.o'donnell@diamond.ac.uk>
Co-authored-by: Tom C (DLS) <101418278+coretl@users.noreply.github.com>
gilesknap pushed a commit to DiamondLightSource/python3-pip-skeleton that referenced this issue Aug 15, 2022
Tidy up formatting and docs

- Use VSCode default formatter for everything
- This changes default format for some yaml, json and svgs
- Remove some redundant skips for flake8 and isort
- Use pkg-name not pkg_name for pip as that is more truthful
- Upload wheel in CI before testing it
- Note the docstring style in CONTRIBUTING.rst

Check links in Docs CI and fix failures

Add explanation of =src in setup.cfg

Move link checking to its own scheduled workflow

Only look for tests in src/ docs/ and tests/

Specify python version when testing cli

Enclose author & email in quotes

Revert "Enclose author & email in quotes"

This reverts commit e10f52b.

Bump black dependency

As per psf/black#2976

Ignore localhost links for linkcheck

This excludes http://localhost from the periodic check for broken links
gilesknap pushed a commit to DiamondLightSource/python3-pip-skeleton that referenced this issue Aug 15, 2022
Tidy up formatting and docs

- Use VSCode default formatter for everything
- This changes default format for some yaml, json and svgs
- Remove some redundant skips for flake8 and isort
- Use pkg-name not pkg_name for pip as that is more truthful
- Upload wheel in CI before testing it
- Note the docstring style in CONTRIBUTING.rst

Check links in Docs CI and fix failures

Add explanation of =src in setup.cfg

Move link checking to its own scheduled workflow

Only look for tests in src/ docs/ and tests/

Specify python version when testing cli

Enclose author & email in quotes

Revert "Enclose author & email in quotes"

This reverts commit e10f52b.

Bump black dependency

As per psf/black#2976

Ignore localhost links for linkcheck

This excludes http://localhost from the periodic check for broken links

Check links in Docs CI and fix failures

Move link checking to its own scheduled workflow

Enclose author & email in quotes

Revert "Enclose author & email in quotes"

This reverts commit e10f52b.

master -> main, remove redundant files

applying changes for pip based workflow

add devcontainer

cope with zero length requirements files

pass home to tox so git commands work

Add dependabot config for actions & pip

add all hidden venv to gitignore

Bump actions/download-artifact from 2 to 3 (#3)

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v2...v3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump black from 22.3.0 to 22.6.0 (#4)

Bumps [black](https://github.com/psf/black) from 22.3.0 to 22.6.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@22.3.0...22.6.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump actions/setup-python from 2 to 4 (#5)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 4.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v2...v4)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump docker/login-action from 1 to 2 (#6)

Bumps [docker/login-action](https://github.com/docker/login-action) from 1 to 2.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@v1...v2)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump actions/upload-artifact from 2 to 3 (#7)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump docker/setup-buildx-action from 1 to 2 (#8)

Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](docker/setup-buildx-action@v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump docker/build-push-action from 2 to 3 (#9)

Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2 to 3.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](docker/build-push-action@v2...v3)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
gilesknap pushed a commit to DiamondLightSource/python3-pip-skeleton that referenced this issue Aug 15, 2022
Tidy up formatting and docs

- Use VSCode default formatter for everything
- This changes default format for some yaml, json and svgs
- Remove some redundant skips for flake8 and isort
- Use pkg-name not pkg_name for pip as that is more truthful
- Upload wheel in CI before testing it
- Note the docstring style in CONTRIBUTING.rst

Check links in Docs CI and fix failures

Add explanation of =src in setup.cfg

Move link checking to its own scheduled workflow

Only look for tests in src/ docs/ and tests/

Specify python version when testing cli

Enclose author & email in quotes

Revert "Enclose author & email in quotes"

This reverts commit e10f52b.

Bump black dependency

As per psf/black#2976

Ignore localhost links for linkcheck

This excludes http://localhost from the periodic check for broken links

Check links in Docs CI and fix failures

Move link checking to its own scheduled workflow

Enclose author & email in quotes

Revert "Enclose author & email in quotes"

This reverts commit e10f52b.

master -> main, remove redundant files

applying changes for pip based workflow

add devcontainer

cope with zero length requirements files

pass home to tox so git commands work

Add dependabot config for actions & pip

add all hidden venv to gitignore

Bump actions/download-artifact from 2 to 3 (#3)

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v2...v3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump black from 22.3.0 to 22.6.0 (#4)

Bumps [black](https://github.com/psf/black) from 22.3.0 to 22.6.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@22.3.0...22.6.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump actions/setup-python from 2 to 4 (#5)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 4.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v2...v4)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump docker/login-action from 1 to 2 (#6)

Bumps [docker/login-action](https://github.com/docker/login-action) from 1 to 2.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@v1...v2)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump actions/upload-artifact from 2 to 3 (#7)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump docker/setup-buildx-action from 1 to 2 (#8)

Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](docker/setup-buildx-action@v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump docker/build-push-action from 2 to 3 (#9)

Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2 to 3.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](docker/build-push-action@v2...v3)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
kniklas added a commit to kniklas/perf-calc that referenced this issue Aug 18, 2022
Implemented by overriding __str__() method. This is base for further
work on implementing printing of asset characteristics (for example for
debug mode).

Additionally for pre-committ to work correctly, black code formatter
version had to be increased to 22.3.0 from 22.1.0, because previous
version of black fails to work correctly with click=>8.1.0, see:
psf/black#2976
jmartin-sul added a commit to sul-dlss/dlme-airflow that referenced this issue Aug 26, 2022
jmartin-sul added a commit to sul-dlss/dlme-airflow that referenced this issue Aug 30, 2022
jmartin-sul added a commit to sul-dlss/dlme-airflow that referenced this issue Aug 30, 2022
VirginiaDooley added a commit to DemocracyClub/yournextrepresentative that referenced this issue Nov 1, 2022
VirginiaDooley added a commit to DemocracyClub/yournextrepresentative that referenced this issue Nov 3, 2022
-psf/black#2976
-Includes necessary reformatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R: duplicate This issue or pull request already exists T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@Jackenmen @zerocewl @felix-hilden @enaskopelja and others