bag*_*ard 74 python pre-commit isort pre-commit.com
今天,预提交突然开始无法在我们的构建中安装isort钩子,并出现以下错误
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/builds/.../.cache/pre-commit/repo0_h0f938/py_env-python3.8/bin/python', '-mpip', 'install', '.')
return code: 1
expected return code: 0
[...]
stderr:
ERROR: Command errored out with exit status 1:
[...]
File "/tmp/pip-build-env-_3j1398p/overlay/lib/python3.8/site-packages/poetry/core/masonry/api.py", line 40, in prepare_metadata_for_build_wheel
poetry = Factory().create_poetry(Path(".").resolve(), with_groups=False)
File "/tmp/pip-build-env-_3j1398p/overlay/lib/python3.8/site-packages/poetry/core/factory.py", line 57, in create_poetry
raise RuntimeError("The Poetry configuration is invalid:\n" + message)
RuntimeError: The Poetry configuration is invalid:
- [extras.pipfile_deprecated_finder.2] 'pip-shims<=0.3.4' does not match '^[a-zA-Z-_.0-9]+$'
Run Code Online (Sandbox Code Playgroud)
好像和诗词配置有关..
Ale*_*nko 40
运行pre-commit autoupdate足以在我的机器上修复它。
这会将isort版本.pre-commit-config.yaml以及所有其他预提交实用程序更新到 5.12.0+。
zer*_*ewl 23
附加说明:对于必须使用的人python3.7(isort 中已删除支持5.12.0),isort 发布了修补程序5.11.5。
https://github.com/PyCQA/isort/releases/tag/5.11.5
5.11.5 2023 年 1 月 30 日 [修补程序]
修复了与最新诗歌版本的不兼容问题
相关 isort 问题:https://github.com/PyCQA/isort/issues/2083#issuecomment-1408300628
小智 11
对我来说,解决方案是:
pre-commit autoupdate
Run Code Online (Sandbox Code Playgroud)
添加到这篇文章是因为我还需要做一些事情才能让我的系统正常工作......
.pre-commit-config.yaml基于文档
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ['--order-by-type', '--length-sort', "--profile", "black", "--filter-files"]
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- id: isort
name: isort (pyi)
types: [pyi]
Run Code Online (Sandbox Code Playgroud)
[build-system]
requires = ["poetry-core>=1.3.2"]
build-backend = "poetry.core.masonry.api"
Run Code Online (Sandbox Code Playgroud)
使用官方安装程序卸载/重新安装诗歌
uninstall
curl -sSL https://install.python-poetry.org | python3 - --uninstall
curl -sSL https://install.python-poetry.org | POETRY_UNINSTALL=1 python3 -
Run Code Online (Sandbox Code Playgroud)
检查 .zshrc 并删除其他诗歌实例
cat ~/.zshrc | grep poetry
install
curl -sSL https://install.python-poetry.org | python3 - --uninstall
curl -sSL https://install.python-poetry.org | POETRY_UNINSTALL=1 python3 -
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14404 次 |
| 最近记录: |