Python Forum
Namespace Packages - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Namespace Packages (/thread-5367.html)



Namespace Packages - jmj1970 - Sep-30-2017

I had a question regarding namespace packages:

https://packaging.python.org/guides/packaging-namespace-packages/

Let’s say I have several packages, a through z. All of these packages are part of a group but do not necessarily depend on one another so they would not all need to be installed at once as part of a parent package.

This appears to be the case that namespace packages were made for and it does say:

Quote:Each sub-package can now be separately installed, used, and versioned.

However, I know that just because a feature exists does not mean it should be used for it also says,

Quote:namespace packages come with several caveats and are not appropriate in all cases.

I am not sure I understand the caveats and the inappropriate use cases. What are the caveats? What are some inappropriate use cases?

I do note that it also says:

Quote:A simple alternative is to use a prefix on all of your distributions such as import mynamespace_subpackage_a (you could even use import mynamespace_subpackage_a as subpackage_a to keep the import object short).

and this approach does have some appeal in its simplicity.