Tools / best practices for managing application dependencies?
What tools or best practices are available for tracking and managing dependencies of the software I'm developing? I'm using Python / Django, and to date all my software requirements are open source.
I'm developing a web application that, while modest, has a number of dependencies. At a minimum, I'd like to track the software and version number for these. I suppose I'd also like to track the configurations of the required software, and possibly some system-level stuff (userid, if any, of the process of th开发者_Python百科e instance required software, and required permissions thereof).
(Better yet would be something that would help me set up a server for the application when I'm ready to deploy. Still better would be something that allows me to track the the http and dns name server used to support the app. But rumor has it that puppet is a tool for that sort of thing.)
Use pip
and virtualenv
. With virtualenv
, you can create a "virtual environment" which has all your Python packages installed into a local directory. With pip install -r
, you can install all packages listed in a specific requirements file.
Rough example:
virtualenv /path/to/env --no-site-packages --unzip-setuptools # create virtual environment
source /path/to/env/bin/activate # activate environment
easy_install pip # install pip into environment
source /path/to/env/bin/activate # reload to get access to pip
pip install -r requirements.txt
Where requirements.txt
contains lines like this:
django==1.3
The great thing about this is that requirements.txt
serves both as documentation and as part of the installation procedure, so there's no need to synchronize the two.
精彩评论