views:

65

answers:

2

I want to develop a common python package, I got other packages depends on it. For example:

  • packageA/
  • packageB/
  • packageC/
  • commonPackage/

packageA, packageB and packageC can all be executed directly, but they are all depend on commonPackage. I want to install the commonPackage into lib/site-packages, but I don't want it copys the source code. Instead, I want it creates a commonPackage.pth in lib/site-packages with the path of where the commonPackage at. So that when I modify commonPackage or update it from SVN, I don't need to install it again. Here comes the problem, how can I write the setup.py or use the options of python setup.py install so that it would do what I want?

+1  A: 

You can always take a look at virtualenv which will allow you to create a python environment for each of your projects - this is the ideal way to develop/build/deploy your app without having load up your site-packages directory with all and sundry.

There's a good tutorial here:

http://iamzed.com/2009/05/07/a-primer-on-virtualenv/

Good luck !

Ben Hughes
+1  A: 

Oops, I just find exactly what I want here. The develop command of setuptools do what I said. Here you type

python setup.py develop

It creates .pth rather than copying everything into site-packages.

Victor Lin