Opened 4 months ago

Last modified 4 months ago

#36376 new New feature

Use argparse color on Python 3.14+ — at Version 1

Reported by: Adam Johnson Owned by:
Component: Core (Management commands) Version: dev
Severity: Normal Keywords: 6.1
Cc: Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adam Johnson)

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 (1)

comment:1 by Adam Johnson, 4 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top