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

Respect Requires-Python in universal resolution #3998

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Jun 3, 2024

Summary

Closes #3982.

@charliermarsh charliermarsh added the preview Experimental behavior label Jun 3, 2024
@charliermarsh charliermarsh force-pushed the charlie/req-python branch 2 times, most recently from ab5834d to 823f9a1 Compare June 3, 2024 22:26
@charliermarsh charliermarsh changed the base branch from main to charlie/req-i June 3, 2024 22:26
Base automatically changed from charlie/req-i to main June 3, 2024 22:37
@charliermarsh charliermarsh marked this pull request as ready for review June 3, 2024 22:42
@charliermarsh charliermarsh force-pushed the charlie/req-python branch 5 times, most recently from 7b4b18b to cd1fb38 Compare June 3, 2024 23:06
----- stderr -----
warning: `uv lock` is experimental and may change without warning.
× No solution found when resolving dependencies:
╰─▶ Because the requested Python version (>=3.7) does not satisfy Python>=3.8 and the requested Python version (>=3.7) does not satisfy Python>=3.7.9,<3.8, we can conclude that Python>=3.7.9 are incompatible.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a particularly clear message but it's roughly the same as echo "pygls>=1.1.0" | cargo run pip compile --python-version 3.7 - before any of my changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's Poetry:

The current project's Python requirement (>=3.7) is not compatible with some of the required packages Python requirement:
  - pygls requires Python >=3.7.9,<4, so it will not be satisfied for Python >=3.7,<3.7.9 || >=4
  - pygls requires Python >=3.7.9,<4, so it will not be satisfied for Python >=3.7,<3.7.9 || >=4
  - pygls requires Python >=3.7.9,<4, so it will not be satisfied for Python >=3.7,<3.7.9 || >=4
  - pygls requires Python >=3.7.9,<4, so it will not be satisfied for Python >=3.7,<3.7.9 || >=4
  - pygls requires Python >=3.7.9,<4, so it will not be satisfied for Python >=3.7,<3.7.9 || >=4
  - pygls requires Python >=3.8, so it will not be satisfied for Python >=3.7,<3.8
  - pygls requires Python >=3.8, so it will not be satisfied for Python >=3.7,<3.8

Because no versions of pygls match >1.1.0,<1.1.1 || >1.1.1,<1.1.2 || >1.1.2,<1.2.0 || >1.2.0,<1.2.1 || >1.2.1,<1.3.0 || >1.3.0,<1.3.1 || >1.3.1
 and pygls (1.1.0) requires Python >=3.7.9,<4, pygls is forbidden.
And because pygls (1.1.1) requires Python >=3.7.9,<4, pygls is forbidden.
And because pygls (1.1.2) requires Python >=3.7.9,<4
 and pygls (1.2.0) requires Python >=3.7.9,<4, pygls is forbidden.
And because pygls (1.2.1) requires Python >=3.7.9,<4
 and pygls (1.3.0) requires Python >=3.8, pygls is forbidden.
So, because pygls (1.3.1) requires Python >=3.8
 and poetry-test depends on pygls (>=1.1.0), version solving failed.

  • Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties

    For pygls, a possible solution would be to set the `python` property to ">=3.7.9,<4"
    For pygls, a possible solution would be to set the `python` property to ">=3.7.9,<4"
    For pygls, a possible solution would be to set the `python` property to ">=3.7.9,<4"
    For pygls, a possible solution would be to set the `python` property to ">=3.7.9,<4"
    For pygls, a possible solution would be to set the `python` property to ">=3.7.9,<4"
    For pygls, a possible solution would be to set the `python` property to ">=3.8"
    For pygls, a possible solution would be to set the `python` property to ">=3.8"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a hint here that "requested Python version" refers to the version you declared in your pyproject.toml and that - unlike everything else - that version needs to stricter than the one in your dependencies.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do in a separate PR.

match self {
RequiresPython::Specifier(specifier) => requires_python.contains(specifier),
RequiresPython::Specifiers(specifiers) => {
let Ok(target) = specifiers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the missing try_from conversion method for that in #4010

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx.

----- stderr -----
warning: `uv lock` is experimental and may change without warning.
× No solution found when resolving dependencies:
╰─▶ Because the requested Python version (>=3.7) does not satisfy Python>=3.8 and the requested Python version (>=3.7) does not satisfy Python>=3.7.9,<3.8, we can conclude that Python>=3.7.9 are incompatible.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a hint here that "requested Python version" refers to the version you declared in your pyproject.toml and that - unlike everything else - that version needs to stricter than the one in your dependencies.

@charliermarsh charliermarsh enabled auto-merge (squash) June 4, 2024 13:45
@charliermarsh charliermarsh merged commit 6afb659 into main Jun 4, 2024
46 checks passed
@charliermarsh charliermarsh deleted the charlie/req-python branch June 4, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Universal lock should respect Requires-Python
2 participants