Skip to content

Comments

Build backend: Build editable #9230

Merged
konstin merged 6 commits intomainfrom
konsti/build-backend-editables
Nov 19, 2024
Merged

Build backend: Build editable #9230
konstin merged 6 commits intomainfrom
konsti/build-backend-editables

Conversation

@konstin
Copy link
Member

@konstin konstin commented Nov 19, 2024

Support for editable installs. This is a simple PEP 660 implementation.

These hooks are implemented in Python to always return `[]` without calling into rust, we're leaving the hooks in rust for symmetry with the specs (PEP 517 and PEP 660).
In uv's case, `prepare_metadata_for_build_editable` is the same as `prepare_metadata_for_build_wheel`
@konstin konstin added the preview Experimental behavior label Nov 19, 2024
@konstin konstin requested a review from BurntSushi November 19, 2024 15:46
@konstin konstin force-pushed the konsti/build-backend-editables branch from 1f31a91 to 6e7c8ec Compare November 19, 2024 15:47
@konstin
Copy link
Member Author

konstin commented Nov 19, 2024

I'm stripping the pytest run:

image

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.

Some minor comments/nits, but LGTM!

metadata_directory,
uv_version::version(),
)?;
println!("{filename}");
Copy link
Member

Choose a reason for hiding this comment

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

println! has an unavoidable panic when writing to stdout fails. I would suggest writeln!(&mut std::io::stdout(), "{filename}")? here instead.

Copy link
Member

Choose a reason for hiding this comment

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

Is it definitely intended for this function to just write to stdout? If so, I might put that in the docs for the function. It's hard to articulate why, but it does seem somewhat surprising. I think part of it is that I don't quite understand why filename is being written to stdout. Is that just part of PEP 660? (I'm not familiar with it.)

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 the way in PEP 517 and PEP 660 how the build backend tells the frontend where to find the build artifact: It's in <wheel_directory>/<last line of stdout>.

I'm adding references to the spec name in the doc comment, otherwise I'm assuming familiarity with the spec (sorry - i don't expect you to read them and will of course answer questions for you). I tried to copy all relevant excerpts from the spec in earlier PEP implementations I did, but didn't found it to be effective.

metadata_directory,
uv_version::version(),
)?;
println!("{filename}");
Copy link
Member

Choose a reason for hiding this comment

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

Same comment here as above.

@konstin konstin enabled auto-merge (squash) November 19, 2024 21:41
@konstin konstin merged commit 8e0389e into main Nov 19, 2024
@konstin konstin deleted the konsti/build-backend-editables branch November 19, 2024 21:52
@konstin konstin mentioned this pull request Nov 20, 2024
32 tasks
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