Fang-Pen Lin
Fang-Pen Lin

Reputation: 14406

How to install python package without copy everything into lib/site-packages?

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

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?

Upvotes: 0

Views: 833

Answers (2)

Fang-Pen Lin
Fang-Pen Lin

Reputation: 14406

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.

Upvotes: 2

Ben Hughes
Ben Hughes

Reputation: 2547

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 !

Upvotes: 1

Related Questions