pip install from stdin
See original GitHub issueI see that an existing ticket has been rejected: #3880 . I’m requesting that the team reconsider.
The main use case I have for this feature is to build an environment using a set of requirements specified in a URL or coming from a specific git
commit:
% curl https://foo.com/requirements.txt | pip install -r -
% git show deadbeef:requirements.txt | pip install -r -
There are workarounds, e.g. to leverage some shell feature for running a subprocess (e.g. pip install -r <(curl https://foo.com/requirements.txt)
or similar) or download the file in advance to some temporary location, but these are more esoteric, shell-dependent, or require extra cleanup steps. I believe the cleanest solution for the user is simply to behave like a standard command-line tool and use stdin
/stdout
in the normal ways.
In the spirit of conforming even better to standard POSIX style, I’d further recommend that the -
be unnecessary, e.g. if no file argument is given for -r
that input be taken from stdin
, just like other input-consuming tools like cat
, cut
, less
, python
etc. do:
% curl https://foo.com/requirements.txt | pip install -r
% git show deadbeef:requirements.txt | pip install -r
Thanks for considering.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:16 (8 by maintainers)
Top GitHub Comments
An alternative that works today (example with
bash
):Have another solution using xargs (filters all packages with letter “a”):
cat requirements.txt | grep 'a' | xargs pip install