Add flag to `poetry add` to allow the installation of the latest compatible version
Issue Kind
Brand new capability
Description
If you do poetry add django, poetry will try to install the latest version of django. However, if the latest version of django is not compatible with other dependencies or the Python version, you will get an error and poetry will not add django to pyproject.toml or install it in the virtual environment.
Often, we don't care about installing the latest version. We just want to install the latest version that is compatible with other libraries and the Python versions.
So, poetry add should have a flag that allows us to do this easily.
I'd be very surprised if this was never requested, so I'd assume that this will be a duplicate of an old issue.
Impact
It will simplify our life.
Workarounds
Right now, the only workaround I know is unnecessarily complicated
poetry add "django@*" --dry-run- Check the output to see what version would be installed (say it's
5.0.6) - Install the version with
poetry add "django@^5.0.6"
So, basically, I'm asking that a flag like --latest-compatible or -l (or any other better name) is added to poetry add that would automatically do the 3 steps above.
Clearly, I don't want to do just poetry add "django@*", because I actually care about having a specific version or set of versions - I don't want my pyproject.toml to allow any version.
I'd be very surprised if this was never requested, so I'd assume that this will be a duplicate of an old issue.
#707 and many others please close
@dimbleby This is not a duplicate of the linked issue, at least not of the original post, although they are somehow related and the general issue is described in this comment. Maybe you can find a closer issue? Anyway, here basically I am suggesting the addition of a flag not change the default behavior of poetry add, which some people in the comments there seem to be suggesting.
It's all the same. You are seeing the exact problem described there, your suggestion is at best a minor variation on existing suggestions. No point in opening a new issue for every such idea, just leave a comment in the already open issue.
This is one of the older open issues, clearly no one has yet found it worthwhile to do anything about it. So if you want to see something happen, recommend that doing it yourself and submitting a pull request is the most likely way.
Duplicate of #707
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.