Message archived at https://mail.python.org/archives/list/pytho...@python.org/message/E6GN2THYCNQ2Q3CGMSH7GRCDFOOFDDCQ/
On 2/6/2022 4:44 PM, Christian Heimes wrote:
> If I had the power and time, then I would replace urllib with a simpler,
> reduced HTTP client that uses platform's HTTP library under the hood
> (WinHTTP on Windows, NSURLSession (?) on macOS, Web API for Emscripten,
> maybe curl on Linux/BSD). For non-trivial HTTP requests, httpx or
> aiohttp are much better suited than urllib.
I'm +1 on this, though I think it would have to be in place before the
"two releases until removal" kicked in for urllib.request.
The stdlib can't get by without at least the basic functionality of curl
built in natively. But we can do this on most platforms without
vendoring OpenSSL, which is a HUGE win. Then our default behaviour could
correctly use proxies (including auto-config), CA certificate bundles,
integrated authentication, and other OS features that are currently
ignored by our core.
Chances are we could keep simple urlopen() calls in place, and use the
deprecation as a "potential change of behaviour" without necessarily
having to break the API. I'm yet to come across a case where making a
trivial urlopen() call _better_ would break things (the cases I've seen
that would break are things like "using an OpenSSL environment variable
to configure something that I wish had been automatic").
The nature of network/internet access is that we have to break things
periodically anyway, because all the code that was written over the last
30+ years is eventually going to be found to be exploitable. I'd be
quite happy to say "Python gives you what your OS gives you; update the
OS for fixes".
FWIW: I find this discussion a bit strange. Python's stdlib is
supposed to provide basic tooling for a breadth of use cases,
with emphasis on "basic" and "breadth".
urllib is such a basic library and covers one of the main
use cases for Python we have.
There are problems with urllib. With hindsight, it would have been nice to do a few things differently. But that doesn't make migrating away from it any easier.
This thread has mentioned several "better" alternatives -- but with the exception of 3rd party Requests, the docs don't even mention them.
Saying "You can do better, but we won't tell you how" is pretty rude to beginners, and we should not do it.
Delegating to the operating system may be sensible for a production system, and there is nothing wrong with saying so in the docs, and it would be great if we made that easy. But it is absolutely not a reasonable replacement for a straightforward (possibly inefficient and non-scalable) implementation written in python that people can read and use for reference. urllib shouldn't be deprecated until we have a better solution to *that* use case that is also in the stdlib. (That might well be worth doing, but it should happen before the deprecation.)
> > 3. Overall, I think the days where "battery included" was a positive argument are over
>
> I strongly disagree. Being able to download something and immediately get something to work and see results is hugely
> rewarding; on the other hand, having to research, find, compare & contrast available third-party modules (especially for
> new-comers) can be extremely discouraging.
[apologies for the late post, just found this in my drafts folder]
On 2/7/22 12:49 AM, Stéfane Fermigier wrote:
> 3. Overall, I think the days where "battery included" was a positive argument are over
I strongly disagree. Being able to download something and immediately get something to work and see results is hugely
rewarding; on the other hand, having to research, find, compare & contrast available third-party modules (especially for
new-comers) can be extremely discouraging.
On Sun, Mar 27, 2022 at 3:08 AM Paul Moore p.f....@gmail.com wrote:
exactly - let's say someone needs to write some JSON for the first time.
With the json package included, all they need to do is `import json`. If that wasn't there, they's look in PyPi for a JSON implementation, and find an absolutely astonishing number of options. I just did a search for "JSON" on PYPI, and it's HUGE -- most of them are for specialized JSON-using protocols of some sort. I was actually really surprised that couple I know about of the top of my head (ujson, orjson) are actually hard to find.
"You can just pip install it" is really not a good solution.
In fact, this is an example, I think, of where we should put some effort into making the included batteries better -- it's great to have a JSON lib built in, but it's too bad that it's not best-of-bread by pretty much any definition (speed, memory performance, flexibility) -- there are quite a few feature requests open for it -- it would be nice to actually implement some of those. (but yes, that's a lot of work that someone(s) would have to do)
Back to the topic at hand, rather than remove urllib, maybe it could be made better -- an as-easy-to-use-as-requests package in the stdlib would be really great.
-CHB
> In fact, this is an example, I think, of where we should put some effort into making the included batteries better -- it's great to have a JSON lib built in, but it's too bad that it's not best-of-bread by pretty much any definition (speed, memory performance, flexibility) -- there are quite a few feature requests open for it -- it would be nice to actually implement some of those. (but yes, that's a lot of work that someone(s) would have to do)
>
> Back to the topic at hand, rather than remove urllib, maybe it could be made better -- an as-easy-to-use-as-requests package in the stdlib would be really great.
I think that's where the mistake happens, though. Someone who needs
"best of breed" is motivated (and likely knowledgeable enough) to make
informed decisions about what's on PyPI. But someone who just wants to
get the job done probably doesn't - and that's the audience for the
stdlib. A stdlib module needs to be a good, reliable set of basic
functionality that non-experts can use successfully. There can be
better libraries on PyPI, but that doesn't mean the stdlib module is
unnecessary, nor does it mean that the stdlib has to match the PyPI
library feature for feature.
So here, specifically, I'd rather see urlllib be the best urlllib it
can be, and not demand that it turn into requests. Requests is there
if people need/want it.
To be honest, I feel like I'm just reiterating stuff I've said before
here, and I think the same is true of the points I'm responding to
(I'm not *against* going over the debate again,
it helps make sure people haven't changed their minds, but it's
important to be clear that none of the practical facts have changed,
if that is the case).
On Mon, Mar 28, 2022 at 11:29 AM Paul Moore <p.f....@gmail.com> wrote:To be honest, I feel like I'm just reiterating stuff I've said before
here, and I think the same is true of the points I'm responding to...(I'm not *against* going over the debate again,
it helps make sure people haven't changed their minds, but it's
important to be clear that none of the practical facts have changed,
if that is the case).Maybe there's a way to make this discussion (it feels more like a discussion than debate at the moment) more productive by writing some things down. I'm not sure it's a PEP, but some kind of:"policy for the stdlib" document in which we could capture the primary points of view, places where there's consensus, etc. would be helpful to keep us retreading this over and over again.I suggest this without the bandwidth to actually shepherd the project, but if someone wants to, I think it would be a great idea.
-CHB--Christopher Barker, PhD (Chris)
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython
_______________________________________________
Python-Dev mailing list -- pytho...@python.org
To unsubscribe send an email to python-d...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
On Sun, 27 Mar 2022 at 17:11, Christopher Barker <pyth...@gmail.com> wrote:
> Back to the topic at hand, rather than remove urllib, maybe it could be made better -- an as-easy-to-use-as-requests package in the stdlib would be really great.
I think that's where the mistake happens, though. Someone who needs
"best of breed" is motivated (and likely knowledgeable enough) to make
informed decisions about what's on PyPI. But someone who just wants to
get the job done probably doesn't - and that's the audience for the
stdlib. A stdlib module needs to be a good, reliable set of basic
functionality that non-experts can use successfully. There can be
better libraries on PyPI, but that doesn't mean the stdlib module is
unnecessary, nor does it mean that the stdlib has to match the PyPI
library feature for feature.
So here, specifically, I'd rather see urlllib be the best urlllib it
can be, and not demand that it turn into requests. Requests is there
if people need/want it (as is httpx, and urllib3, and aiohttp). But
urllib is for people who want to get a file from the web, and *not*
have to deal with dependencies, 3rd party libraries, etc.
On Sun, Mar 27, 2022 at 3:08 AM Paul Moore <p.f....@gmail.com> wrote:> > 3. Overall, I think the days where "battery included" was a positive argument are over
>
> I strongly disagree. Being able to download something and immediately get something to work and see results is hugely
> rewarding; on the other hand, having to research, find, compare & contrast available third-party modules (especially for
> new-comers) can be extremely discouraging.
exactly - let's say someone needs to write some JSON for the first time.
I think the truth is somewhere in the middle. Python should
include support for commonly needed functionality. This includes
all kinds of language support (functools, collections, asyncio,
wsgiref, re etc.), common file formats like XML, JSON, tar, zip
etc., OS support (os, sys, stat etc.), basic networking (TCP/IP,
making HTTP requests, sending mail), but also basic math modules
like decimal, fractions, or statistics. I don't think it should
support esoteric, niche, or long obsolete file formats or
networking protocols like FTP, sunau etc. I also don't think that
Python should come with "basic" servers that can't be used for
anything useful. The same is true for domain-specific
applications. For example, I wouldn't want a complex numerics
package as part of Python (although having some more basic data
types would make sense).
Another problem are "optional" modules like sqlite or tk/tcl.
Because they are optional, you can't depend on them being present,
but you also can't ensure their presence by "pip install"ing them.
In fact, this is an example, I think, of where we should put some effort into making the included batteries better -- it's great to have a JSON lib built in, but it's too bad that it's not best-of-bread by pretty much any definition (speed, memory performance, flexibility) -- there are quite a few feature requests open for it -- it would be nice to actually implement some of those. (but yes, that's a lot of work that someone(s) would have to do)
Back to the topic at hand, rather than remove urllib, maybe it could be made better -- an as-easy-to-use-as-requests package in the stdlib would be really great.
I agree 100%. On the one hand the stdlib is missing some functionality I would consider "basic" (for example, async file and HTTP fetching support), on the other hand some of the existing modules would benefit from a more modern API that makes the common case easy and the uncommon case possible.
- Sebastian
On 29 Mar 2022, at 00:34, Brett Cannon <br...@python.org> wrote:On Mon, Mar 28, 2022 at 11:52 AM Christopher Barker <pyth...@gmail.com> wrote:On Mon, Mar 28, 2022 at 11:29 AM Paul Moore <p.f....@gmail.com> wrote:To be honest, I feel like I'm just reiterating stuff I've said before
here, and I think the same is true of the points I'm responding to...(I'm not *against* going over the debate again,
it helps make sure people haven't changed their minds, but it's
important to be clear that none of the practical facts have changed,
if that is the case).Maybe there's a way to make this discussion (it feels more like a discussion than debate at the moment) more productive by writing some things down. I'm not sure it's a PEP, but some kind of:"policy for the stdlib" document in which we could capture the primary points of view, places where there's consensus, etc. would be helpful to keep us retreading this over and over again.I suggest this without the bandwidth to actually shepherd the project, but if someone wants to, I think it would be a great idea.Once https://mail.python.org/archives/list/python-c...@python.org/thread/5EUZLT5PNA4HT42NGB5WVN5YWW5ASTT5/ is considered resolved, the next part of my "what is the stdlib" plan is to finally try to suss all of this out and more-or-less write a stdlib policy PEP so we stop talking about this. My guess it will be more of guidance about what we want the stdlib to be and thus guide what things belong in it. No ETA on that work since I also have four other big Python projects on the go right now whose work I am constantly alternating between.
_______________________________________________-Brett_______________________________________________-CHB--Christopher Barker, PhD (Chris)
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython
Python-Dev mailing list -- pytho...@python.org
To unsubscribe send an email to python-d...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/pytho...@python.org/message/GAZAFRFVJVQZMEIHTQUJASP7VRAKA5RR/
Code of Conduct: http://python.org/psf/codeofconduct/
Python-Dev mailing list -- pytho...@python.org
To unsubscribe send an email to python-d...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
On 29 Mar 2022, at 00:34, Brett Cannon <br...@python.org> wrote:On Mon, Mar 28, 2022 at 11:52 AM Christopher Barker <pyth...@gmail.com> wrote:On Mon, Mar 28, 2022 at 11:29 AM Paul Moore <p.f....@gmail.com> wrote:To be honest, I feel like I'm just reiterating stuff I've said before
here, and I think the same is true of the points I'm responding to...(I'm not *against* going over the debate again,
it helps make sure people haven't changed their minds, but it's
important to be clear that none of the practical facts have changed,
if that is the case).Maybe there's a way to make this discussion (it feels more like a discussion than debate at the moment) more productive by writing some things down. I'm not sure it's a PEP, but some kind of:"policy for the stdlib" document in which we could capture the primary points of view, places where there's consensus, etc. would be helpful to keep us retreading this over and over again.I suggest this without the bandwidth to actually shepherd the project, but if someone wants to, I think it would be a great idea.Once https://mail.python.org/archives/list/python-c...@python.org/thread/5EUZLT5PNA4HT42NGB5WVN5YWW5ASTT5/ is considered resolved, the next part of my "what is the stdlib" plan is to finally try to suss all of this out and more-or-less write a stdlib policy PEP so we stop talking about this. My guess it will be more of guidance about what we want the stdlib to be and thus guide what things belong in it. No ETA on that work since I also have four other big Python projects on the go right now whose work I am constantly alternating between.Having such a policy is a good thing and helps in evolving the stdlib, but I wonder if the lack of such a document is the real problem. IMHO the main problem is that the CPython team is very small and therefore has little bandwidth for maintaining, let alone evolving, large parts of the stdlib. In that it doesn’t help that some parts of the stdlib have APIs that make it hard to make modifications (such as distutils where effectively everything is part of the public API). Shrinking the stdlib helps in the maintenance burden, but feels as a partial solution.
That said, I have no ideas on how a better stdlib development proces would look like, let alone on how to get there.
There's the CODEOWNERS file:
https://github.com/python/cpython/blob/main/.github/CODEOWNERS
_______________________________________________
Python-Dev mailing list -- pytho...@python.org
To unsubscribe send an email to python-d...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/pytho...@python.org/message/CN7SXNP2D4ML4U2OBIUC4DGQOKEYNSKE/
email doesn't fix bugs; maintainers fix bugs. Please let us know
*publicly* if you want to become the maintainer for a stdlib module and
then we can support them, but if nobody is willing/able/ready to care
for them it's irresponsible for us to keep shipping them to users.
On Wed, 30 Mar 2022 12:03:58 +0100
Steve Dower <steve...@python.org> wrote:
> On 30Mar2022 1124, Barney Gale wrote:
> > I'd like to become a maintainer for the pathlib module, if possible. I
> > know the code and tests inside-out, and I've been wrestling the
> > internals for past few Python releases. I check the bugs/PRs at least
> > every week and help wherever I can.
>
> Antoine is still active, so if he's fine with that, I'm also supportive.
> You're certainly familiar enough with that module.
I'm entirely supportive. Huge thank you for working on pathlib!
One thing about talking about "make urllib more like requests" that is different than any of the other libs, though, is that requests aims to be easier to use than anything else (which I note Chris Barker called out as why he wanted urllib to be more like it). I think that's important to think about because i think ease of use is also the number one thing that the audience you talk about is also looking for.Of course, figuring out whether an api like request's is actually easier to use than urllib or merely more featureful is open to debate.
-toshio
_______________________________________________
Python-Dev mailing list -- pytho...@python.org
To unsubscribe send an email to python-d...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
On Tue, Mar 29, 2022 at 8:58 AM Ronald Oussoren <ronaldo...@mac.com> wrote:On 29 Mar 2022, at 00:34, Brett Cannon <br...@python.org> wrote:On Mon, Mar 28, 2022 at 11:52 AM Christopher Barker <pyth...@gmail.com> wrote:On Mon, Mar 28, 2022 at 11:29 AM Paul Moore <p.f....@gmail.com> wrote:Having such a policy is a good thing and helps in evolving the stdlib, but I wonder if the lack of such a document is the real problem. IMHO the main problem is that the CPython team is very small and therefore has little bandwidth for maintaining, let alone evolving, large parts of the stdlib. In that it doesn’t help that some parts of the stdlib have APIs that make it hard to make modifications (such as distutils where effectively everything is part of the public API). Shrinking the stdlib helps in the maintenance burden, but feels as a partial solution.You're right that is the fundamental problem. But for me this somewhat stems from the fact that we don't have a shared understanding of what the stdlib is, and so the stdlib is a bit unbounded in its size and scope. That leads to a stdlib which is hard to maintain. It's just like dealing with any scarce resource: you try to cut back on your overall use as best as you can and then become more efficient with what you must still consume; I personally think we don't have an answer to the "must consume" part of that sentence that leads us to "cut back" to a size we can actually keep maintained so we don't have 1.6K open PRs.
These batteries ain't dead yet! :D
Best,Barney
_______________________________________________
Python-Dev mailing list -- pytho...@python.org
To unsubscribe send an email to python-d...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
On Sun, 27 Mar 2022 at 17:11, Christopher Barker <pyth...@gmail.com> wrote:
>
> With the json package included, all they need to do is `import json`. If that wasn't there, they's look in PyPi for a JSON implementation, and find an absolutely astonishing number of options. I just did a search for "JSON"
> on PYPI, and it's HUGE -- most of them are for specialized JSON-using protocols of some sort. I was actually really surprised that couple I know about of the top of my head (ujson, orjson) are actually hard to find.
>
> "You can just pip install it" is really not a good solution.
>
> In fact, this is an example, I think, of where we should put some effort into making the included batteries better -- it's great to have a JSON lib built in, but it's too bad that it's not best-of-bread by pretty much any definition (speed, memory performance, flexibility) -- there are quite a few feature requests open for it -- it would be nice to actually implement some of those. (but yes, that's a lot of work that someone(s) would have to do)
>
> Back to the topic at hand, rather than remove urllib, maybe it could be made better -- an as-easy-to-use-as-requests package in the stdlib would be really great.
I think that's where the mistake happens, though. Someone who needs
"best of breed" is motivated (and likely knowledgeable enough) to make
informed decisions about what's on PyPI. But someone who just wants to
get the job done probably doesn't - and that's the audience for the
stdlib. A stdlib module needs to be a good, reliable set of basic
functionality that non-experts can use successfully. There can be
better libraries on PyPI, but that doesn't mean the stdlib module is
unnecessary, nor does it mean that the stdlib has to match the PyPI
library feature for feature.
So here, specifically, I'd rather see urlllib be the best urlllib it
can be, and not demand that it turn into requests. Requests is there
if people need/want it (as is httpx, and urllib3, and aiohttp). But
urllib is for people who want to get a file from the web, and *not*
have to deal with dependencies, 3rd party libraries, etc.
The "batteries included" standard library and PyPI complement each
other. Neither is redundant, and neither implies the other is
unnecessary.
Paul
_______________________________________________
Python-Dev mailing list -- pytho...@python.org
To unsubscribe send an email to python-d...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
As just one example, i found two interesting items in the discussion started by Skip about determining what modules don't have maintainers just downstream if this.
On 29 Mar 2022, at 19:51, Brett Cannon <br...@python.org> wrote:On Tue, Mar 29, 2022 at 8:58 AM Ronald Oussoren <ronaldo...@mac.com> wrote:On 29 Mar 2022, at 00:34, Brett Cannon <br...@python.org> wrote:Once https://mail.python.org/archives/list/python-c...@python.org/thread/5EUZLT5PNA4HT42NGB5WVN5YWW5ASTT5/ is considered resolved, the next part of my "what is the stdlib" plan is to finally try to suss all of this out and more-or-less write a stdlib policy PEP so we stop talking about this. My guess it will be more of guidance about what we want the stdlib to be and thus guide what things belong in it. No ETA on that work since I also have four other big Python projects on the go right now whose work I am constantly alternating between.Having such a policy is a good thing and helps in evolving the stdlib, but I wonder if the lack of such a document is the real problem. IMHO the main problem is that the CPython team is very small and therefore has little bandwidth for maintaining, let alone evolving, large parts of the stdlib. In that it doesn’t help that some parts of the stdlib have APIs that make it hard to make modifications (such as distutils where effectively everything is part of the public API). Shrinking the stdlib helps in the maintenance burden, but feels as a partial solution.You're right that is the fundamental problem. But for me this somewhat stems from the fact that we don't have a shared understanding of what the stdlib is, and so the stdlib is a bit unbounded in its size and scope. That leads to a stdlib which is hard to maintain.
It's just like dealing with any scarce resource: you try to cut back on your overall use as best as you can and then become more efficient with what you must still consume; I personally think we don't have an answer to the "must consume" part of that sentence that leads us to "cut back" to a size we can actually keep maintained so we don't have 1.6K open PRs.