pipenv
pipenv copied to clipboard
'save-exact' option for saving exact version in Pipfile
I've looked through the docs and the cli, but cannot seem to find a way to save the version of the installed package explicitly without editing the Pipfile after installing a package.
Example:
pipenv install scipy
would add scipy = "*"
to the Pipfile.
I would have expected a way to have scipy = "==1.2.0"
to the Pipfile instead.
I was wondering if this sort of functionality already exists and/or if there is any reason not to go this route.
This would be similar to running npm install react --save-exact
, where the installed version is added to the package.json
file.
Apologies in advance if this is not the right forum/format for this question. I had tried looking through the docs, Stackoverflow, and search engines without luck.
I'm +1 on this but it requires a PEEP https://github.com/pypa/pipenv/blob/master/peeps/PEEP-000.md since it is a API change.
For now, you can only edit the Pipfile manually and lock it again by pipenv lock
or pipenv install --dev
if you would like to lock/install.
BTW, I've just seen that you can do pipenv install --ignore-pipfile
(source) and you install the versions that are saved in Pipfile.lock, ignoring Pipfile.
So there's no option so save-exact to Pipfile because it's being done already to Pipfile.lock every time you do pipenv install
.
Just my 2 cents :)
I think that it should be by default behavior. I'm totally don't mean any
version when I install something, but I mean the latest on the current moment
(moment when I use pipenv install smth
). And I wish bugfixes to be applicable so it should be not ==
but ~=
What I do to get the exact version is:
pipenv run pip freeze > requirements.txt
pipenv install -r requirements.txt
Just a simple workaround so, that I don't have to dig the lock file. Though it can pollute your Pipfile
with all the dependencies
pipenv sync
installs the versions from the lock file, and pipenv install
re-lock with the Pipfile specifiers and then installs that updated lock file.