Respect --no-color for command help on python 3.14
Python 3.14 introduces colorized help to argparse: https://docs.python.org/3.14/library/argparse.html#color
I propose that we enable this feature by setting color=True for all argument parsers in Django, notably for management commands.
Python supports common opt-out environment variables for the feature. I think we’ll need to extend that to also avoid setting the color attribute when DJANGO_COLORS is set to nocolor, as already documented.
We may also be able to set the option when `--force-color` is passed, although that may not make sense when --help is passed.
Related: #36321
Change History
(16)
| Description: |
modified (diff)
|
| Summary: |
Use argparse color on Python 3.14+ → Use argparse colorized help on Python 3.14+
|
| Triage Stage: |
Unreviewed → Someday/Maybe
|
| Type: |
Uncategorized → New feature
|
| Has patch: |
set
|
| Patch needs improvement: |
set
|
| Owner: |
set to wangxiaolei
|
| Status: |
new → assigned
|
| Triage Stage: |
Someday/Maybe → Accepted
|
| Owner: |
changed from wangxiaolei to Sachi Jain
|
| Patch needs improvement: |
unset
|
| Keywords: |
6.1 removed
|
| Patch needs improvement: |
set
|
| Severity: |
Normal → Release blocker
|
| Summary: |
Use argparse colorized help on Python 3.14+ → Respect --no-color for command help on python 3.14
|
| Type: |
New feature → Bug
|
| Version: |
dev → 5.2
|
| Needs documentation: |
set
|
| Version: |
5.2 → 6.0
|
| Keywords: |
3.14 color added
|
| Version: |
6.0 → 5.2
|
| Needs documentation: |
unset
|
| Patch needs improvement: |
unset
|
| Triage Stage: |
Accepted → Ready for checkin
|
| Resolution: |
→ fixed
|
| Status: |
assigned → closed
|
Note that Python 3.14 is scheduled for October 1st (see #35844)