question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a pip-style `--upgrade-strategy` setting to `pipenv lock`?

See original GitHub issue

pip install these days offers an --upgrade-strategy option to let users choose between “only-if-needed” upgrades (which upgrades components only if needed to satisfy new dependencies) and “eager” upgrades, which upgrades everything which has a newer version available that still meets the dependency constraints.

In pip 10, the default strategy is changing from eager to only-if-needed: https://github.com/pypa/pip/pull/4500

pipenv lock currently follows the original pip install --upgrade policy of “upgrade everything”.

This is actually fine for my own current use cases - most of my dependencies are stable enough that the combination of loose dependencies in Pipfile and eager upgrades in pipenv lock works well. I also think this remains the right default behaviour for pipenv.

However, I’m wondering if permitting pipenv lock --upgrade-strategy=only-if-needed may make pipenv applicable to more use cases.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

13reactions
brettdhcommented, Oct 25, 2017

I’d like to push back here. only-if-needed is a much more sensible default in my view, particularly coming from other package managers such as npm, yarn, and gem. If packages are automatically upgraded when doing so is not required, then the lockfile is not a lockfile; it’s just a suggestion.

The whole point of the lockfile is to pin dependencies to a known working version - to not have to assume that “most of my dependencies are stable enough”; to make all upgrades explicit (which, of course, is better than implicit).

I started this line of conversation in #966, but maybe this (or another issue) is a better place for it. Having --upgrade-strategy in pipenv would be a fine stopgap, but I maintain that only-if-needed is a more sensible default, as evidenced by pip 10 and the aforementioned package managers. The current situation doesn’t allow either, which makes pipenv a less reliable tool for locking down dependencies.

7reactions
mimischicommented, Dec 6, 2017

I agree with what @Telofy said. Deterministic builds would be really helpful and I actually thought pipenv was trying to do that with Pipfile.lock.

Let’s say I write a Django app and use packageA==1.0.0, while there is a new version packageA==2.0.0 with breaking changes, that I do not want to include in my project. Upon upgrading to django==2.0.0, I add packageB via pipenv install packageB. Now pipenv will upgrade packageA to it’s newest version, while I may wanted to keep the old version to keep my project from breaking.

In that case: what are my options? Pin down dependencies in Pipfile instead of using * as the version argument?

So far I’ve been using requirements.txt and pinned down version by hand / using services like https://pyup.io.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic Usage of Pipenv - Read the Docs
lock ¶. Pipfiles contain information for the dependencies of the project, and supersedes the requirements.txt file used in most Python projects. You should...
Read more >
pipenv Documentation - Read the Docs
Generates and checks file hashes for locked dependencies when installing from Pipfile.lock. • Automatically install required Python version when pyenv is ...
Read more >
Setting up a Python development environment with pipenv
Put the requirements.txt file in your project directory · Run pipenv lock · Run pipenv install --ignore-pipfile - this will install all packages ......
Read more >
Pipenv: A Guide to the New Python Packaging Tool
You should see something like the following in your terminal: Adding flask==0.12.1 to Pipfile's [packages]... Pipfile.lock not found, creating.
Read more >
Manage dependencies using Pipfile - IntelliJ IDEA - JetBrains
Add a new package dependency by modifying the packages section. ... pipenv lock — records the new requirements to the Pipfile.lock file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found