openapi-generators / openapi-generators/openapi-python-client
black posthook throws `ImportError: cannot import name 'izip_longest' from 'pathspec.compat'`
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 2k
- 分支
- 293
- 平均合併
- 34 分鐘
- 30 天內合併 PR
- 1
描述
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"
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先,根據列出的 Python 3.9 相依性重現 Poetry 環境,並執行 openapi-python-client update,接著執行 black .。檢查相依性解析以及 Black/pathspec 匯入失敗的問題;當 post hook 和之後單獨執行的 black . 都無錯誤完成時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- openapi, python
- 領域
- tooling
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100