There are two apps that have a few modules in common, like this:
/apps /app1 /.ve /requirements.txt /app2 /.ve /requirements.txt /modules /module1 /requirements.txt /module2 /requirements.txt /module3 /requirements.txt /module4 /requirements.txt - app1 depends on
module1andmodule3and uses virtualenv - app2 depends on
module2andmodule3and uses virtualenv - module3 depends on
module4 - modules are like 3rd party packages, but are under an active local development. They will only ever be executed by an
application, so they do not have their own virtualenv - each app and each module has it's own requirements.txt
How do I "correctly" wire this thing up? The goal is to be able to install whole dependency graph for each application in /apps using a single command (like pip install -r requirements.txt, no custom scripts prefferably)
Idea #1:
- add
/modulesto PYTHONPATH - use
-r ../modules/module1/requirements.txtsyntax in requirements.txt for each app
The problem: PIP will not work if any requirement is sepcified in both requirements.txt files (https://github.com/pypa/pip/issues/2367). If both app1 and module1 depends on django, I need to be able to make this explicit in their corresponding requirements.
Idea #2:
- Create an egg/wheel/package/whatever for each module under
/modules, and reference them in each app's requirements.txt
The problem: Creating eggs just for the sake of making pip behave properly is a lot of work. Plus development would be harder - I would have to reinstall each egg every time something changes.
pip install? If you callpip installseparately for each app it should just install what it needs, leaving any already-installed dependencies in place.pip installper application - one for app1 and one for app2. I updated my question to indicate that I want to put each app in a separate virtualenvrequirement.txtin the apps directly reference therequirements.txtof the modules? If so, can you just instead specify the modules as normal dependencies and let pip install them normally?requirements.txtdirectly reference any dependencies of the modules.requirements.txtbutpip installwill just copy the files - it makes the module development harder.