I am trying to configure some Python packages that will share a common set of “utilities”, but should be able to distribute them as separate “packages”. Assume the following structure:
/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
| |-...
I would like to be able to use setup.py to create a package package1 or package2, both of which must include the same utilities.
All the tutorials I found use a simple single project, which makes using one setup.py pretty simple. But how do I create several different packages from the same directory (this is the git repository structure)? Right now I'm using package1_setup.py to build package1, which is similar to:
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 >= 2.40',
'python-swiftclient >= 3.2.0',
'fabric >= 1.13.0',
],
)
So, when I want to build package1, I:
% python package1_setup.py sdist
, "", setup.py package1_setup.py. , , , .
,
Rob