Poetry: support for poetry add --latest

Created on 23 Feb 2019  路  8Comments  路  Source: python-poetry/poetry

  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] I have searched the documentation and believe that my question is not covered.

Feature Request

Add a way to update to latest released version. Let's say you are using gunicorn 18.x.x and you want to install the latest gunicorn 19.x.x.
Right now I couldn't find a straight forward way to do it. I found out that removing the package from the pyproject.toml and doing poetry add <package> does what I want.

Ideally I think it would be nice to have something like:
poetry add <package> --latest

Notes

Doing poetry add <package>==<latest_version> works also, but it's not the right way, because the pyproject.toml will be updated with a =<version> instead of ^<version>.

I searched a lot and couldn't find the solution, so in case it's already there I'll try to update the docs.

Most helpful comment

And if you always want get the latest version, just pin it to gunicorn = "*" in pyproject.yml.

All 8 comments

If you have gunicorn = "^18" in your pyproject.toml and then run poetry update gunicorn, it will update to the latest gunicorn available.

And if you always want get the latest version, just pin it to gunicorn = "*" in pyproject.yml.

My use case is different. I want to update once to the latest, not always install the latest, so no *, and I want to update the major, so no ^. In yarn for example you can do yarn add x@latest so it will install latest and will pin your version to the latest with a caret.

The main idea of this is that you manually update to the latest major. Otherwise you poetry update the minors

If i'm understanding, you'd want

gunicorn = "18.*"

and then change it to

gunicorn = "19.*"

and run poetry update?

No, I would like to have:

gunicorn = "^18"

and then do

poetry add gunicorn --latest

and I would see reflected in my pyproject.toml

gunicorn = "^19"

Otherwise a user has to manually search for the latest version.

My 2c: I think this is an impedance mismatch between the pyproject and the lockfile...

I don't see how, it should update the deps if possible, otherwise error. yarn and npm have this behaviour irc.

Was this page helpful?
0 / 5 - 0 ratings