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

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

Merged
merged 6 commits into from
Nov 9, 2023

Conversation

tdejager
Copy link
Contributor

@tdejager tdejager commented Nov 7, 2023

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
Copy link
Member

wolfv commented Nov 7, 2023

Nice! Just a little issue with the conflict.

@@ -107,7 +107,7 @@ pub async fn index(index_url: Url) -> Result<(), miette::Error> {

// 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
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
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
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
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
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
5 checks passed
@tdejager tdejager mentioned this pull request Nov 13, 2023
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));

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants