danielgtaylor / danielgtaylor/python-betterproto
Import not generated for package/module if only referenced in service declaration.
- Lenguaje dominante
- Python
- Estrellas
- 1.8k
- Forks
- 234
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
As a basic example I have the below, the generated service will not import the `test` package, however if i reference any message in the return it imports it correctly.
```syntax = "proto3";
package test;
import "test2.proto";
message TestMessage {}
service Test {
rpc test(test2.DemoRequest) returns (TestMessage);
}
```
From a shallow look seems to stem from the `ServiceMethodCompiler.__post_init__` method. The return type is referenced using `py_output_message_type` which calls `get_type_reference` which adds it to imports, however nowhere in the `__post_init__` is the input type referenced for it to be added with `get_type_reference` to imports.
Guía de contribución
Línea de trabajo
Empieza inspeccionando ServiceMethodCompiler.__post_init__, py_output_message_type y get_type_reference; después compila el ejemplo de proto del issue e inspecciona las importaciones del servicio generado. Se considera terminado cuando el servicio generado incluye el paquete que contiene el tipo de entrada del RPC, incluso cuando ese tipo se usa únicamente en la declaración del servicio.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- tooling
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100