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

Use "com" folder as an implicit namespace #408

Closed
mxmrlt opened this issue Jan 30, 2024 · 3 comments
Closed

Use "com" folder as an implicit namespace #408

mxmrlt opened this issue Jan 30, 2024 · 3 comments
Labels

Comments

@mxmrlt
Copy link

mxmrlt commented Jan 30, 2024

Describe the bug

While using this package as a dependency it is impossible to use another one which also has com folder in its source code.

The problem occurs mostly in editable installation mode.

These sub-packages contain an __init__.py file making fail any other packages with com.company namespace :
vapi-common-client-.zip
vcenter_bindings-
.zip
vmwarecloud_aws-.zip
vmwarecloud_draas-
.zip

The __init__.py file :

# Required to distribute different parts of this
# package as multiple distributables
try:
    import pkg_resources
    pkg_resources.declare_namespace(__name__)
except ImportError:
    from pkgutil import extend_path
    __path__ = extend_path(__path__, __name__)

There shouldn't be any __init__.py file in the "com" folder. This latter is "universal" and can be used by many others.

Reproduction steps

  1. pip install --upgrade git+https:/vmware/vsphere-automation-sdk-python.git
  2. pip install --editable path-to-my-other-package-containing com.compagny namespace
  3. python -c "from com.company.mypackage.mymodule import my_function, my_class"
  4. Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'com.company'

Expected behavior

from com.company.mypackage.mymodule import my_function, my_class

should be possible.

Additional context

No response

@mxmrlt mxmrlt added the bug label Jan 30, 2024
@kunalpmj
Copy link

Hi @mxmrlt

This is an unfortunate case of "missing init.py trap". We are exploring the options like updating the SDK and its dependencies to use Implicit Namespace packages, removing "com" form namespace package etc. Once the approach is finalized, We will update the ticket with target dates by when the fix will be available.

Thanks
Kunal

@kunalpmj
Copy link

The issue will be fixed in next SDK 8.0U3 release

@kunalpmj
Copy link

kunalpmj commented Jul 8, 2024

8.0U3 is released. Closing the issue

@kunalpmj kunalpmj closed this as completed Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants