Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Glenn Linderman
On 11/16/2017 7:39 AM, Barry Warsaw wrote: On Nov 16, 2017, at 09:47, Yury Selivanov wrote: Let's keep it simple. I'm big -1 on adding different "debug levels", they are always confusing. Oh, this one’s easy. -X dev == some debugging -X deve == a little more -X devel == give

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Victor Stinner
My draft addition to the -X dev doc: """ The developer mode is different from the "debug mode" of some modules of the standard library which enables a lot of debug logs. The developer mode should only log a warning if a potential bug is detected. The developer mode has a limited effect. Many modul

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Antoine Pitrou
Le 16/11/2017 à 17:42, Victor Stinner a écrit : > > Running an application in debug mode or "developer mode" was never > recommanded by anyone. I don't know. Almost everyone runs Python with __debug__ set to True :-) Regards Antoine. ___ Python-Dev

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Victor Stinner
2017-11-16 15:47 GMT+01:00 Yury Selivanov : > Overall I don't see an issue with enabling asyncio debug mode when > python is executed with "-X dev". Cool! > If the purpose of the flag is to > make Python super verbose and it will not be recommended to use it in > production -- then why not. Runn

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Barry Warsaw
On Nov 16, 2017, at 09:47, Yury Selivanov wrote: > Let's keep it simple. I'm big -1 on adding different "debug levels", > they are always confusing. Oh, this one’s easy. -X dev == some debugging -X deve == a little more -X devel == give it to me! -X develo== now you’re talki

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Barry Warsaw
On Nov 15, 2017, at 21:57, Victor Stinner wrote: > > Since Brett and Nick like the idea and nobody complained against it, I > implemented the -X dev option: Cool! What would you think about printing a summary of the settings under the standard banner when you run the REPL under -X dev? I’d ra

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Barry Warsaw
On Nov 16, 2017, at 06:53, Victor Stinner wrote: > What do you think? Is it ok to include asyncio in the global "developer mode"? I’m +1 on that, and the performance hit doesn’t bother me for a developer mode. -Barry signature.asc Description: Message signed with OpenPGP

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Yury Selivanov
On Thu, Nov 16, 2017 at 7:56 AM, Victor Stinner wrote: > 2017-11-16 13:43 GMT+01:00 Antoine Pitrou : >>> About asyncio debug mode, if it's too expensive to be used to develop >>> an application, maybe there is an issue with additional checks? Should >>> we remove some of them to be able to use asy

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Nick Coghlan
On 16 November 2017 at 22:54, Antoine Pitrou wrote: > > Hi Victor, > > Thanks for the answer! > > Le 16/11/2017 à 13:48, Victor Stinner a écrit : > > > > faulthandler has a negligible cost on performance/memory. > > > > For -W default, I guess that your question is the cost on emitting a > > warn

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Victor Stinner
2017-11-16 13:54 GMT+01:00 Antoine Pitrou : > -Wdefault means -Wonce or -Walways? If the former, I don't expect many > warnings to be emitted. It's kind of funny that passing "-W default" changes the "default" behaviour. "-W default" is documented as: "Explicitly request the default behavior (

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Victor Stinner
2017-11-16 13:43 GMT+01:00 Antoine Pitrou : >> About asyncio debug mode, if it's too expensive to be used to develop >> an application, maybe there is an issue with additional checks? Should >> we remove some of them to be able to use asyncio debug mode in more >> cases? > > Well, I'm sure some peo

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Antoine Pitrou
Hi Victor, Thanks for the answer! Le 16/11/2017 à 13:48, Victor Stinner a écrit : > > faulthandler has a negligible cost on performance/memory. > > For -W default, I guess that your question is the cost on emitting a > warning: overhead when a warning is displayed, and overhead when the > warn

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Victor Stinner
2017-11-16 13:11 GMT+01:00 Antoine Pitrou : > Could you measure and perhaps document the expected effect on > performance and memory consumption? > (it can be a very rough ballpart estimate) Currently "python3 -X dev script.py" behaves as "PYTHONMALLOC=debug python3 -W default -X faulthandler scri

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Antoine Pitrou
Le 16/11/2017 à 13:38, Victor Stinner a écrit : > 2017-11-16 13:09 GMT+01:00 Antoine Pitrou : >>> What do you think? Is it ok to include asyncio in the global "developer >>> mode"? >> >> I'd rather not. Those are two orthogonal things. In particular, >> asyncio debug mode is quite expensive. >

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Victor Stinner
2017-11-16 13:09 GMT+01:00 Antoine Pitrou : >> What do you think? Is it ok to include asyncio in the global "developer >> mode"? > > I'd rather not. Those are two orthogonal things. In particular, > asyncio debug mode is quite expensive. Is it really an issue? When you develop an application, t

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Antoine Pitrou
On Thu, 16 Nov 2017 03:57:49 +0100 Victor Stinner wrote: > Hi, > > Since Brett and Nick like the idea and nobody complained against it, I > implemented the -X dev option: > https://bugs.python.org/issue32043 > (Right now, it's a pull request.) Could you measure and perhaps document the expected

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Antoine Pitrou
On Thu, 16 Nov 2017 12:53:24 +0100 Victor Stinner wrote: > Ok, I merged my PR adding -X dev: you can now test in Python 3.7 ;-) > > > The list of checks can be extended later. For example, we may enable > > the debug mode of asyncio: PYTHONASYNCIODEBUG=1. > > I opened https://bugs.python.org/

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-16 Thread Victor Stinner
Ok, I merged my PR adding -X dev: you can now test in Python 3.7 ;-) > The list of checks can be extended later. For example, we may enable > the debug mode of asyncio: PYTHONASYNCIODEBUG=1. I opened https://bugs.python.org/issue32047 to propose enable asyncio debug mode using the Python develope

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-15 Thread Victor Stinner
Hi, Since Brett and Nick like the idea and nobody complained against it, I implemented the -X dev option: https://bugs.python.org/issue32043 (Right now, it's a pull request.) I removed the -b option. Victor 2017-11-14 3:57 GMT+01:00 Nick Coghlan : > On 14 November 2017 at 02:08, Victor Stinner

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-13 Thread Nick Coghlan
On 14 November 2017 at 02:08, Victor Stinner wrote: > My "-X dev" idea is not incompatible with Nick's PEP 565 "Show > DeprecationWarning in __main__" and it's different: it's an opt-in > option, while Nick wants to change the default behaviour. I'm +1 on a `-X dev` mode, since it enables a lot o

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-13 Thread Victor Stinner
2017-11-13 17:51 GMT+01:00 Antoine Pitrou : > The main issue I have with `-b` is actually that you can get spurious > warnings about properly working code. You can also get warnings in > well-tested third-party libraries, e.g.: > > distributed/tests/test_client.py::test_get_versions > > /home/a

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-13 Thread Antoine Pitrou
Le 13/11/2017 à 17:46, Victor Stinner a écrit : > 2017-11-13 17:40 GMT+01:00 Antoine Pitrou : >> I would personally not add `-b` in those options. I think it was >> useful while porting stuff to 3.x, but not so much these days. > > You should consider youself as lucky if you completed to port al

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-13 Thread Serhiy Storchaka
13.11.17 18:40, Antoine Pitrou пише: On Mon, 13 Nov 2017 17:08:06 +0100 Victor Stinner wrote: In short: python3.7 -X dev script.py behaves as: PYTHONMALLOC=debug python3.7 -Wd -b -X faulthandler script.py I would personally not add `-b` in those options. I think it was useful while p

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-13 Thread Victor Stinner
2017-11-13 17:40 GMT+01:00 Antoine Pitrou : > I would personally not add `-b` in those options. I think it was > useful while porting stuff to 3.x, but not so much these days. You should consider youself as lucky if you completed to port all your code to Python 3. It's not my case yet :-) (I'm th

Re: [Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-13 Thread Antoine Pitrou
On Mon, 13 Nov 2017 17:08:06 +0100 Victor Stinner wrote: > Hi, > > The discussion on DeprecationWarning reminded me my old idea of a > "development mode" for CPython: -X dev. Since Brett likes it, I post > it on python-dev. Last year, I posted this idea to python-ideas but my > idea was rejected:

[Python-Dev] Add a developer mode to Python: -X dev command line option

2017-11-13 Thread Victor Stinner
Hi, The discussion on DeprecationWarning reminded me my old idea of a "development mode" for CPython: -X dev. Since Brett likes it, I post it on python-dev. Last year, I posted this idea to python-ideas but my idea was rejected: https://mail.python.org/pipermail/python-ideas/2016-March/039314.htm