Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusion: --keep-outdated --selective-upgrade #3461

Closed
dvf opened this issue Jan 18, 2019 · 9 comments
Closed

Confusion: --keep-outdated --selective-upgrade #3461

dvf opened this issue Jan 18, 2019 · 9 comments
Labels
--keep-outdated/--selective-upgrade Category: Dependency Resolution Issue relates to dependency resolution. Type: API Change This issue describes an API change. Type: Discussion This issue is open for discussion. Type: Documentation 📖 This issue relates to documentation of pipenv. Type: Enhancement 💡 This is a feature or enhancement request.

Comments

@dvf
Copy link
Contributor

dvf commented Jan 18, 2019

Just to get some clarity. I'm trying to update a specific package. The docs say I should do:

pipenv update my_package

The help says that --selective-upgrade "Updates specified packages."... isn't that what the above command does? And shouldn't we rename it to selective-update instead of selective-upgrade 😅

I'm just trying to update a specific package without pipenv trying to update all other outdated dependencies. The docs suggest that this is what --keep-outdated does... but shouldn't that be the default behaviour?

@wjordan213
Copy link

bump

@frostming frostming added the Type: Documentation 📖 This issue relates to documentation of pipenv. label Jan 19, 2019
@jxltom
Copy link
Contributor

jxltom commented Jan 19, 2019

The selective-upgrade is pip's --upgrade-strategy=only-if-needed option. The keep-outdated is like only adding new stuffs to Pipfile.lock but no removing packages which is invalid in the new dependency resolution. This is very useful when you lock multiple times in different python versions.

For the record, I might be wrong. @techalchemy is the best one to answer this. There is a full implementation of keep-outdated #3304 waiting to be merged.

@frostming
Copy link
Contributor

Sorry for making a mistake in my previous comment. In fact, the package name passed as argument is not used at all. It might be supported after #3304 is merged.

@dvf
Copy link
Contributor Author

dvf commented Mar 12, 2019

@techalchemy help us out here...

@chgad
Copy link

chgad commented Apr 13, 2019

I ran in an actual problem with this :

The Package Djoser had it's Version 1.4.0 removed and i want to update to the new 1.5.1 without updating the other locked versions.

Haveing read all comandline options i thought

pipenv update --keep-outdated --pre --selective djoser

would ONLY update djoser and keep all other package versions even though the y might be outdated.

Please clarify what's going on with those flags and add an example for updating only one packages.

@techalchemy
Copy link
Member

Apologies for not responding to this sooner, I've been super busy with work but more significantly there were a number of breaking changes related to PEP514 implementation which first pip rolled out and then setuptools rolled out and then there was a bit of a stalemate-fingerpointing situation and then some more breakages which has all been a bit of a nightmare

The result of this is that pipenv just does its own dependency resolution with requirementslib which needed a resolver to handle direct url dependencies as someone mentioned with regard to #3304

With regard to the specific question here, there is significant confusion about --keep-outdated (which should really do nothing under optimal circumstances unless things are no longer available or installable on PyPI when you re-lock, which can happen if you are on OSX for example), --selective-upgrade only works with install and can be used to install the minimum viable set of changes into the lockfile (that is, still using the highest available versions etc, but not upgrading packages unnecessarily)

The only real difference is that you can add something to your Pipfile and lock with --keep-outdated for the same behavior -- and formally speaking, --keep-outdated should never remove something from the lockfile (I am not sure what --selective-upgrade does on this front).

Here is the important caveat: pipenv update always targets every package in your lockfile, without exception. It does not accept arguments. If you want to upgrade a specific package, you must do it with pipenv install --selective-upgrade <package> (which naturally will add it to your lockfile)

This needs to be reviewed at some point because it is super inconvenient and probably is a major gap in normal workflows

@techalchemy techalchemy added Category: Dependency Resolution Issue relates to dependency resolution. Priority: High This item is high priority and should be resolved quickly. Status: Requires PEEP This issue requires an accompanying enhancement proposal Type: API Change This issue describes an API change. Type: Discussion This issue is open for discussion. Type: Enhancement 💡 This is a feature or enhancement request. labels May 20, 2019
@saisankargochhayat
Copy link

Apologies for not responding to this sooner, I've been super busy with work but more significantly there were a number of breaking changes related to PEP514 implementation which first pip rolled out and then setuptools rolled out and then there was a bit of a stalemate-fingerpointing situation and then some more breakages which has all been a bit of a nightmare

The result of this is that pipenv just does its own dependency resolution with requirementslib which needed a resolver to handle direct url dependencies as someone mentioned with regard to #3304

With regard to the specific question here, there is significant confusion about --keep-outdated (which should really do nothing under optimal circumstances unless things are no longer available or installable on PyPI when you re-lock, which can happen if you are on OSX for example), --selective-upgrade only works with install and can be used to install the minimum viable set of changes into the lockfile (that is, still using the highest available versions etc, but not upgrading packages unnecessarily)

The only real difference is that you can add something to your Pipfile and lock with --keep-outdated for the same behavior -- and formally speaking, --keep-outdated should never remove something from the lockfile (I am not sure what --selective-upgrade does on this front).

Here is the important caveat: pipenv update always targets every package in your lockfile, without exception. It does not accept arguments. If you want to upgrade a specific package, you must do it with pipenv install --selective-upgrade <package> (which naturally will add it to your lockfile)

This needs to be reviewed at some point because it is super inconvenient and probably is a major gap in normal workflows

@techalchemy Thank you for explaining the difference and pointing out how to upgrade a selective package. It seems like pipenv install --selective-upgrade <package> does what you stated, but only misses out on updating the hash of the new version in the lockfile. 😞 Is this a already tracked issue?

@matteius
Copy link
Member

--keep-outdated and likely --selective-upgrade are deprecated/slated for removal. I've been working on an alternative command pipenv upgrade that solves the kind of problems these other flags caused. Checkout out: #5617

@matteius
Copy link
Member

matteius commented Mar 4, 2023

I am closing this in prep for the release that deprecates both of these flags and gives a safer options with pipenv update pipenv upgrade options -- expecting a new release soon but some users have been happy trying this out with the main branch.

@matteius matteius closed this as completed Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--keep-outdated/--selective-upgrade Category: Dependency Resolution Issue relates to dependency resolution. Type: API Change This issue describes an API change. Type: Discussion This issue is open for discussion. Type: Documentation 📖 This issue relates to documentation of pipenv. Type: Enhancement 💡 This is a feature or enhancement request.
Projects
None yet
Development

No branches or pull requests

8 participants