pip-tools
pip-tools copied to clipboard
Support for Installation to a Different Directory
What's the problem this feature will solve?
I'm trying to install python libraries to a specific folder in my repository (not the system-packages folder that pip/pip-tools) usually installs to). More specifically, python pip supports a --target option that adds all of the downloaded python packages to the target directory specified. I would like pip-tools to also have this option.
Describe the solution you'd like
Instead of having pip-sync install to a site-packages folder in the virtual environment, I would like to give it a --target argument to install/perform all of the sync tasks in a different folder of my choosing.
Currently I can install to a specific folder like lib but pip-sync doesn't actually try to ascertain what libraries are in lib and what need to be upgraded.
Google App Engine uses a system where python libraries are vendored in their sandbox by adding the path of a directory that contains all of the specific python libraries that are installed.
Users are instructed to run pip install -r requirements.txt --target lib and then add lib to a configuration path in the application config.
Alternative Solutions
I've been looking around and there don't seem to be other tools available. I'm happy for suggestions though.
Hello @kevjumba,
There is --pip-args option in pip-sync so that you can pass any options to pip install ..., for example:
$ pip-sync --pip-args="--target=/tmp/foo"
@atugushev hello, this works for actual installation but I want to have the full suite of pip-sync tools also available on the target directory. More specifically, when I install some libraries, if I want to upgrade a singular library to a later version, pip-sync doesn't check in the target directory when it calculates which libraries to install/uninstall. Instead, I just get the same options I get when using pip install, aka that some of the libraries already exist and if I want to upgrade them use pip install --upgrade.
What I think is happening is that the pip-sync tool is looking in the .venv/python/system-packages directory when it tries to find what is installed and what is not.
Please let me know if any interpretation is incorrect.
Aw, I see your point. pip-tools is pretty tight to the virtual environment. Unfortunately, I'm not aware of how Google App Engine works with python packaging, so can't help much with this.
I haven't used GAE, but could something like this work?
$ python -m venv venv
$ ln -s $PWD/venv/lib/python*/site-packages lib
$ . ./venv/bin/activate
$ pip install -U pip pip-tools
@kevjumba
Have you been able to give that a try?