[Django] #33387: Separate between words in Django commands

11 views
Skip to first unread message

Django

unread,
Dec 27, 2021, 11:55:20 AM12/27/21
to django-...@googlegroups.com
#33387: Separate between words in Django commands
-------------------------------------+-------------------------------------
Reporter: אורי | Owner: nobody
Type: | Status: new
Uncategorized |
Component: Core | Version: dev
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I checked the list of [https://docs.djangoproject.com/en/4.0/ref/django-
admin/ Django commands], and a long time ago I noticed that many of them
contain two or even three words but they are not separated. For example
`makemigrations`, `makemessages`, `changepassword` and `createsuperuser`.
Although I found commands with separated words such as
`remove_stale_contenttypes` (which I was not aware of until right now). I
checked [https://www.python.org/dev/peps/pep-0008/#function-and-variable-
names PEP 8] and there it is written:

> Function names should be lowercase, with words separated by underscores
as necessary to improve readability.
>
> Variable names follow the same convention as function names.

I think Django commands should follow the same logic, and separate words
by underscores (`make_migrations`, `make_messages`, `change_password` and
`create_super_user`, `remove_stale_content_types`). I suggest that you add
the new spelling while keeping the old spelling working, or maybe
deprecate the old spelling but for at least 3 Django releases, so they
will still work. But according to PEP 8 I think words should be separated
by underscores.

This is also relevant to `TestCase` methods such as `setUp` and
`tearDownClass`. Although there I assume Django inherits them from Python
the language, and maybe the changes should be done also there.

By the way, I already defined a few such commands in Speedy Net since
2019:
https://github.com/speedy-net/speedy-
net/tree/master/speedy/core/base/management/commands

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

Django

unread,
Dec 27, 2021, 12:00:15 PM12/27/21
to django-...@googlegroups.com
#33387: Separate between words in Django commands and methods

-------------------------------------+-------------------------------------
Reporter: אורי | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/33387#comment:1>

Django

unread,
Dec 27, 2021, 1:12:46 PM12/27/21
to django-...@googlegroups.com
#33387: Separate between words in Django commands and methods

-------------------------------------+-------------------------------------
Reporter: אורי | Owner: nobody
Type: | Status: closed
Cleanup/optimization |

Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* type: Uncategorized => Cleanup/optimization
* resolution: => wontfix


Comment:

> I checked the list of [https://docs.djangoproject.com/en/4.0/ref/django-
admin/ Django commands], and a long time ago I noticed that many of them
contain two or even three words but they are not separated. For example
`makemigrations`, `makemessages`, `changepassword` and `createsuperuser`.
Although I found commands with separated words such as
`remove_stale_contenttypes` (which I was not aware of until right now). I
checked [https://www.python.org/dev/peps/pep-0008/#function-and-variable-
names PEP 8] and there it is written:

Thanks for this ticket, however I don't think it's worth changing just to
follow PEP 8 it's really disruptive. In the case of such changes, it's
crucial to have a strong consensus and clear significant benefits.

> This is also relevant to `TestCase` methods such as `setUp` and
`tearDownClass`. Although there I assume Django inherits them from Python
the language, and maybe the changes should be done also there.

The `unittest` unit testing framework was originally inspired by JUnit
that's why it has camel-cased methods.

You can raise the idea on the DevelopersMailingList or the python-ideas
list (it was probably already raised) to reach a wider audience and see
what other think, however I don't think there would be consensus to change
that.

--
Ticket URL: <https://code.djangoproject.com/ticket/33387#comment:2>

Django

unread,
Dec 31, 2021, 10:23:50 AM12/31/21
to django-...@googlegroups.com
#33387: Separate between words in Django commands and methods

-------------------------------------+-------------------------------------
Reporter: אורי | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: wontfix
Keywords: | 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 אורי:

Old description:

New description:

I checked the list of [https://docs.djangoproject.com/en/4.0/ref/django-
admin/ Django commands], and a long time ago I noticed that many of them
contain two or even three words but they are not separated. For example
`makemigrations`, `makemessages`, `changepassword` and `createsuperuser`.
Although I found commands with separated words such as
`remove_stale_contenttypes` (which I was not aware of until right now). I
checked [https://www.python.org/dev/peps/pep-0008/#function-and-variable-
names PEP 8] and there it is written:

> Function names should be lowercase, with words separated by underscores
as necessary to improve readability.
>
> Variable names follow the same convention as function names.

I think Django commands should follow the same logic, and separate words

by underscores (`make_migrations`, `make_messages`, `change_password`,


`create_super_user`, `remove_stale_content_types`). I suggest that you add
the new spelling while keeping the old spelling working, or maybe
deprecate the old spelling but for at least 3 Django releases, so they
will still work. But according to PEP 8 I think words should be separated
by underscores.

This is also relevant to `TestCase` methods such as `setUp` and
`tearDownClass`. Although there I assume Django inherits them from Python
the language, and maybe the changes should be done also there.

By the way, I already defined a few such commands in Speedy Net since
2019:
https://github.com/speedy-net/speedy-
net/tree/master/speedy/core/base/management/commands

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33387#comment:3>

Reply all
Reply to author
Forward
0 new messages