black posthook throws `ImportError: cannot import name 'izip_longest' from 'pathspec.compat'`

Offen
#613 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
openapi, python
Bereich
tooling

Rechercherichtung

Beginne damit, die Poetry-Umgebung aus den aufgeführten Python-3.9-Abhängigkeiten zu reproduzieren und openapi-python-client update gefolgt von black . auszuführen. Untersuche die Auflösung der Abhängigkeiten und den Importfehler von Black/pathspec; fertig ist die Aufgabe, wenn der Post-Hook und das anschließende eigenständige black . ohne Fehler abgeschlossen werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

🐞bug

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:

  1. Install dependencies as listed in Desktop section, using poetry
  2. Run openapi-python-client update
  3. 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"

Vorherrschende Sprache
Python
Sterne
2k
Forks
293
Ø Merge
34 Min.
Gemergte PRs (30 T.)
1

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus openapi-generators/openapi-python-client

Alle Issues in openapi-generators/openapi-python-client

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.