命名空间包的树结构

Tree structure for namespace package

我有一个名为 networkx-metis 的包,它具有以下树结构

networkx-metis/
              setup.py
              networkx/
                      __init__.py
                      addons/
                            __init__.py
                            metis/
                                 metis.py

networkx.addons.metis 应该作为命名空间包安装在 networkx 核心包中。上面的两个__init__.py包含单行代码

__import__('pkg_resources').declare_namespace(__name__)

现在我有一些具体的问题,

What should be the changes in the networkx core package? Where should I put empty __init__.py files?

networkx/addons/里面添加一个__init__.py,里面只有一行代码

__import__('pkg_resources').declare_namespace(__name__)

What should be the value of namespace_packages in setup() of the setup.py of networkx-metis?

应该是

namespace_packages = ['networkx.addons', 'networkx']