danielgtaylor / danielgtaylor/python-betterproto

Version 2.0.0b4 fail to generate plugins concurrently

Offen
#312 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
compiler-bug
Vorherrschende Sprache
Python
Sterne
1.8k
Forks
234
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Usage fails with BetterProto 2.0.0b4 Version
```
$ buf generate -vvv proto
E0105 15:39:19.511094 1771702 template.go:991] created a body with 0 properties in the message, this might be unintended: name:"ModifyTileDisplayStateRequest" field:{name:"tile_name" number:1 label:LABEL_OPTIONAL type:TYPE_STRING json_name:"tileName"} field:{name:"tile_state" number:2 label:LABEL_OPTIONAL type:TYPE_ENUM type_name:".reco.services.v1.TileDisplayState" json_name:"tileState"}
Traceback (most recent call last):
File "/usr/local/bin/protoc-gen-python_betterproto", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.9/dist-packages/betterproto/plugin/main.py", line 32, in main
response = generate_code(request)
File "/usr/local/lib/python3.9/dist-packages/betterproto/plugin/parser.py", line 107, in generate_code
read_protobuf_service(service, index, output_package)
File "/usr/local/lib/python3.9/dist-packages/betterproto/plugin/parser.py", line 191, in read_protobuf_service
ServiceMethodCompiler(
File "", line 7, in __init__
File "/usr/local/lib/python3.9/dist-packages/betterproto/plugin/models.py", line 683, in __post_init__
self.mutable_default_args # ensure this is called before rendering
File "/usr/local/lib/python3.9/dist-packages/betterproto/plugin/models.py", line 720, in mutable_default_args
and f.default_value_string != "None"
File "/usr/local/lib/python3.9/dist-packages/betterproto/plugin/models.py", line 486, in default_value_string
enum = next(
StopIteration
Failure: failed to generate plugins concurrently: failed to execute plugins concurrently: failed to generate: exit status 1.
```
Replacing to older version
```
$ pip install betterproto[compiler]==2.0.0b3
Collecting betterproto[compiler]==2.0.0b3
Downloading betterproto-2.0.0b3-py3-none-any.whl (59 kB)
|████████████████████████████████| 59 kB 611 kB/s
Installing collected packages: betterproto
Attempting uninstall: betterproto
Found existing installation: betterproto 2.0.0b4
Uninstalling betterproto-2.0.0b4:
Successfully uninstalled betterproto-2.0.0b4
Successfully installed betterproto-2.0.0b3
```
Usage succeed with BetterProto 2.0.0b3 Version
```
$ buf generate -vvv proto
E0105 15:54:45.424446 1781827 template.go:991] created a body with 0 properties in the message, this might be unintended:
Writing __init__.py
Writing google/__init__.py
Writing google/api/__init__.py
Writing google/longrunning/__init__.py
Writing google/rpc/__init__.py
Writing grpc/__init__.py
Writing grpc/gateway/__init__.py
Writing grpc/gateway/protoc_gen_openapiv2/__init__.py
Writing grpc/gateway/protoc_gen_openapiv2/options/__init__.py
Writing validate/__init__.py
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduziere den Fehler mit BetterProto 2.0.0b4 unter Verwendung von `buf generate -vvv proto` und vergleiche anschließend mit 2.0.0b3. Beginne in plugin/parser.py bei generate_code und read_protobuf_service und lies danach in plugin/models.py default_value_string und mutable_default_args. Als erledigt gilt die Aufgabe, wenn das gemeldete Proto mit der aktuellen Version ohne StopIteration erfolgreich generiert wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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