I\'m using namespaces with setuptools to distribute a same module in two different repositories. The goal is to get mymodule.one
and mymodule.two
i
There are two requirements for using name spaces correctly.
__init__.py
of modules declare a name spaceThe contents of both __init__.py
files should be:
__import__('pkg_resources').declare_namespace(__name__)
Then setup.py for first module:
setup(name='mymodule_one', packages=find_packages('.'),
namespace_packages=['mymodule'])
and second module
setup(name='mymodule_two', packages=find_packages('.'),
namespace_packages=['mymodule'])
As a result, should be able to install and import both mymodule.one
and mymodule.two
The common name space mymodule
allows both modules to be imported using the same name.
The name
given to setup.py for each module needs to be unique as that is used for the installation path of the module and will overwrite anything that shares it, as you have seen.