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.

Suggestion: new command to bump versions of dependencies in `pyproject.toml`

See original GitHub issue
  • I have searched the issues of this repo and believe that this is not a duplicate.

Issue

It would be awesome if Poetry had a command (let’s call it upgrade) that bumped the version constraints of dependencies in pyproject.toml (as opposed to update, which afaict updates the lock file to the newest version within the constraint specified in pyproject.toml).

Some examples for how this command could behave:

  • poetry upgrade django: Upgrade Django to the newest version that still works with other dependencies; equivalent to poetry remove django; poetry add django.
  • poetry upgrade django djangorestframework: As above, but with more than one package at a time.
  • poetry upgrade django=^2.1: Set the version of django to ^2.1, equivalent to poetry remove django; poetry add django=^2.1.
  • poetry upgrade: Upgrade every dependency to the newest possible version. Equivalent to deleting the entire [tool.poetry.dependencies] section of pyproject.toml and running poetry add with a list of the names (but not versions) of every package previously in the list. (This one would be good for cookiecutter templates for projects, to make it easy to start a new project with the latest versions of everything.)

Currently, when I want to bump the version of something, I’m either running poetry remove ...; poetry add ... which moves the package to the bottom of the list in pyproject.toml, and results in uninstalling a bunch of dependencies which sometimes just get reinstalled again at the same version; or I’m manually editing pyproject.toml which means I have to look up the latest version manually, and I can’t use Poetry’s version resolution when I want to upgrade more than one package at a time.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:118
  • Comments:45 (10 by maintainers)

github_iconTop GitHub Comments

45reactions
MousaZeidBakercommented, Dec 13, 2022

I’ve created a PyPI package called poetryup that does this seamlessly. Simply run poetryup and it will update dependencies and bump their version in the pyproject.toml file. Enjoy!

Edit 1: poetryup v0.5.0 can update dependencies to their LATEST available version by setting a flag as following: poetryup --latest

Edit 2: poetryup v0.8.0 can update specific dependencies or dependencies in specific groups

Edit 3:

With the announcement of Poetry 1.2.0 and its support for plugin support, poetryup have been ported to poetry-plugin-up. Instead of being a standalone tool, the plugin provides an up command to Poetry itself in order to update dependencies and bump pyproject.toml. I strongly recommend using the plugin since it provides a more native experience and comes with new features such as dry-run, no-install etc.

Install the up plugin with:

poetry self add poetry-plugin-up

Usage:

poetry up --help

For more details visit poetry-plugin-up

32reactions
finswimmercommented, Jun 10, 2020

I thinks the request about an upgrade command to update all dependencies to the latest available version is valid. So I reopen it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Commands | Documentation | Poetry - Python dependency ...
This command shows the current version of the project or bumps the version of the project and writes the new version back to...
Read more >
Poetry a smart way of packaging and dependency ... - LinkedIn
"Poetry install" command reads the pyproject.toml file from the current project, resolves the dependencies, and installs them. and the exact ...
Read more >
Working on a project - Copier Poetry - pawamoy's website
Dependencies are written in pyproject.toml , under the ... It means that the new suggested version will be a patch bump of the...
Read more >
Should You Use Upper Bound Version Constraints?
many for packaging, but it happens to also have a special dependency solver, a new upper bound syntax, and a strong recommendation to...
Read more >
History - setuptools 65.6.3.post20221216 documentation
#3554: Changed requires to requests in the pyproject.toml example in the ... dependencies, metadata, datafiles, etc may require a new installation.
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