danielgtaylor / danielgtaylor/python-betterproto

Imports from adjacent .proto files does not work

Open
#441 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.8k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.