Yup that discussion definitely got me rethinking a lot. Cargo’s custom build script seems to work pretty well and can be used as an inspiration. The script (analogous to our PEP 517 backend) is one Rust program that emits information to tell Cargo (PEP 517 frontend), including:
- When should a rebuild be triggered
- What the build script’s result contributes to the build environment (not sure what the analogy would be for Python)
- How the frontend should do with the result (extra linker flags; the analogy would be what files the frontend should copy)