black posthook throws `ImportError: cannot import name 'izip_longest' from 'pathspec.compat'`
还没有人认领这个 Issue。
评估
调研方向
首先,根据列出的 Python 3.9 依赖项复现 Poetry 环境,并运行 openapi-python-client update,随后运行 black .。检查依赖项解析以及 Black/pathspec 导入失败的问题;当 post hook 和随后单独运行的 black . 都无错误完成时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
During the black . post hook, openapi-python-client throws :
openapi-python-client update --url someurl.com/openapi.json
Updating my_project
Error(s) encountered while generating, client was not created
black failed
Traceback (most recent call last):
File "C:\Users\x\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\x\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87,
in _run_code
exec(code, run_globals)
File "C:\Users\x\code\my_project\venv\Scripts\black.exe\__main__.py", line 4, in <module>
File "src\black\__init__.py", line 12, in <module>
File "C:\Users\x\code\my_project\venv\lib\site-packages\pathspec\__init__.py", line 26, in <module>
from .pathspec import PathSpec
File "C:\Users\x\code\my_project\venv\lib\site-packages\pathspec\pathspec.py", line 27, in <module>
from .compat import (
ImportError: cannot import name 'izip_longest' from 'pathspec.compat' (C:\Users\x\code\my_project\venv\lib\site-packages\pathspec\compat.py)
In a fresh environment, running black . on my own works originally. Then, running openapi-python-client update fails at the black step. Then, the strange thing is that this error persists when running black . on my own afterwards.
To Reproduce
Steps to reproduce the behavior:
- Install dependencies as listed in Desktop section, using poetry
- Run openapi-python-client update
- See error during black post hook.
Expected behavior
I expect the black . to complete without errors.
OpenAPI Spec File
Unfortunately this is under NDA. However, the package is generated without issue, the problem comes from the black post hook.
Desktop (please complete the following information):
- OS: Windows 10 Business 19044.1645
[tool.poetry.dependencies]
python = "3.9"
httpx = "0.22.0"
attrs = "21.4.0"
python-dateutil = "2.8.2"
azure-identity = "1.10.0"
exdir = "0.4.2"
[tool.poetry.dev-dependencies]
flake8 = "4.0.1"
mypy = "0.950"
pytest = "7.1.2"
black = "22.3.0"
aiounittest = "1.4.1"
openapi-python-client= "0.11.1"
- 主要语言
- Python
- 星标
- 2k
- 派生
- 293
- 平均合并
- 34 分钟
- 30 天内合并 PR
- 1
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openapi-generators/openapi-python-client 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 3/5 1-2 天 新手友好度 72/100
openapi-generators/openapi-python-client#1451 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 52/100
-
难度 3/5 1-2 天 新手友好度 64/100
openapi-generators/openapi-python-client#1435 · 1 条评论 ·
查看 openapi-generators/openapi-python-client 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
zostera/django-bootstrap4#894 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
use-agent-os/agent-os#3276 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
难度 2/5 1-3 小时 新手友好度 88/100
NousResearch/hermes-agent#117848 ·