How to install / update package with pipenv without updating the rest of packages

jozo picture jozo · Apr 9, 2019 · Viewed 8.4k times · Source

I use pipenv (version 2018.11.26) to manage dependencies in my project. Sometimes I want to add or update only one package and don't change versions of other packages. How can I achieve that? I've tried both

pipenv update --selective-upgrade requests

and

pipenv update --keep-outdated requests

but still versions of all the packages are updated during locking.

Pipfile & Pifile.lock: https://gist.github.com/jozo/d8351ed708e84c5ea0f69e82e585e5c6

Answer

Eugene Yarmash picture Eugene Yarmash · Apr 12, 2019

Running pipenv install/uninstall/update with --keep-outdated will prevent pipenv from updating unrelated locked packages. (It's odd that this is not the default befavior).

If you don't want some packages to ever be updated automatically, you should pin those in your Pipfile, e.g:

[packages]
django = "==2.2"
djangorestframework = "==3.9.2"