On Tue, Dec 8, 2020 at 11:05 PM Paul Sokolovsky email@example.com wrote:
It'd be best to just write what you want directly, using the tools in importlib.
Of course, the implementation of the above for CPython would be based on importlib. And other implementations could implement that "directly", for the background idea of it being how to implement import hooks as frugally as possible, and easily allow to do most of what could be wanted of single-file import hooking.
Have you tried to just write this as-is? Python already offers a number of tools. Try writing it using the existing tools and see if this even needs to be a proposal.