[Python-Dev] PEP 594: Removing dead batteries from the standard library
On 22/05/2019 01.11, Glenn Linderman wrote:
> On 5/21/2019 2:00 PM, Nathaniel Smith wrote:
>> On Tue, May 21, 2019 at 10:43 AM Glenn Linderman <v+python at g.nevcal.com> wrote:
>>> After maintaining my own version of http.server to fix or workaround some of its deficiencies for some years, I discovered bottle.py. It has far more capability, is far better documented, and is just as quick to deploy. While I haven't yet converted all past projects to use bottle.py, it will likely happen in time, unless something even simpler to use is discovered, although I can hardly imagine that happening.
>> bottle.py uses http.server for its local development mode (the one you
>> see in their quickstart example at the top of their README). Same with
>> flask, django, and probably a bunch of other frameworks. It's *very*
>> widely used.
> The source for bottle.py version 0.13-dev has an import for http.client, but not http.server. I hadn't tracked down every indirect dependency in the bottle.py source code, but it seems that if one uses the "default server" for bottle, that it is "wsgiref", imported from wsgiref.simple_server, and that in turn does import BaseHTTPRequestHandler and HTTPServer from http.server.
> It is the higher-level code in http.server that has significant deficiencies that have caused me problems over the years... a "SimpleHTTPRequestHandler" that is so simple it doesn't do POST, PUT or PASTE, a "CGIHTTPRequestHandler" that only implements part of the CGI protocol, only CGI support in POST, no support for PUT or PASTE, and no support for https, and not much bug fix activity in those areas.
> Maybe http.server should be split into the "basic parts" (used by bottle.py, and other frameworks), and the "higher-level parts", which could then be discarded by this PEP! At this point, though, I'd have to agree that the whole should not be discarded. Thanks for making me dig deeper.
The idea has merrit. However I feel its out of scope for the PEP. The http.server module and socketserver module are still widely used for debug and toy examples.
Could you please open a bug to track your proposal? We may pursue it in a couple of years from now.