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 topoetry 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 ofdjango
to^2.1
, equivalent topoetry 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 ofpyproject.toml
and runningpoetry 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:
- Created 5 years ago
- Reactions:118
- Comments:45 (10 by maintainers)
Top GitHub Comments
I’ve created a PyPI package called poetryup that does this seamlessly. Simply runpoetryup
and it will update dependencies and bump their version in thepyproject.toml
file. Enjoy!Edit 1:
poetryupv0.5.0
can update dependencies to their LATEST available version by setting a flag as following:poetryup --latest
Edit 2:
poetryupv0.8.0
can update specific dependencies or dependencies in specific groupsEdit 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 anup
command toPoetry
itself in order to update dependencies and bumppyproject.toml
. I strongly recommend using the plugin since it provides a more native experience and comes with new features such asdry-run
,no-install
etc.Install the
up
plugin with:Usage:
For more details visit poetry-plugin-up
I thinks the request about an
upgrade
command to update all dependencies to the latest available version is valid. So I reopen it.