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

Fix trailing commas on Requires-Python in HTML indexes #1507

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions crates/uv-client/src/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use tl::HTMLTag;
use tracing::instrument;
use url::Url;

use pep440_rs::VersionSpecifiers;
use pypi_types::LenientVersionSpecifiers;
use pypi_types::{BaseUrl, DistInfoMetadata, File, Hashes, Yanked};

Expand Down Expand Up @@ -137,7 +138,7 @@ impl SimpleHtml {
{
let requires_python = std::str::from_utf8(requires_python.as_bytes())?;
let requires_python = html_escape::decode_html_entities(requires_python);
Some(LenientVersionSpecifiers::from_str(&requires_python).map(Into::into))
Some(LenientVersionSpecifiers::from_str(&requires_python).map(VersionSpecifiers::from))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

how come from is preferable? (to help me learn)

} else {
None
};
Expand Down Expand Up @@ -713,8 +714,6 @@ mod tests {
"###);
}

/// Test trailing comma in requires-python
/// From https://github.com/astral-sh/uv/pull/1507
#[test]
fn parse_file_requires_python_trailing_comma() {
let text = r#"
Expand Down