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

Make Directory its own distribution kind #3519

Merged
merged 1 commit into from
May 13, 2024
Merged

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented May 10, 2024

Summary

I think this is overall good change because it explicitly encodes (in the type system) something that was previously implicit. I'm not a huge fan of the names here, open to input.

It covers some of #3506 but I don't think it closes it.

@charliermarsh charliermarsh added the internal A refactor or improvement that is not user-facing label May 10, 2024
@@ -71,6 +72,7 @@ impl<'a> SourceUrl<'a> {
Self::Direct(dist) => dist.url,
Self::Git(dist) => dist.url,
Self::Path(dist) => dist.url,
Self::Directory(dist) => dist.url,
Copy link
Member Author

Choose a reason for hiding this comment

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

I kind of wish the names were like... Directory and Archive? But Archive is a bit strange.

Copy link
Member

Choose a reason for hiding this comment

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

I like Archive, pip uses that terminology too

Copy link
Member

Choose a reason for hiding this comment

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

Is Archive in this context referring to a specific file like a .tar.gz? If that's always the case, then I like the name Archive.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah it needs to be a .tar.gz or .zip or .tar.bz2 or a few other extensions that we support.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know that it's a perfect name because (e.g.) when you provide Direct (i.e., a direct URL), that has to be a direct URL to... an archive. So they're both archives?

Copy link
Member Author

Choose a reason for hiding this comment

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

Honestly Self::File could be the right name.

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's a good point. I suppose PathArchive would also work and is maybe a bit more descriptive. But I agree that File also works. And it's more succinct.

BuildableSource::Dist(SourceDist::Path(dist)) => {
if dist.path.is_dir() {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is good IMO, we removed this branch in favor of types that encode the difference.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah. I like.

@charliermarsh charliermarsh requested a review from ibraheemdev May 10, 2024 21:22
@charliermarsh charliermarsh marked this pull request as draft May 11, 2024 17:20
@charliermarsh
Copy link
Member Author

Need to fix test failures.

@charliermarsh charliermarsh force-pushed the charlie/source-tree branch 3 times, most recently from f20d3b5 to 1f1e274 Compare May 11, 2024 17:33
@charliermarsh charliermarsh marked this pull request as ready for review May 11, 2024 17:33
@charliermarsh charliermarsh marked this pull request as draft May 11, 2024 17:40
@charliermarsh charliermarsh force-pushed the charlie/source-tree branch 4 times, most recently from f418142 to c940843 Compare May 11, 2024 20:55
@charliermarsh charliermarsh force-pushed the charlie/source-tree branch from c940843 to b61b014 Compare May 11, 2024 21:05
@charliermarsh charliermarsh marked this pull request as ready for review May 11, 2024 21:10
@charliermarsh
Copy link
Member Author

Ok, tests passing...

.as_ref()
.join("pyproject.toml")
.metadata()
.ok()
Copy link
Member

Choose a reason for hiding this comment

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

Should we raise those if they aren't file not found errors?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I'll do it separately though since this is just a move from above.

@charliermarsh charliermarsh merged commit 42c3bfa into main May 13, 2024
43 checks passed
@charliermarsh charliermarsh deleted the charlie/source-tree branch May 13, 2024 14:03
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.

This LGTM. Contrary to what I said in the DM, in context, I think Archive is a good name if it always refers to a single archive-like file (i.e., .tar.gz).

@@ -71,6 +72,7 @@ impl<'a> SourceUrl<'a> {
Self::Direct(dist) => dist.url,
Self::Git(dist) => dist.url,
Self::Path(dist) => dist.url,
Self::Directory(dist) => dist.url,
Copy link
Member

Choose a reason for hiding this comment

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

Is Archive in this context referring to a specific file like a .tar.gz? If that's always the case, then I like the name Archive.

BuildableSource::Dist(SourceDist::Path(dist)) => {
if dist.path.is_dir() {
Copy link
Member

Choose a reason for hiding this comment

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

Yeah. I like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal A refactor or improvement that is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants