You could do the sys.modules patch as Antoine suggested in a .pth file, so that it's triggered at startup.
Eg, very similar: https://github.com/xando/subprocess.run/blob/ab02d165802b2ad57dd0d16c1169ab05ed312ef1/subprocess.run.pth


Thanks,
-- Ionel
Cristian Mărieș, blog.ionelmc.ro

On Wed, Jan 14, 2015 at 6:32 PM, Demian Brecht <demianbrecht@gmail.com> wrote:
Hi all,

As part of the work I'm doing on httplib3 (now that I've actually gotten
a bit of time), one of the things I'm trying to get done is injection of
httplib3 over http in order to not have to modify all import paths in
modules and such. Here's the gist of what I have so far:
https://gist.github.com/demianbrecht/bc6530a40718e4fcbf90.

It's greatly simplified over importlib2's inject mechanism, but I'm
assuming that's largely due to requirements of that package (i.e. Python
2) in contrast to this one.

My questions are: Does this look sane? Is there anything that I might be
not accounting for? It /does/ seem to work as expected when running
tests, but I'm curious if there's anything that I might be missing that
might jump out at someone more intimately familiar with the mechanics of
importlib.

Thanks,
Demian


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/contact%40ionelmc.ro