In addition to runtime namespaces (Local, Enclosing, Global, Built-in), Python also has the concept of namespace packages, which relate to how modules and sub-packages are organized on disk.
A namespace package allows you to spread a single Python package across multiple directories or distributions. This is especially useful for large frameworks or plugin systems.
An explicit namespace package uses an __init__.py
file to mark a directory as a Python package. This traditional method supports:
__init__.py
please refer to the Understanding __init__ in Packages for more details on implicit and explicit namespace packages.
So, while runtime namespaces map names to objects in memory, package namespaces organize modules and their availability in your file system.