As far as I can tell, the pipenv command line tool always derives the project directory (Pipfile location) from the current working directory. Is there a way to tell pipenv which project directory to use as a command-line option? If not, is this a compelling feature request?
In my use case, I want to determine the venv path for a project from a script. I'd prefer not to change the current working directory just to invoke pipenv --venv
in a shell process. Is there a stable API for doing this directly from Python? (Whereas the feature request to accept a project dir on the command line would be a similar API for shell scripting.)
There is a tool called pipenvlib
which we don't spend a lot of time on but if you want to do this from a shell process you can temporarily set PIPENV_PIPFILE
to point at the Pipfile of the relevant project and run pipenv --venv
:
~/g/pypa-pipenv î‚° î‚ master $… î‚° set -gx PIPENV_PIPFILE /home/hawk/git/requirementslib/Pipfile
~/g/pypa-pipenv î‚° î‚ master $… î‚° pipenv --venv
/home/hawk/.virtualenvs/requirementslib-5MhGuG3C
~/g/pypa-pipenv î‚° î‚ master $… î‚° set -e PIPENV_PIPFILE
~/g/pypa-pipenv î‚° î‚ master $… î‚° pipenv --venv
/home/hawk/.virtualenvs/pypa-pipenv-PuUpLSqX
Most helpful comment
There is a tool called
pipenvlib
which we don't spend a lot of time on but if you want to do this from a shell process you can temporarily setPIPENV_PIPFILE
to point at the Pipfile of the relevant project and runpipenv --venv
: