Skip to content
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

Unable to handle namespace packages like azure and google #46

Open
BenMatase opened this issue Jun 15, 2020 · 1 comment
Open

Unable to handle namespace packages like azure and google #46

BenMatase opened this issue Jun 15, 2020 · 1 comment

Comments

@BenMatase
Copy link

When using these rules with a family of pip packages (e.g. azure and google packages) which install as part of the same "namespace", python is unable to import them at runtime.

For example, if I try to use azure-mgmt-compute which provides the azure.mgmt.compute module and azure-mgmt-resource which provides the azure.mgmt.resource module, I run into this issue since they both install into the azure top level module. My pylint rules complain

ben.py:10:0: E0611: No name 'mgmt' in module 'azure' (no-name-in-module)
ben.py:10:0: E0401: Unable to import 'azure.mgmt' (import-error)

as well as when I go to actually run the packaged up par:

  File "path/to/file/ben.py", line 14, in <module>
    from azure.mgmt import compute, network, resource
ModuleNotFoundError: No module named 'azure.mgmt'

The build of the target succeeds, so only at run time does it fail.

I've found that this seems to be a known issue with bazel's rules_python which I found through this issue which I found through this issue (where this rule set is said to possibly fix this issue).

The repo for rules_python_external seems to have solved this issue and after doing some digging, it looks like they handle this by detecting and treating those "namespace" packages on wheel extraction.

@BenMatase
Copy link
Author

I can do the work and try and fix this in this repo, but could use some pointers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant