danielgtaylor / danielgtaylor/python-betterproto

Imports from adjacent .proto files does not work

Aperta
#441 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
1.8k
Fork
234
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

First of all, I looked at the issue #408 and I am absolutely sure that I have `betterproto[compiler]` of version `2.0.0b5` installed

I have this file structure:
```
protos
├── common.proto
└── devices
└── rpi.proto
```

With `protos/common.proto`:
```
syntax = 'proto3';
package org.company.name.common;

message DeviceId {
string device_id = 1;
}
```

and `protos/devices/rpi.proto`:
```
syntax = 'proto3';
package org.company.name.rpi;

import "common.proto";
import "google/protobuf/empty.proto";

service RPI {
rpc Start(common.DeviceId) returns (google.protobuf.Empty) {}
rpc Stop(common.DeviceId) returns (google.protobuf.Empty) {}
```

I then generate betterproto files:
```
poetry run python -m grpc_tools.protoc \
-I protos \
--python_betterproto_out=package_name/grpc \
protos/common.proto \
protos/devices/rpi.proto \
```

## The BUG

In `package_name.grpc.org.company.name.rpi` any mentions of `DeviceId` are presented as `_common__.DeviceId`, with `_common__` not being imported. Launching that code does not work either, python has no idea what `_common__` is.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.