title: Distributing multiple packages using setup.py for Python
body: <p>I'm trying to setup some Python packages that will share a common set of "utilities" but need to be able to distribute them as separate "packages." Assume the following structure:</p>
  
  <pre><code>/packages
      |-setup.py
      |-__init__.py
      |-MANIFEST.in
      |-com
      |    |-__init__.py
      |    |-company
      |    |    |-__init__.py
      |    |    |-subdir1
      |    |    |    |-__init__.py
      ...
      |-utilities
      |    |-__init__.py
      |    |-utils1.py
      |    |-utils2.py
      |    |-...
      |-package1
      |    |-__init__.py
      |    |-package1_1.py
      |    |-package1_2.py
      |    |-...
      |-package2
      |    |-__init__.py
      |    |-package2_1.py
      |    |-package2_2.py
      |    |-...
  </code></pre>
  
  <p>I would like to be able to use setup.py for building either package1 or package2 both of which should include the same utilities. </p>
  
  <p>All of the tutorials I've found use a simple single project which makes using a single setup.py fairly straightforward. But how do I create multiple different packages from the same directory (it's a git repository) structure? At the moment I'm using package1_setup.py to build package1 that looks similar to:</p>
  
  <pre><code>from setuptools import setup,find_packages
  import sys, os
  
  version = '0.1'
  
  setup(name = 'package1',
        version = version,
        description = 'Package 1',
        author = 'Rob Marshall',
        author_email = 'rob.marshall17@gmail.com',
        url = None,
        packages = ["package1","utils","com"],
        include_package_data = True,
        zip_safe = False,
        entry_points = {
                        'console_scripts':[
                                           'tool1 = package1.package1_1:main',
                                           'tool2 = package1.package1_2:main',
                                           ],
                        },
        install_requires = [
                            'boto &gt;= 2.40',
                            'python-swiftclient &gt;= 3.2.0',
                            'fabric &gt;= 1.13.0',
                            ],
        )
  </code></pre>
  
  <p>So when I want to build package1 I do:</p>
  
  <pre><code>% python package1_setup.py sdist
  </code></pre>
  
  <p>Which creates an installable source package but is somewhat "awkward" because the setup.py is called package1_setup.py. Not that that is tragic, but I was wondering if there's a better way to do this.</p>
  
  <p>Thanks,</p>
  
  <p>Rob</p>