title: How to manage several python subprojects with setuptools?
body: <p>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:</p>
  
  <pre><code>trunk\
      proj1\setup.py
            company_name\__init__.py + proj1's code
      proj2\setup.py
            company_name\__init__.py + proj2's code
  </code></pre>
  
  <p>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 <code>import company_name...</code> gets confused on which company_name package to look in and it grabs the first/last/random one.</p>
  
  <p>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!</p>
  
  <hr>
  
  <p>edit: I just tried adding a setup.py in the root folder with </p>
  
  <pre><code>...    
  namespace_packages = ['company_name'],
  package_dir = {'company_name' : ['proj1/company_name', 'proj2/company_name']}
  ...
  </code></pre>
  
  <p>with appropriate <code>pkg_resources.declare_namespace(__name__)</code> in the <code>__init_.py</code> files, but <code>./setup.py bdist_egg</code>  just gives:</p>
  
  <blockquote>
    <p>error in company_name setup command: Distribution contains no modules or packages for namespace package 'company_name'</p>
  </blockquote>