You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all, I'm working on developing a python package for internal usage. It depends on several other proto repositories which are used as submodules. Suppose the python project looks like:
I hope the package will be installed by pip and used like:
from mypackage.submodule.foo_pb2 import FooMessage
However, because of the python import mechanism, the two FooMessage is different between from mypackage.submodule.foo_pb2 import FooMessage and from submodule.foo_pb2 import FooMessage
I know there are some solutions like change the import path in generated python file or add mypackage to the sys.path then I can from submodule.foo_pb2 import FooMessage directly. But I think there should be a more elegant solution.
The text was updated successfully, but these errors were encountered:
Hi all, I'm working on developing a python package for internal usage. It depends on several other proto repositories which are used as submodules. Suppose the python project looks like:
then the generated
bar_pb2.py
file looks like:and the submodule1 developer will use it like:
I hope the package will be installed by pip and used like:
However, because of the python import mechanism, the two
FooMessage
is different betweenfrom mypackage.submodule.foo_pb2 import FooMessage
andfrom submodule.foo_pb2 import FooMessage
I know there are some solutions like change the import path in generated python file or add
mypackage
to thesys.path
then I canfrom submodule.foo_pb2 import FooMessage
directly. But I think there should be a more elegant solution.The text was updated successfully, but these errors were encountered: