build: Rework editables for full PEP-660 support #237
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The previously used mechanism of synthezising a package using hatchling sort of works, and was enough to prove the concept of editables with Nix.
This changes
mkDerivationEditable
to use PEP-660 and should support pretty much everything.The big complication in this development was the need for source level patching since editables are a pretty loose concept and are implemented differently by different build systems. Source patching uses https://github.com/Instagram/LibCST/. I'd like to rewrite this bit purely in Rust later.
So far I've successfully used this support with a few build systems, most notably meson.
For meson this requires manually calling
build_editable.py
to create the initial files. After that point dynamic recompilation "just works". This will be exposed as a separate package somehow, just not yet.