Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-19 Thread M.-A. Lemburg
On 19.01.2018 05:38, Nathaniel Smith wrote: > On Thu, Jan 18, 2018 at 7:51 PM, Guido van Rossum wrote: >> Can someone explain to me why this is such a controversial issue? > > I guess practicality versus purity is always controversial :-) > >> It seems reasonable to me to add new encodings to th

[Python-ideas] Official site-packages/test directory

2018-01-19 Thread Stefan Krah
Hello, I wonder if we could get an official site-packages/test directory. Currently it seems to be problematic to distribute tests if they are outside the package directory. Here is a nice overview of the two main layout possibilities: http://pytest.readthedocs.io/en/reorganize-docs/new-docs/u

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Guido van Rossum
IIUC another common layout is to have folders named test or tests inside each package. This would avoid requiring any changes to the site-packages layout. On Fri, Jan 19, 2018 at 6:27 AM, Stefan Krah wrote: > > Hello, > > I wonder if we could get an official site-packages/test directory. > Curre

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-19 Thread Guido van Rossum
On Fri, Jan 19, 2018 at 5:30 AM, M.-A. Lemburg wrote: > On 19.01.2018 05:38, Nathaniel Smith wrote: > > On Thu, Jan 18, 2018 at 7:51 PM, Guido van Rossum > wrote: > >> Can someone explain to me why this is such a controversial issue? > > > > I guess practicality versus purity is always controver

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Paul Moore
Another common approach is to not ship tests as part of your (runtime) package at all - they are in the sdist but not the wheels nor are they deployed with "setup.py install". In my experience, this is the usual approach projects take if they don't have the tests in the package directory. (I don't

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-19 Thread Random832
On Fri, Jan 19, 2018, at 08:30, M.-A. Lemburg wrote: > > Someone did discover that Microsoft's current implementations of the > > windows-* encodings matches the WHAT-WG spec, rather than the Unicode > > spec that Microsoft originally wrote. > > No, MS implements somethings called "best fit encodi

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Wolfgang Maier
On 01/19/2018 03:27 PM, Stefan Krah wrote: Hello, I wonder if we could get an official site-packages/test directory. Currently it seems to be problematic to distribute tests if they are outside the package directory. Here is a nice overview of the two main layout possibilities: http://pytest

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Guido van Rossum
On Fri, Jan 19, 2018 at 8:30 AM, Wolfgang Maier < wolfgang.ma...@biologie.uni-freiburg.de> wrote: > > I think that's a really nice idea. > With an official site-packages/test directory there could be pip support > for optionally installing tests alongside a package if its layout allows > it. So en

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-19 Thread M.-A. Lemburg
On 19.01.2018 17:20, Guido van Rossum wrote: > On Fri, Jan 19, 2018 at 5:30 AM, M.-A. Lemburg > wrote: > > On 19.01.2018 05:38, Nathaniel Smith wrote: > > On Thu, Jan 18, 2018 at 7:51 PM, Guido van Rossum > wrote: > >> Can someone expl

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Stefan Krah
On Fri, Jan 19, 2018 at 04:23:23PM +, Paul Moore wrote: > Another common approach is to not ship tests as part of your (runtime) > package at all - they are in the sdist but not the wheels nor are they > deployed with "setup.py install". In my experience, this is the usual > approach projects t

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-19 Thread Rob Speer
Error handlers are quite orthogonal to this problem. If you try to solve this problem with an error handler, you will have a different problem. Suppose you made "c1-control-passthrough" or whatever into an error handler, similar to "replace" or "ignore", and then you encounter an unassigned charac

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Wolfgang Maier
On 01/19/2018 05:48 PM, Guido van Rossum wrote: On Fri, Jan 19, 2018 at 8:30 AM, Wolfgang Maier > wrote: I think that's a really nice idea. With an official site-packages/test directory there could be pip support for optionally instal

Re: [Python-ideas] Windows Best Fit Encodings (was: Support WHATWG versions of legacy encodings)

