Monday, April 11, 2011

How to satisfy dependencies for your python projects

You need a text file in your project with your dependencies, i.e. REQUIREMENTS, with a list of packages your project depends on.

PIP's requirement file format (detailed):
<package-name>[==<version>]
-e <repository address>#egg=<desirable-package-name>

And when you need to init the project in a new place you'd like to run:
# init or activate a virtual environment
(virtual-env)$ pip install -r REQUIREMENTS

That's all. You packages will be automatically installed. And you can run that command whenever you want (i.e. a new dependency has been added) - it just recheck all mentioned packages and install new ones.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.