-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Discard markers on editable requirements (#3622)
## 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.
- Loading branch information
1 parent
3b8e8de
commit 7f73f7b
Showing
5 changed files
with
431 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 0 additions & 79 deletions
79
crates/requirements-txt/src/snapshots/requirements_txt__test__line-endings-editable.txt.snap
This file was deleted.
Oops, something went wrong.
194 changes: 194 additions & 0 deletions
194
crates/requirements-txt/src/snapshots/requirements_txt__test__parse-unix-editable.txt.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
--- | ||
source: crates/requirements-txt/src/lib.rs | ||
expression: actual | ||
--- | ||
RequirementsTxt { | ||
requirements: [], | ||
constraints: [], | ||
editables: [ | ||
EditableRequirement { | ||
url: VerbatimUrl { | ||
url: Url { | ||
scheme: "file", | ||
cannot_be_a_base: false, | ||
username: "", | ||
password: None, | ||
host: None, | ||
port: None, | ||
path: "<REQUIREMENTS_DIR>/editable", | ||
query: None, | ||
fragment: None, | ||
}, | ||
given: Some( | ||
"./editable", | ||
), | ||
}, | ||
extras: [ | ||
ExtraName( | ||
"d", | ||
), | ||
ExtraName( | ||
"dev", | ||
), | ||
], | ||
path: "<REQUIREMENTS_DIR>/editable", | ||
origin: Some( | ||
File( | ||
"<REQUIREMENTS_DIR>/editable.txt", | ||
), | ||
), | ||
}, | ||
EditableRequirement { | ||
url: VerbatimUrl { | ||
url: Url { | ||
scheme: "file", | ||
cannot_be_a_base: false, | ||
username: "", | ||
password: None, | ||
host: None, | ||
port: None, | ||
path: "<REQUIREMENTS_DIR>/editable", | ||
query: None, | ||
fragment: None, | ||
}, | ||
given: Some( | ||
"./editable", | ||
), | ||
}, | ||
extras: [ | ||
ExtraName( | ||
"d", | ||
), | ||
ExtraName( | ||
"dev", | ||
), | ||
], | ||
path: "<REQUIREMENTS_DIR>/editable", | ||
origin: Some( | ||
File( | ||
"<REQUIREMENTS_DIR>/editable.txt", | ||
), | ||
), | ||
}, | ||
EditableRequirement { | ||
url: VerbatimUrl { | ||
url: Url { | ||
scheme: "file", | ||
cannot_be_a_base: false, | ||
username: "", | ||
password: None, | ||
host: None, | ||
port: None, | ||
path: "<REQUIREMENTS_DIR>/editable", | ||
query: None, | ||
fragment: None, | ||
}, | ||
given: Some( | ||
"./editable", | ||
), | ||
}, | ||
extras: [ | ||
ExtraName( | ||
"d", | ||
), | ||
ExtraName( | ||
"dev", | ||
), | ||
], | ||
path: "<REQUIREMENTS_DIR>/editable", | ||
origin: Some( | ||
File( | ||
"<REQUIREMENTS_DIR>/editable.txt", | ||
), | ||
), | ||
}, | ||
EditableRequirement { | ||
url: VerbatimUrl { | ||
url: Url { | ||
scheme: "file", | ||
cannot_be_a_base: false, | ||
username: "", | ||
password: None, | ||
host: None, | ||
port: None, | ||
path: "<REQUIREMENTS_DIR>/editable", | ||
query: None, | ||
fragment: None, | ||
}, | ||
given: Some( | ||
"./editable", | ||
), | ||
}, | ||
extras: [ | ||
ExtraName( | ||
"d", | ||
), | ||
ExtraName( | ||
"dev", | ||
), | ||
], | ||
path: "<REQUIREMENTS_DIR>/editable", | ||
origin: Some( | ||
File( | ||
"<REQUIREMENTS_DIR>/editable.txt", | ||
), | ||
), | ||
}, | ||
EditableRequirement { | ||
url: VerbatimUrl { | ||
url: Url { | ||
scheme: "file", | ||
cannot_be_a_base: false, | ||
username: "", | ||
password: None, | ||
host: None, | ||
port: None, | ||
path: "<REQUIREMENTS_DIR>/editable", | ||
query: None, | ||
fragment: None, | ||
}, | ||
given: Some( | ||
"./editable", | ||
), | ||
}, | ||
extras: [], | ||
path: "<REQUIREMENTS_DIR>/editable", | ||
origin: Some( | ||
File( | ||
"<REQUIREMENTS_DIR>/editable.txt", | ||
), | ||
), | ||
}, | ||
EditableRequirement { | ||
url: VerbatimUrl { | ||
url: Url { | ||
scheme: "file", | ||
cannot_be_a_base: false, | ||
username: "", | ||
password: None, | ||
host: None, | ||
port: None, | ||
path: "<REQUIREMENTS_DIR>/editable;", | ||
query: None, | ||
fragment: None, | ||
}, | ||
given: Some( | ||
"./editable;", | ||
), | ||
}, | ||
extras: [], | ||
path: "<REQUIREMENTS_DIR>/editable;", | ||
origin: Some( | ||
File( | ||
"<REQUIREMENTS_DIR>/editable.txt", | ||
), | ||
), | ||
}, | ||
], | ||
index_url: None, | ||
extra_index_urls: [], | ||
find_links: [], | ||
no_index: false, | ||
no_binary: None, | ||
only_binary: None, | ||
} |
Oops, something went wrong.