I'm wondering about the correct/easiest/most pythonic way of dealing with subprojects that you want have using the same base package. We currently have a file structure like this:
trunk\
proj1\setup.py
company_name\__init__.py + proj1's code
proj2\setup.py
company_name\__init__.py + proj2's code
We want to keep the namespace company_name common to all our projects (maybe this itself is unpythonic?) but when proj1 and proj2 are installed in develop mode, the first one installed gets broken. It looks like import company_name...
gets confused on which company_name package to look in and it grabs the first/last/random one.
How would this normally be handled in a larger python project? Is it possible to resolve this with a setup.py in the trunk that builds some sort of mega-egg? I haven't found any relevant info on google or stack, so any information even just links are greatly appreciated!
edit: I just tried adding a setup.py in the root folder with
...
namespace_packages = ['company_name'],
package_dir = {'company_name' : ['proj1/company_name', 'proj2/company_name']}
...
with appropriate pkg_resources.declare_namespace(__name__)
in the __init_.py
files, but ./setup.py bdist_egg
just gives:
error in company_name setup command: Distribution contains no modules or packages for namespace package 'company_name'