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
There's a certain schism in how Python's proto compiles, in that the python classes module path/namespace adheres to the proto file path instead of the package defined in the files.
Thus, as per this example, those three files will all be rendered as three individual python files and those messages will be under three different modules: efrit/common/game.proto -> efrit.common.game_dc.py efrit/common/text.proto -> efrit.common.text_dc.py efrit/common/catalog.proto -> efrit.common.catalog_dc.py
However in proto, all the messages in there are in the same package/namespace in efrit.common while in python, going from efrit.common import * imports nothing.
Since proto doesn't allow any name collisions within package definitions, we can assume that everything defined in the same package can also live in the same namespace/module in Python and from that, in the __init__.py of each package module, "alias-import"every message that belongs to that package.
E.g. for the example above:
File: efrit/common/__init__.py
# Proto package alias importingfromefrit.common.game_dcimport*fromefrit.common.text_dcimport*fromefrit.common.catalog_dcimport*```
Thus, whenusingtheneobufpackageyoucanimportstuffbasedontheprotopackagesdefinitions:
```pythonfromefrit.commonimport*```
The text was updated successfully, but these errors were encountered:
There's a certain schism in how Python's proto compiles, in that the python classes module path/namespace adheres to the proto file path instead of the package defined in the files.
Thus, as per this example, those three files will all be rendered as three individual python files and those messages will be under three different modules:
efrit/common/game.proto
->efrit.common.game_dc.py
efrit/common/text.proto
->efrit.common.text_dc.py
efrit/common/catalog.proto
->efrit.common.catalog_dc.py
However in proto, all the messages in there are in the same package/namespace in
efrit.common
while in python, goingfrom efrit.common import *
imports nothing.Since proto doesn't allow any name collisions within package definitions, we can assume that everything defined in the same package can also live in the same namespace/module in Python and from that, in the
__init__.py
of each package module, "alias-import"every message that belongs to that package.E.g. for the example above:
File:
efrit/common/__init__.py
The text was updated successfully, but these errors were encountered: