Reputation: 796
Here in Packaging namespace packages, it is mentioned that
namespace packages can be useful for a large collection of loosely-related packages (such as a large corpus of client libraries for multiple products from a single company). However, namespace packages come with several caveats and are not appropriate in all cases. A simple alternative is to use a prefix on all of your distributions such as import
mynamespace_subpackage_a
(you could even use importmynamespace_subpackage_a
assubpackage_a
to keep the import object short).
But there are no examples. It is better to use the alternative?
Upvotes: 2
Views: 219
Reputation: 20450
there are no examples.
The documentation refers to this example:
https://github.com/pypa/sample-namespace-packages/tree/master/native
The documentation was written prior to the sunsetting of python2. Designing a solution that supports both {2,3} would involve several caveats.
tl;dr: Given that you now should be targeting python3, and 3.3+ at that, then using namespace packages makes perfect sense. (Current released interpreter is 3.11.)
Upvotes: 2