Skip to content

Imports from adjacent .proto files does not work #441

@BananaLoaf

Description

@BananaLoaf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions