#36376: Use argparse color on Python 3.14+
-------------------------------------+-------------------------------------
     Reporter:  Adam Johnson         |                    Owner:  (none)
         Type:  Uncategorized        |                   Status:  new
    Component:  Core (Management     |                  Version:  dev
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:  6.1                  |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Adam Johnson:

Old description:

> Python 3.14 introduces colorized help to argparse:
> https://docs.python.org/3.14/library/argparse.html#color
>
> I propose that we enable this attribute 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`,
> [https://docs.djangoproject.com/en/5.2/ref/django-admin/#syntax-coloring
> as already documented].
>
> We may also be able to set the option when
> [https://docs.djangoproject.com/en/5.2/ref/django-admin/#cmdoption-force-
> color `--force-color`] is passed, although that may not make sense when
> `--help` is passed.
>
> Related: #36321

New description:

 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`,
 [https://docs.djangoproject.com/en/5.2/ref/django-admin/#syntax-coloring
 as already documented].

 We may also be able to set the option when
 [https://docs.djangoproject.com/en/5.2/ref/django-admin/#cmdoption-force-
 color `--force-color`] is passed, although that may not make sense when
 `--help` is passed.

 Related: #36321

--
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36376#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070196af6abd18-568b5932-a3b9-4f0e-9600-b47d8c94d574-000000%40eu-central-1.amazonses.com.

Reply via email to