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

Add local path conversions from lockfile #3609

Merged
merged 1 commit into from
May 15, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

Just does the most basic thing to convert from Distribution back to the installable type.

@charliermarsh charliermarsh added the preview Experimental behavior label May 15, 2024
@charliermarsh charliermarsh marked this pull request as ready for review May 15, 2024 16:28
let path_dist = PathSourceDist {
name: self.id.name.clone(),
url: VerbatimUrl::from_url(self.id.source.url.clone()),
path: self.id.source.url.to_file_path().unwrap(),
Copy link
Member Author

Choose a reason for hiding this comment

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

It's a bit strange that we require both url and path, but I think the intent is that we do this fallible conversion when constructing to the type so that we don't have to do it everywhere that we need the path.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah that makes sense I think.

(I am fond of the idea of encapsulating the distribution types and defining constructors for them. That way, you can add derived fields or whatever else without much fuss. But that's a big refactor and I am not altogether offended by pure data structs. They have their advantages...)

Copy link
Member

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

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

LGTM.

Probably after resolver forking is done, I'll plan to take another pass at the lock file format and smooth things out. Hopefully we can limp along as-is for now though.

let path_dist = PathSourceDist {
name: self.id.name.clone(),
url: VerbatimUrl::from_url(self.id.source.url.clone()),
path: self.id.source.url.to_file_path().unwrap(),
Copy link
Member

Choose a reason for hiding this comment

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

Yeah that makes sense I think.

(I am fond of the idea of encapsulating the distribution types and defining constructors for them. That way, you can add derived fields or whatever else without much fuss. But that's a big refactor and I am not altogether offended by pure data structs. They have their advantages...)

@charliermarsh charliermarsh merged commit d0c6b0a into main May 15, 2024
44 checks passed
@charliermarsh charliermarsh deleted the charlie/dir-lock branch May 15, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants