-
Notifications
You must be signed in to change notification settings - Fork 15.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[protoc python] Relative import paths in generated python modules #3728
Conversation
…n PYTHON_PATH relateve package import is introduced to generated python files. This means that all imports like ```from Module1.Module2 import ProtoPackage``` will now looks like ``` from . import ProtoPackage from .. import Module2 ``` This will allow us to safety have another module with name 'Module1' and 'Module2' in the python path.
Thanks for your pull request. The automated tests will run as soon as one of the admins verifies this change is ok for us to run on our infrastructure. |
1 similar comment
Thanks for your pull request. The automated tests will run as soon as one of the admins verifies this change is ok for us to run on our infrastructure. |
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
Can one of the admins verify this patch? |
CLAs look good, thanks! |
(Note: I am not a Googler, or even a contributor) I think this is a dangerous pull request, because it masks mistakes in the use of
Say you are getting an error from By the way, See also a similar pull request #1511 and related bug report #1491. |
I've realised I don't fully understand what this is for. If |
What if the dependency is in a different directory in the PYTHONPATH, and relative path wouldn't work? I guess you would have to reorganize your packages to avoid such conflicts. |
Any progress on this issue? Currently it does not generate valid python3 code. |
Actually no progress for now. Let's close my request at all. |
In order to avoid module name conflict with modules in PYTHON_PATH relative package import is introduced to generated python files.
This means that all imports like
from Module1.Module2 import ProtoPackage
will now looks likeThis will allow us to safety have another module with name 'Module1' and 'Module2' in the python path.