Conversation
|
I dont understand the problem that you are trying to solve.
Why must this prefix be parametrized? What I do usally in the import function is configure the postfix, like But yes, we could pass the parameters to the |
|
the issue is that sometimes you may want to prefix the generated files into a submodule of your own. This is needed specially on cases where google libraries are installed with generated google libraries. Their modules could conflict w the generated modules (see: https://packaging.python.org/en/latest/guides/packaging-namespace-packages/ ). Another dangerous case is when pip tries to install 2 libraries w the same generated files (aka 2 files generated by the same protoc-extension and added into 2 separate libraries for example |
Opening this mostly for discussion. Right now there's no easy way to change import paths from protoc commandline. parameters would be a way to do so (you could have a parameter which prefixes all generated packages by a common prefix, which is useful if you want to avoid collision w other libraries). right now, I'm doing this w some sed+grep magic as it's not easy to access these protoc parameters from py_import_func.
This is a breaking change, I can try to make it non-breaking but may require some python wizardy stuff (parse signature from provided py_import_func and provide parameters or not depending on that.