Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.

Save Sdist to disk and use PKG-INFO metadata - #71

Merged
wolfv merged 6 commits into
prefix-dev:mainfrom
tdejager:feat/save-sdists
Nov 9, 2023
Merged

wolfv merged 6 commits into
prefix-dev:mainfrom
tdejager:feat/save-sdists

Conversation

@tdejager

@tdejager tdejager commented Nov 7, 2023

Copy link
Copy Markdown
Contributor

Making some progress on: #32

Should now save sdists when running the resolution step.

E.g

cargo r sdist
cargo r numpy==1.7.0

This uses the PKG-INFO metadata https://peps.python.org/pep-0643/ to resolve the metadata for the source distribution. Any PEP517 conformant build back-end should make this. So these are a lot.

The cargo r apache-airflow[all] seems to use the sdist resolution as well, although it fails on a package that does not meet my python interpreter requirement, will look into this later if this is the case.

Next up, sdist building, stay tuned!

@wolfv

wolfv commented Nov 7, 2023

Copy link
Copy Markdown
Member

Nice! Just a little issue with the conflict.

@tdejager
tdejager requested review from baszalmstra and wolfv November 8, 2023 12:12
Comment thread crates/index/src/main.rs
// Continue if there was an error in downloading and skip for now :)
let metadata = if let Some(metadata) = metadata {
metadata.1
metadata.unwrap().1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tbh reading this is a bit confusing :D Is there a way to make this a bit more clear?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And maybe if this is a safe unwrap, you could add a little comment? I think Bas would ask for an expect either way :D

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah so I'm a bit unsure about this index program file as it's kinda half-baked, would rather pull it out of this project entirely and make it kinda nice. Do you still want met to change it?

if artifacts.is_empty() {
// If there are no wheel artifacts, we're just gonna skip it
return Err("there are no wheels available");
return Err("there are no artifacts available");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should talk about packages instead? Not sure the average person understands what we mean with an artifact.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure!

@wolfv
wolfv merged commit ed8e574 into prefix-dev:main Nov 9, 2023
@tdejager tdejager mentioned this pull request Nov 13, 2023
3 of 4 tasks
let mut bytes = Vec::new();
entry.read_to_end(&mut bytes).into_diagnostic()?;
let metadata = Self::parse_metadata(&bytes)?;
return Ok((bytes, metadata));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This should only use this metadata from the PKG-INFO file if the metadata version is 2.2 or greater. Using on older versions means that you'd rely on the metadata not required to be reliable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants