danielgtaylor / danielgtaylor/python-betterproto

Relative imports

Open
#470 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.8k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

Certainly I had the same issue with the original protoc compiler, but generated relative imports are complaining. I have a bunch of protos in the same directory.

I'm using the cmd line to generate the dataclasses:

```python -m grpc_tools.protoc -I C:\dir\libroot --python_betterproto_out=src\libs C:\dir\libroot\Protos\myproto.proto```

This generates the proto files in the expected location `src\libs\packagename\myproto.py`, with the following imports, which don't work:

```from .packagename import common```

However (in my use case) this needs to be:

```from . import common```

But perhaps I've got the wrong end of the stick!

Thanks.

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.