Re: [Django] #33657: Customizable management command formatters.

46 views
Skip to first unread message

Django

unread,
Apr 25, 2022, 3:37:18 AM4/25/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by James Pic):

Looks good but I don't see a reason for keeping a default that swallows
newlines because PEP257 forbids having a multiline sentence on the first
line anyway:

> Multi-line docstrings consist of a summary line just like a one-line
docstring, followed by a blank line, followed by a more elaborate
description.

As such, the default formater which purpose is to unwrap the first
sentence encourages breaking PEP 257.

And users who are naturally complying with PEP257 will have to override
the formatter, it should be the other way around.

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

Django

unread,
Apr 25, 2022, 3:39:41 AM4/25/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by James Pic):

Also, the not-unwraping formater will also look fine with existing
docstrings, it will work for both use cases, while the current one only
works for one use case and breaks the other. The default formater should
work for both

--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:4>

Django

unread,
Apr 25, 2022, 3:48:00 AM4/25/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

Replying to [comment:4 James Pic]:


> Also, the not-unwraping formater will also look fine with existing
docstrings, it will work for both use cases, while the current one only
works for one use case and breaks the other. The default formater should
work for both

It seems you think that Python's (not Django's) default behavior should be
changed according to PEP 257. I'd recommend to start a discussion in
Python's bugtracker. As far as I'm aware the proposed solution will allow
users to freely change a formatter, which should be enough from the Django
point of view.

--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:5>

Django

unread,
May 8, 2022, 2:52:30 PM5/8/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: suvhotta
Type: | Status: assigned

Cleanup/optimization |
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by suvhotta):

* owner: nobody => suvhotta
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:6>

Django

unread,
May 9, 2022, 1:32:37 AM5/9/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Subhankar
Type: | Hotta
Cleanup/optimization | Status: assigned

Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by James Pic):

No, I think that Django's default behavior should match Python's PEP 257,
and also, have a default that works in all use cases.

--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:7>

Django

unread,
May 15, 2022, 4:58:44 AM5/15/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Subhankar
Type: | Hotta
Cleanup/optimization | Status: assigned
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Subhankar Hotta):

So as part of this issue, do we make changes to allow a user to override
the formatter through kwargs and also keep DjangoHelpFormatter as the
default?

--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:8>

Django

unread,
May 16, 2022, 12:10:44 AM5/16/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Subhankar
Type: | Hotta
Cleanup/optimization | Status: assigned
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

Replying to [comment:8 Subhankar Hotta]:


> So as part of this issue, do we make changes to allow a user to override
the formatter through kwargs and also keep DjangoHelpFormatter as the
default?

Yes, see [https://code.djangoproject.com/ticket/33657#comment:2 comment].

--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:9>

Django

unread,
Jun 15, 2022, 3:56:46 AM6/15/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: (none)
Type: | Status: new
Cleanup/optimization |

Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: Subhankar Hotta => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:10>

Django

unread,
Jun 18, 2022, 12:41:35 AM6/18/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Abhinav
Type: | Yadav
Cleanup/optimization | Status: assigned

Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Abhinav Yadav):

* owner: (none) => Abhinav Yadav


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:11>

Django

unread,
Jun 19, 2022, 12:56:48 AM6/19/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Abhinav
Type: | Yadav
Cleanup/optimization | Status: assigned
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Abhinav Yadav):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/15781 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:12>

Django

unread,
Jun 20, 2022, 12:09:56 AM6/20/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Abhinav
| Yadav
Type: Bug | Status: assigned

Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* type: Cleanup/optimization => Bug
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:13>

Django

unread,
Jun 20, 2022, 3:08:09 AM6/20/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Abhinav
| Yadav
Type: Bug | Status: assigned
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_tests: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:14>

Django

unread,
Jun 20, 2022, 11:35:44 AM6/20/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Abhinav
| Yadav
Type: Bug | Status: closed

Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"2887b9f67cadc5295ef6a0574de2c2c8fdd66905" 2887b9f]:
{{{
#!CommitTicketReference repository=""
revision="2887b9f67cadc5295ef6a0574de2c2c8fdd66905"
Fixed #33657 -- Allowed customizing formatter class of argument parsers.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:15>

Django

unread,
Jun 20, 2022, 11:36:18 AM6/20/22
to django-...@googlegroups.com
#33657: Customizable management command formatters.
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Abhinav
| Yadav
Type: Bug | Status: closed
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"99e5ce96c6716fe43ce1dc706a9a49b77f9e7bbc" 99e5ce96]:
{{{
#!CommitTicketReference repository=""
revision="99e5ce96c6716fe43ce1dc706a9a49b77f9e7bbc"
[4.1.x] Fixed #33657 -- Allowed customizing formatter class of argument
parsers.

Backport of 2887b9f67cadc5295ef6a0574de2c2c8fdd66905 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33657#comment:16>

Reply all
Reply to author
Forward
0 new messages