What's the problem this feature will solve?
I use container to deploy Python application to production. The container building script performs the following command lines:
python3 -m pip install pipenv
python3 -m pipenv sync # Install modules from Pipenv.lock
python3 -m pipenv run python3 -m pip freeze > requirements.txt
python3 -m pip install -r requirements.txt
python3 -m pip uninstall pipenv
rm requirements.txt
Describe the solution you'd like
Replace the above command lines by just one pretty pip
option:
python3 -m pip install --pipfile Pipfile.lock
Additional context
The project https://github.com/pypa/pipfile/blob/master/README.rst states:
Pipfile
and its sisterPipfile.lock
are a replacement for the existing standardpip
'srequirements.txt
file.
Let's start the movement by adding an experimental option in next pip
release :smile:
EDIT: My colleague has just pointed me that this has already been (eventually) planed. The same document, at chapter Pip Integration (eventual) says:
pip
will grow a new command line option,-p
/--pipfile
to install the versions as specified in aPipfile
, similar to its existing-r
/--requirement
argument for installingrequirements.txt
files.
I'm not sure there's consensus that pipenv.lock
is a replacement for requirements.txt
(regardless of what is stated in that project's repository) and I'm cautious about adding an option to pip that is specific to another project (will we then get requests to add an option for Poetry's lock file format?)
At a minimum, I'd like to see some discussion within the community that resulted in agreement that pipenv.lock
was a standard format, before adding this (and in particular, I'd like the poetry devs to have bought into that agreement).
There's discussion about a standard lock file format: https://discuss.python.org/t/structured-exchangeable-lock-file-format-requirements-txt-2-0/876
Poetry's author hasn't really interacted much AFAICT -- @sdispater are you interested in helping figure out how to improve existing tooling?
Also see https://github.com/pypa/pipfile/issues/108 for discussion of some of the potential design details to be considered.
In the meantime, note that 'pipenv lock' includes native support for generating a requirements.txt file, so it isn't necessary to use pip freeze for that: https://docs.pipenv.org/en/latest/advanced/#generating-a-requirements-txt
Homepage of Pipenv project seems to have changed, the link in the above message of @ncoghlan is broken, and should be:
https://pipenv.pypa.io/en/latest/advanced/#generating-a-requirements-txt
$ pipenv lock -r > requirements.txt
$ pipenv lock -r --dev-only > dev-requirements.txt
Most helpful comment
There's discussion about a standard lock file format: https://discuss.python.org/t/structured-exchangeable-lock-file-format-requirements-txt-2-0/876