Skip to content

Not fixing imports in pyi files #850

@juraj-juraj

Description

@juraj-juraj

I'm working on a project with nested structure where are shared objects in directories.
This is how directory structure looks like.

phonexia
- common
   - core.proto
   - health_check.proto
- technologies
   -  speaker
      -  v1
         -  sid.proto # imports "pkg_name/common/core.proto"

Protoc generates python libraries, name_pb2.py, name_pb2_grpc.py and name_pb2.pyi. The last one is interface file. The files are generated all right. Protol then fixes imports, but only in .py files, .pyi files are left untouched.
It looks like it is only mistake in rewriting patterns. Because imports in .py files look like: "from phonexia.common import core_pb2 as pkg_name_dot_common_dot_core__pb2", but in pyi files imports are like: "from phonexia.common import core_pb2 as _core_pb2". I tried renaming import in pyi files and it worked.

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