2018-01-19 Thread M.-A. Lemburg
On 19.01.2018 17:24, Random832 wrote: > On Fri, Jan 19, 2018, at 08:30, M.-A. Lemburg wrote: >>> Someone did discover that Microsoft's current implementations of the >>> windows-* encodings matches the WHAT-WG spec, rather than the Unicode >>> spec that Microsoft originally wrote. >> >> No, MS impl

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-19 Thread Guido van Rossum
OK, I will tune out this conversation. It is clearly not going anywhere. On Fri, Jan 19, 2018 at 9:12 AM, Rob Speer wrote: > Error handlers are quite orthogonal to this problem. If you try to solve > this problem with an error handler, you will have a different problem. > > Suppose you made "c1-

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Paul Moore
On 19 January 2018 at 17:08, Stefan Krah wrote: > On Fri, Jan 19, 2018 at 04:23:23PM +, Paul Moore wrote: >> Another common approach is to not ship tests as part of your (runtime) >> package at all - they are in the sdist but not the wheels nor are they >> deployed with "setup.py install". In

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Petr Viktorin
FWIW, I've had very good experience with putting tests for package `foo` in a directory/package called `test_foo`. This combines the best of both worlds -- it can be easily separated for distribution (like `tests`), and it doesn't cause name conflicts (like `foo.tests`). On 01/19/2018 05:23

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-19 Thread M.-A. Lemburg
On 19.01.2018 18:12, Rob Speer wrote: > Error handlers are quite orthogonal to this problem. If you try to solve > this problem with an error handler, you will have a different problem. > > Suppose you made "c1-control-passthrough" or whatever into an error > handler, similar to "replace" or "igno

Re: [Python-ideas] Windows Best Fit Encodings

2018-01-19 Thread M.-A. Lemburg
Hi Steve, do you know of a definite resource for Windows code pages on MSDN or another official MS website ? I tried to find some links, but only got these ancient ones: https://msdn.microsoft.com/en-us/library/cc195054.aspx (this version of cp1252 doesn't even have the euro sign yet) Thanks,

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Stefan Krah
On Fri, Jan 19, 2018 at 05:30:43PM +, Paul Moore wrote: [cut] > I'd think that the idea of a site-packages/stest directory would need > a much more compelling use case to justify it. Thanks for the detailed explanation! It sounds that there's much more work involved than I thought, so it's pr

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-19 Thread Rob Speer
> It depends on what you want to achieve. You may want to fail, assign a code point from a private area or use a surrogate escape approach. And the way to express that is with errors='replace', errors='surrogateescape', or whatever, which Python already does. We do not need an explosion of error h

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Paul Moore
On 19 January 2018 at 18:19, Stefan Krah wrote: > On Fri, Jan 19, 2018 at 05:30:43PM +, Paul Moore wrote: > [cut] >> I'd think that the idea of a site-packages/stest directory would need >> a much more compelling use case to justify it. > > Thanks for the detailed explanation! It sounds that

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Chris Barker
hmm, I've struggled for ages with this problem -- I have some packages with REALLY big test suites. so I don't put the tests in the package. But their are also numerous issues with building and installing the package (C code, lots of dependencies, etc), so it would be really nice to have a way to

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Giampaolo Rodola'
On Fri, Jan 19, 2018 at 5:23 PM, Paul Moore wrote: > Another common approach is to not ship tests as part of your (runtime) > package at all - they are in the sdist but not the wheels nor are they > deployed with "setup.py install". In my experience, this is the usual > approach projects take if

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-19 Thread M.-A. Lemburg
Rob: I think I was very clear very early in the thread that I'm opposed to adding a complete set of new encodings to the stdlib which only slightly alter many existing ones. Ever since I've been trying to give you suggestions on how we can solve the issue you're trying to address with the encodin

Re: [Python-ideas] Repurpose `assert' into a general-purpose check

2018-01-19 Thread Sylvain MARIE
> I haven't yet seen any justification for syntax here. The nearest I've seen > is that this "ensure" action is more like: > > try: > cond = x >= 0 > except BaseException: > raise AssertionError("x must be positive") > else: > if not cond: > raise AssertionError("x must be posi

[Python-ideas] Chaining coders

2018-01-19 Thread Soni L.
windows-1252 is based on iso-8859-1. Thus, I'd like to be able to chain coders as follows: bytes.decode("windows-1252-ext", else=lambda r: r.decode("iso-8859-1")) What this "else" does is that it's a lambda, and it gets passed an object with a decode method identical to the bytes decode method

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Chris Barker
On Fri, Jan 19, 2018 at 11:21 AM, Giampaolo Rodola' wrote: > > I personally include them in psutil distribution so that users can test > the installation with "python -m psutil.test". I have even this documented > as I think it's an added value. > or: pytest --pyargs pkg_name It Is really handy

Re: [Python-ideas] Chaining coders

2018-01-19 Thread Rob Speer
I see how this is another way to get what I was asking for: a way to decode some unfortunately common text encodings, ones that Web browsers use, in Python without having to import additional modules. I appreciate other ideas about how to solve this problem, but the generality here seems pretty un

Re: [Python-ideas] Windows Best Fit Encodings

2018-01-19 Thread Steve Dower
On 20Jan2018 0518, M.-A. Lemburg wrote: do you know of a definite resource for Windows code pages on MSDN or another official MS website ? I don't know of anything sorry, and my quick search didn't turn up anything public. But I can at least confirm that the internal table for cp1252 has the