Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Installation to a Different Directory #1205

Open
kevjumba opened this issue Aug 21, 2020 · 5 comments
Open

Support for Installation to a Different Directory #1205

kevjumba opened this issue Aug 21, 2020 · 5 comments
Labels
feature Request for a new feature

Comments

@kevjumba
Copy link

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.

@atugushev
Copy link
Member

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 atugushev added the support User support label Aug 22, 2020
@kevjumba
Copy link
Author

kevjumba commented Aug 22, 2020

@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.

@atugushev
Copy link
Member

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.

@atugushev atugushev added feature Request for a new feature and removed support User support labels Aug 28, 2020
@AndydeCleyre
Copy link
Contributor

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

@AndydeCleyre
Copy link
Contributor

@kevjumba

Have you been able to give that a try?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Request for a new feature
Projects
None yet
Development

No branches or pull requests

3 participants