Open
Description
It would be nice to be able to delay loading the libraries until they're needed. We can do this by pretending a path hook using a custom ExtensionFileLoader
to sys.path_hooks
. Our custom loader would load the library before executing the module in exec_module
.
Since we don't know which extension links against the library from the entrypoints metadata, we need to load it on all extension imports. Alternatively, we can try to load the extension, and if it fails, load the library and try again. Other option could also be to read the ELF objects to see if they link against the library.
Anyway, even though this is the best default behavior, we should have an environment variable to force loading everything at startup, for quick troubleshooting.