-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Add PYTHONDEVMODE=1 to enable the developer mode #76282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In the review of the PR 4478, Antoine Pitrou proposed to add an environment variable to enable the new Python "developer mode" to inherit the developer mode in child Python processes. I proposed to add PYTHONDEVMODE=1. Nick Coghlan proposed PYTHONXOPTIONS=dev. While -X is a new "catch all" for new CPython options, Python got new PYTHONxxx environment variables to enable new options:
I have a preference for PYTHONDEVMODE=1. If we start to use PYTHONXOPTIONS, users may want to use PYTHONXOPTIONS=tracemalloc, and then we have to decide which environment variable has the preference :-( Moreover, tracemalloc takes an argument, whereas environment variables with a value containing '=' are rare and so likely to cause issues in programs not carefully written to handle such variables. (Environment variables are inherited by all processes, not only Python processes.) |
Another argument against PYTHONXOPTIONS is that each implementation is free to decide which -X options it wants to support, and we don't really define what they're supposed to do with options they don't recognise. By contrast, there's an established behaviour for unknown environment variables: implementations that don't support them just ignore them. So +1 for PYTHONDEVMODE=1 from me - that also gives us more flexibility if we decide to add arguments to the option later. |
While implementing a new PYTHONDEVMODE environment variable, I found that it would help to also add a new sys.flags.dev_mode flag. So I added it. So for example, asyncio uses sys.flags.dev_mode rather than checking for 'dev' in sys._xoptions *and* check if the environment variable is set or not. |
Thanks Antoine and Nick for reviews and the feedback! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: