I’m looking to add a namespace prefix to my Python setuptools distributed package. E.g. we have a package called common_utils and a would like it to be accessed as umbrella.common_utils without having to include the dummy directory/module ‘umbrella’ in the package tree.
Is this possible?
Thanks,
You can use the
package_diroption to tell setuptools the full package name and location of the subpackage:Result:
Updated
As you’ve discovered, the
python setup.py developtarget is a bit of a hack. It adds your project folder tosite-packages/easy-install.pth, but does nothing to adapt your package to the structure described in setup.py. Unfortunately I have not found a setuptools/distribute-compatible workaround for this.It sounds like you effectively want something like this, which you could include in the root of your project and customize to your needs:
Create file named
developin your project root: