poetry icon indicating copy to clipboard operation
poetry copied to clipboard

Add flag to `poetry add` to allow the installation of the latest compatible version

Open nbro opened this issue 1 year ago • 3 comments

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

  1. poetry add "django@*" --dry-run
  2. Check the output to see what version would be installed (say it's 5.0.6)
  3. 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.

nbro avatar May 31 '24 22:05 nbro

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 avatar May 31 '24 23:05 dimbleby

@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.

nbro avatar May 31 '24 23:05 nbro

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.

dimbleby avatar Jun 01 '24 00:06 dimbleby

Duplicate of #707

finswimmer avatar Oct 28 '24 20:10 finswimmer

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.

github-actions[bot] avatar Nov 28 '24 00:11 github-actions[bot]