About
Namespace packages allow you to split the sub-packages and modules within a single package across multiple, separate distribution packages
Articles Related
Example
mynamespace/
__init__.py
subpackage_a/
__init__.py
...
subpackage_b/
__init__.py
...
module_b.py
setup.py
And you use this package in your code like so:
from mynamespace import subpackage_a
from mynamespace import subpackage_b
Then you can break these sub-packages into two separate distributions:
mynamespace-subpackage-a/
setup.py
mynamespace/
subpackage_a/
__init__.py
mynamespace-subpackage-b/
setup.py
mynamespace/
subpackage_b/
__init__.py
module_b.py
Each sub-package can now be separately installed, used, and versioned.
Management
Packaging
- See also find-namespace-packages function to declare them
In the Python - setup.py,
packages=find_packages(),
namespace_packages=['subPackage1', 'subPackage2', '...', 'subPackage3'],