Using custom importers
For a more robust and more dynamic collaboration between the build backend and the target interpreter, we can take advantage of the import system allowing the registration of custom importers. See PEP-302 for more details and editables as an example of this. The backend can generate a new importer during the editable build (or install it as an additional dependency) and register it at interpreter startup by adding a pth file.
{
"metadata_for_build_editable": "<dir to dist-info>",
"purelib": {
"<project dir>/.editable/_register_importer.pth": "<project dir>/_register_importer.pth".
"<project dir>/.editable/_editable_importer.py": "<project dir>/_editable_importer.py"
}
}
Having users generate source controlled files, especially in the case of editables, seems extremely sub-optimal (I would never). Can you add a way to inject raw content mapped to target paths? Or, Proposal: Adding a persistent cache directory to PEP 517 hooks - #61 by bernatgabor