Incompatibility click and black versions with Poetry ( ImportError: cannot import name '_unicodefun' from 'click' )
Incompatibility click and black versions with Poetry ( ImportError: cannot import name '_unicodefun' from 'click' )
已报告 click 8.1.1 和 black <=22.1.0 之间的不兼容性,显然已修复 here
但据报道(显然也已修复),诗歌显然仍然存在问题here
配置:
- 诗歌 (1.1.13)
- MacOS 10.15.7
- my pyproject.toml.
运行 poetry run pre-commit run --all-files
结果系统地在:
black....................................................................Failed
- hook id: black
- exit code: 1
Traceback (most recent call last):
File "/Users/charlotteweil1/.cache/pre-commit/repoqg3mkzrn/py_env-python3.9/bin/black", line 8, in <module>
sys.exit(patched_main())
File "/Users/charlotteweil1/.cache/pre-commit/repoqg3mkzrn/py_env-python3.9/lib/python3.9/site-packages/black/__init__.py", line 1372, in patched_main
patch_click()
File "/Users/charlotteweil1/.cache/pre-commit/repoqg3mkzrn/py_env-python3.9/lib/python3.9/site-packages/black/__init__.py", line 1358, in patch_click
from click import _unicodefun
ImportError: cannot import name '_unicodefun' from 'click' (/Users/charlotteweil1/.cache/pre-commit/repoqg3mkzrn/py_env-python3.9/lib/python3.9/site-packages/click/__init__.py)
我尝试删除 .cache/pre-commit
中的整个 repoqg3mkzrn
目录并重新安装预提交,但行为是相同的:(
提前致谢!
您需要检查您的 .pre-commit-config.yaml
-- 您几乎可以肯定那里配置了过时的黑色版本。最简单的修复方法是 运行 pre-commit autoupdate
以获得最新版本
或者,如果您想继续使用 black
的过时版本,您可以强制使用旧版本的点击:
- repo: https://github.com/psf/black
rev: ... # whatever old version
hooks:
- id: black
additional_dependencies: ['click<8.1']
免责声明:我创建了 pre-commit
已报告 click 8.1.1 和 black <=22.1.0 之间的不兼容性,显然已修复 here
但据报道(显然也已修复),诗歌显然仍然存在问题here
配置:
- 诗歌 (1.1.13)
- MacOS 10.15.7
- my pyproject.toml.
运行 poetry run pre-commit run --all-files
结果系统地在:
black....................................................................Failed
- hook id: black
- exit code: 1
Traceback (most recent call last):
File "/Users/charlotteweil1/.cache/pre-commit/repoqg3mkzrn/py_env-python3.9/bin/black", line 8, in <module>
sys.exit(patched_main())
File "/Users/charlotteweil1/.cache/pre-commit/repoqg3mkzrn/py_env-python3.9/lib/python3.9/site-packages/black/__init__.py", line 1372, in patched_main
patch_click()
File "/Users/charlotteweil1/.cache/pre-commit/repoqg3mkzrn/py_env-python3.9/lib/python3.9/site-packages/black/__init__.py", line 1358, in patch_click
from click import _unicodefun
ImportError: cannot import name '_unicodefun' from 'click' (/Users/charlotteweil1/.cache/pre-commit/repoqg3mkzrn/py_env-python3.9/lib/python3.9/site-packages/click/__init__.py)
我尝试删除 .cache/pre-commit
中的整个 repoqg3mkzrn
目录并重新安装预提交,但行为是相同的:(
提前致谢!
您需要检查您的 .pre-commit-config.yaml
-- 您几乎可以肯定那里配置了过时的黑色版本。最简单的修复方法是 运行 pre-commit autoupdate
以获得最新版本
或者,如果您想继续使用 black
的过时版本,您可以强制使用旧版本的点击:
- repo: https://github.com/psf/black
rev: ... # whatever old version
hooks:
- id: black
additional_dependencies: ['click<8.1']
免责声明:我创建了 pre-commit