Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poetry add should choose latest supported package version for project's Python constraints #9295

Closed
Werfire opened this issue Apr 10, 2024 · 2 comments
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@Werfire
Copy link

Werfire commented Apr 10, 2024

Issue Kind

Change in current behaviour

Description

Let's say my project has python version configured like this:

[tool.poetry.dependencies]
python = "~3.8"

Then if I try to simply run poetry add numpy, I will get the following output:

Using version ^1.26.4 for numpy

......

The current project's supported Python range (>=3.8,<3.9) is not compatible with some of the required packages Python requirement:
  - numpy requires Python >=3.9, so it will not be satisfied for Python >=3.8,<3.9

Because no versions of numpy match >1.26.4,<2.0.0
 and numpy (1.26.4) requires Python >=3.9, numpy is forbidden.
So, because dq-client depends on numpy (^1.26.4), version solving failed.

  • Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties
    
    For numpy, a possible solution would be to set the `python` property to "<empty>"

But if I run poetry add "numpy:*" it will successfully resolve and install numpy version 1.24.4, which is the last version that supports Python 3.8. Then I have to manually change the numpy version in pyproject.toml from "*" to "^1.24.4".

I suggest that poetry add should automatically search for the latest compatible package if no version constraints are specified, because I don't see a reason why it should fail when it might not. 😅

Impact

Poetry will install new project dependencies, ensuring Python version compatibility out of the box (like pip does that).

Workarounds

Specifying compatible package version to add manually.

@Werfire Werfire added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Apr 10, 2024
@dimbleby
Copy link
Contributor

duplicate #707 etc please close

@Werfire Werfire closed this as completed Apr 10, 2024
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators May 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants