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

Discard markers on editable requirements #3622

Merged
merged 2 commits into from
May 16, 2024
Merged

Discard markers on editable requirements #3622

merged 2 commits into from
May 16, 2024

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented May 15, 2024

Summary

If a user includes markers after an editable, we now ignore them (rather than including them in the parsed URL). This matches pip's behavior. In the future, we could further improve by respecting them, but that would be a deviation from pip.

For example, given:

-e ./scripts/packages/black_editable ; python_version >= "3.9" and python_ver

We now split at the first whitespace (just before the ;), parse everything before, and throw out everything after.

This logic also extends to extras. So given:

-e ./scripts/packages/black_editable[dev, colorama]

We'll now parse this as the URL ./scripts/packages/black_editable[dev,, and throw out colorama]. Instead, you need to do:

-e ./scripts/packages/black_editable[dev,colorama]

(I.e., remove the space.)

This also matches pip's behavior. I could "fix" this but I'm unsure if I should -- it means requirements files will be parseable by uv that won't work with pip. Open to input. My gut reaction is that we should properly support -e ./scripts/packages/black_editable[dev, colorama] even if pip would reject it, but requirements.txt is implementation-defined so it'd be a "deviation".

Closes #3604.

@charliermarsh charliermarsh requested review from zanieb and konstin May 15, 2024 19:48
@charliermarsh charliermarsh added the compatibility Compatibility with a specification or another tool label May 15, 2024
@charliermarsh charliermarsh marked this pull request as ready for review May 15, 2024 19:49
@charliermarsh charliermarsh added the bug Something isn't working label May 15, 2024
Copy link
Member

Choose a reason for hiding this comment

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

This file contained some regression tests for whitespace behavior in the parser

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’m pretty sure those exist in a separate file. This was just a duplicate of another test file, no?

@konstin
Copy link
Member

konstin commented May 16, 2024

To me, pypa/pip#8581 (comment) makes it look like this is a bug in pip, could we check back with the pip devs on this?

@charliermarsh
Copy link
Member Author

I don’t think it’s a bug. I think it’s an intentional limitation right now because it’s not covered by any standard. For that reason I’m also somewhat hesitant to support it… It also means that files that work with uv won’t work with pip.

@charliermarsh
Copy link
Member Author

Ok, I decided to change the behavior to continue to allow spaces between extras in editables (i.e., we continue to support -e /editable[d, dev]).

@charliermarsh charliermarsh force-pushed the charlie/extras branch 2 times, most recently from d52d5d9 to 7ef21a9 Compare May 16, 2024 20:10
@charliermarsh charliermarsh enabled auto-merge (squash) May 16, 2024 20:10
@charliermarsh charliermarsh force-pushed the charlie/extras branch 2 times, most recently from cd8f63b to a937154 Compare May 16, 2024 20:38
@charliermarsh charliermarsh merged commit 7f73f7b into main May 16, 2024
44 checks passed
@charliermarsh charliermarsh deleted the charlie/extras branch May 16, 2024 20:53
charliermarsh added a commit that referenced this pull request May 16, 2024
## Summary

As a follow-up to #3622, we now parse and store (but don't respect)
markers on editable requirements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compatibility Compatibility with a specification or another tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

installation of editable package don't work when adding python markers
2 participants