Reputation: 3502
What is the best way to distribute dependencies for an app?
Let's say I want to publish an app that depends on SqlAlchemy
- is there a clean way to include SqlAlchemy
in my repository without forcing the user to install it?
Upvotes: 7
Views: 551
Reputation: 23223
Community standard is to use pip package manager with requirements file.
E.g.
SQLAlchemy>=0.9.8
It would force installing SQLAlchemy with version above or equal to 0.9.8
.
If you want to distribute your code in standalone way, you may consider creating separate directory for 3rd party packages and extending PYTHONPATH
environment variable.
export PYTHONPATH=$PYTHONPATH:/path/to/3rdpartypackages/
Upvotes: 2
Reputation: 1
Although it would force the user to install it, I would recommend using a pip requirements file for this. ( http://www.pip-installer.org/en/latest/user_guide.html#requirements-files )
For this specific problem, the file could be as simple as a single line:
SQLAlchemy
As a general practice, you should specify the version number you depend upon in this file. If you don't want a user to have to install things because you're worried about polluting their main installation, I would look in to using VirtualEnv for this ( http://www.virtualenv.org/en/latest/ ) - This is the recommended means of distributing dependencies for Django projects at least.
Upvotes: 0