Missing import in generated code when using well known types
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
Empieza reproduciendo el problema con foo.proto y el comando indicado python -m grpc_tools.protoc; después, inspecciona el init.py generado. Compara la salida cuando se usa google.protobuf.Empty como valor de retorno del RPC. Se considera terminado cuando la salida del caso límite importa betterproto.lib.google.protobuf con el alias mencionado y el código generado se compila correctamente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
When compiling a proto file which references well known types, protoc should generate the line import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf. This does not happen in the following edge case.
Reproduction Steps
Create a file foo.proto whith the following content
syntax = "proto3";
import "google/protobuf/empty.proto";
service foo {
rpc foo (google.protobuf.Empty) returns (MyEmpty);
}
message MyEmpty {}
and compile it by running python -m grpc_tools.protoc -I . --python_betterproto_out=lib foo.proto.
Expected Results
The generated file __init__.py references a module betterproto_lib_google_protobuf, so it should import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf.
Note that it actually would be imported if I had used google.protobuf.Empty as the return value of the RPC above.
Actual Results
The generated file __init__.py does not import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf
System Information
libprotoc 25.0
Python 3.10.12
betterproto 2.0.0b6 (tested with released version and github master branch)
Checklist
- I have searched the issues for duplicates.
- I have shown the entire traceback, if possible.
- I have verified this issue occurs on the latest prelease of betterproto which can be installed using
pip install -U --pre betterproto, if possible.
- Lenguaje dominante
- Python
- Estrellas
- 1.8k
- Forks
- 235
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de danielgtaylor/python-betterproto
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
-
bug investigation needed
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
-
bug investigation needed
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
bug investigation needed
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
danielgtaylor/python-betterproto#676 · 3 comentarios ·
Todos los issues de danielgtaylor/python-betterproto
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
gramaziokohler/compas_timber#870 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
autowarefoundation/autoware_carla_scenario#500 ·
Los mantenedores suelen responder en 1 día
-
good first issue priority: low size: XS testing
Dificultad 1/5 1-3 horas Aptitud para principiantes 86/100
cubrid-lab/cubrid-mcp-server#385 ·
Los mantenedores suelen responder en 1 día
-
good first issue priority: low size: S testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
cubrid-lab/cubrid-cookbook-python#447 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100