pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

'save-exact' option for saving exact version in Pipfile

Open SteveByerly opened this issue 6 years ago • 4 comments

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.

SteveByerly avatar Jan 13 '19 19:01 SteveByerly

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.

jxltom avatar Jan 14 '19 01:01 jxltom

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 :)

xoelop avatar Dec 30 '19 10:12 xoelop

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 ~=

Demetri0 avatar Jan 16 '21 22:01 Demetri0

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

unique1o1 avatar Mar 24 '22 08:03 unique1o1

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.

matteius avatar Sep 16 '22 04:09 matteius