Re: [Python-Dev] Overriding stdlib http package

2015-01-26 Thread Demian Brecht
On 2015-01-24 7:17 AM, Donald Stufft wrote: It’s not just power users that it’s good for, it makes it harder for even beginners to use things like backports of modules. What about cases where new module versions are put in as dependencies of other packages and they stomp standard library

Re: [Python-Dev] Overriding stdlib http package

2015-01-24 Thread Donald Stufft
On Jan 24, 2015, at 2:57 AM, Nick Coghlan ncogh...@gmail.com wrote: On 15 January 2015 at 07:35, Donald Stufft don...@stufft.io wrote: On Jan 14, 2015, at 4:19 PM, Brett Cannon br...@python.org wrote: But as Guido pointed out, we _like_ it being difficult to do because we don't want

Re: [Python-Dev] Overriding stdlib http package

2015-01-24 Thread Donald Stufft
On Jan 24, 2015, at 10:17 AM, Donald Stufft don...@stufft.io wrote: Or you have things like pdb++ which needs to replace the pdb import because a lot of tools only have a flag like —pdb and do not provide a way to switch it to a different import. The sys.path ordering means that pdb++ has

Re: [Python-Dev] Overriding stdlib http package

2015-01-23 Thread Nick Coghlan
On 15 January 2015 at 07:35, Donald Stufft don...@stufft.io wrote: On Jan 14, 2015, at 4:19 PM, Brett Cannon br...@python.org wrote: But as Guido pointed out, we _like_ it being difficult to do because we don't want this kind of substitution happening as code ends up depending on bugs and

Re: [Python-Dev] Overriding stdlib http package

2015-01-15 Thread Brett Cannon
On Wed Jan 14 2015 at 4:58:20 PM Demian Brecht demianbre...@gmail.com wrote: On 2015-01-14 1:19 PM, Brett Cannon wrote: But as Guido pointed out, we _like_ it being difficult to do because we don't want this kind of substitution happening as code ends up depending on bugs and quirks that

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Brett Cannon
On Wed Jan 14 2015 at 4:08:52 PM Demian Brecht demianbre...@gmail.com wrote: On 2015-01-14 12:25 PM, Guido van Rossum wrote: I'm not sure how commit privileges would help you -- can't you just fork the CPython (I'm sure there's already a Bitbucket mirror that you can fork easily) and do

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Donald Stufft
On Jan 14, 2015, at 4:19 PM, Brett Cannon br...@python.org wrote: But as Guido pointed out, we _like_ it being difficult to do because we don't want this kind of substitution happening as code ends up depending on bugs and quirks that you may fix. Not all of us, I hate the default order

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Ionel Cristian Mărieș
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,

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Guido van Rossum
Why do you want to hack the existing http modules? This is not a rhetorical question. The answer may lead us to redesign the existing http modules to be more flexible so that the higher-level problem you are trying to solve by hacking http import can be solved instead by using an interface

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Guido van Rossum
Aha. Glad I asked. You would arguably get a more useful response if you asked on core-mentorship and explained some of that background (for those of us who rely on external memory :-). The stdlib intentionally makes what you are trying to do hard (so library writers don't have to worry about

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Demian Brecht
On 2015-01-14 11:35 AM, Guido van Rossum wrote: Why do you want to hack the existing http modules? This is not a rhetorical question. The answer may lead us to redesign the existing http modules to be more flexible so that the higher-level problem you are trying to solve by hacking http

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Demian Brecht
On 2015-01-14 12:25 PM, Guido van Rossum wrote: I'm not sure how commit privileges would help you -- can't you just fork the CPython (I'm sure there's already a Bitbucket mirror that you can fork easily) and do your work there? Even with commit privileges you wouldn't be committing partial

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Demian Brecht
On 2015-01-14 1:19 PM, Brett Cannon wrote: But as Guido pointed out, we _like_ it being difficult to do because we don't want this kind of substitution happening as code ends up depending on bugs and quirks that you may fix. I can understand the reasoning. How many other modules are

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Demian Brecht
Apologies for the double send, apparently Thunderbird got confused when going through a 4G dead zone. I should mention that I'm aware that any module that previously imported the stdlib version would retain that version rather than a reference to the new one, but I'm okay with that as this is a

[Python-Dev] Overriding stdlib http package

2015-01-14 Thread Demian Brecht
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:

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Ian Cordasco
I think this belongs on python-list, not python-dev. On Wed, Jan 14, 2015 at 10:32 AM, Demian Brecht demianbre...@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

[Python-Dev] Overriding stdlib http package

2015-01-14 Thread Demian Brecht
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:

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/14/2015 11:54 AM, Antoine Pitrou wrote: On Wed, 14 Jan 2015 08:32:23 -0800 Demian Brecht demianbre...@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

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Demian Brecht
I had considered that but thought that dev might be more appropriate as it's related to overriding a stdlib module in order to work on that module out of band with cpython (with the intention of merging back upstream). I would imagine those on the dev list may be better suited to answer. On Wed,

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Antoine Pitrou
On Wed, 14 Jan 2015 08:32:23 -0800 Demian Brecht demianbre...@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

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Antoine Pitrou
On Wed, 14 Jan 2015 12:04:22 -0500 Tres Seaver tsea...@palladion.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/14/2015 11:54 AM, Antoine Pitrou wrote: On Wed, 14 Jan 2015 08:32:23 -0800 Demian Brecht demianbre...@gmail.com wrote: Hi all, As part of the work I'm

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Demian Brecht
Hm, I /did/ try that but ran into issues. Swapping the custom finder for the monkey patch now seems to work as expected though. Could be that I was doing something else at the time that caused it not to work. I'll keep running with that and will ping the thread if the issues surface again.