Skip to content

Add a hint for Requires-Python #4021

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

Merged
merged 1 commit into from
Jun 4, 2024
Merged

Add a hint for Requires-Python #4021

merged 1 commit into from
Jun 4, 2024

Conversation

charliermarsh
Copy link
Member

Summary

As requested in the originating PR.

@charliermarsh charliermarsh added the error messages Messaging when something goes wrong label Jun 4, 2024
@charliermarsh charliermarsh marked this pull request as ready for review June 4, 2024 20:20
@@ -1004,6 +1004,8 @@ fn lock_requires_python() -> Result<()> {
cannot be used, we can conclude that pygls>=1.1.0 cannot be used.
And because project==0.1.0 depends on pygls>=1.1.0, we can conclude that project==0.1.0 cannot be used.
And because only project==0.1.0 is available and project depends on project, we can conclude that the requirements are unsatisfiable.

hint: The `Requires-Python` requirement (>=3.7) defined in your `pyproject.toml` must be narrower than the `Requires-Python` of the resolved dependencies, but pygls>=1.1.0,<=1.2.1 only supports: >=3.7.9, <4
Copy link
Member

Choose a reason for hiding this comment

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

This reads a little confusing to me, what does this mean? I must use requires-python >=3.7.9? Do I need the upper bound too? Perhaps "narrower" isn't intuitive enough for a user-facing message.

Copy link
Member Author

Choose a reason for hiding this comment

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

The simplest explanation is: >=3.7 includes versions that aren't included in >=3.7.9, <4. You have to use a narrower range, or change the pygls version. What do you suggest?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah that makes sense. I wonder if you should just say something more like that...

The Requires-Python (>=3.7) defined in your pyproject.toml includes Python versions that are not supported by the resolved dependencies: pygls>=1.1.0,<=1.2.1 only supports Python >=3.7.9, <4. Use a narrower Requires-Python range or try a different pygls version.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I don't have any ideas I love here. I was earnestly confused by the current message and imagine users that don't understand constraint ranges will be very lost.

Copy link
Member Author

Choose a reason for hiding this comment

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

Totally fair. I will play with it.

Copy link
Member Author

Choose a reason for hiding this comment

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

It will only be displayed once (the fields are ignored when testing uniqueness).

Copy link
Member Author

Choose a reason for hiding this comment

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

Separately... I worry about the upper bound, i.e. Poetry bounds to < 4 by default — does that mean if you have a single package published with Poetry in your dependency tree that you are forced to have this upper bound in your project?

Yeah, basically. I don't think there's anything we can do about this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess we could special-case things a bit, like... if you have an open-ended Requires-Python requirement, treat it as compatible with < 4. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or, alternatively, throw out any < 4 on Requires-Python.

Copy link
Member Author

Choose a reason for hiding this comment

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

Tracking here: #4022

@charliermarsh charliermarsh merged commit 57ea55d into main Jun 4, 2024
46 checks passed
@charliermarsh charliermarsh deleted the charlie/req-python branch June 4, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Messaging when something goes wrong
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants