Opened 9 years ago

Closed 3 years ago

Last modified 3 years ago

#25264 closed Cleanup/optimization (fixed)

Misleading list of options available for manage.py commands

Reported by: Maxime Lorant Owned by: Jan Szoja
Component: Core (Management commands) Version: dev
Severity: Normal Keywords:
Cc: Jan Szoja Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Every commands has some options available, since the BaseCommand initialize some options to the options parser: verbosity, settings, traceback..

However, this can be misleading, because these arguments are not used by every commands and sometimes this choice is by design. For example, the runserver command does not use the verbosity option, and it has been explained why only there: https://code.djangoproject.com/ticket/15132

I think the framework should not show generic options that are not used in the current commands (through an explicit list of generic options ignored or an explicit list of commands used ?)

Change History (22)

comment:1 by Maxime Lorant, 9 years ago

Summary: MisleadingMisleading list of options available for manage.py commands

comment:2 by Tim Graham, 9 years ago

Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

I don't know that this is a big problem that is worth changing, but I guess if someone wants to propose a patch to fix the issue for runserver, we could entertain it. The documentation says these options are "available on all options" so this would require an update too. One consideration is that subclasses of runserver might use these options (verbosity most likely) so removing them by default would be backwards incompatible.

comment:3 by David Smith, 4 years ago

Easy pickings: set

comment:4 by Edald123, 3 years ago

Owner: changed from nobody to Edald123
Status: newassigned

comment:5 by Edald123, 3 years ago

Owner: Edald123 removed
Status: assignednew

comment:6 by Yuneui Jeong, 3 years ago

Owner: set to Yuneui Jeong
Status: newassigned

Can I have a look at and work on this ticket? This is my first contribution, but I'll try my best.

comment:7 by Yuneui Jeong, 3 years ago

Here's the PR for this ticket: https://github.com/django/django/pull/14612

comment:8 by Yuneui Jeong, 3 years ago

Has patch: set

comment:9 by Mariusz Felisiak, 3 years ago

Patch needs improvement: set

comment:10 by Mariusz Felisiak, 3 years ago

Has patch: unset
Patch needs improvement: unset

comment:11 by Yuneui Jeong, 3 years ago

Owner: Yuneui Jeong removed
Status: assignednew

comment:12 by Jan Szoja, 3 years ago

Owner: set to Jan Szoja
Status: newassigned

That shounds like nice and easy ticket for the beginner like myself.
I will start with allowing setting argparse.SUPPRESS(as suggester in PR) in BaseCommand and possibly more advance way to tell which default commands are supported. Will see.

Version 0, edited 3 years ago by Jan Szoja (next)

comment:13 by Jan Szoja, 3 years ago

Cc: Jan Szoja added
Has patch: set

Pull Request awailable at:
https://github.com/django/django/pull/14694

I've added new attribute to BaseCommand class, which allows to disable any option/argument predefined in BaseCommand.create_parser.
All tests passed for admin_scripts.

comment:14 by Mariusz Felisiak, 3 years ago

Needs tests: set
Patch needs improvement: set

comment:15 by Mariusz Felisiak, 3 years ago

Needs documentation: set

comment:16 by Jan Szoja, 3 years ago

Needs documentation: unset
Needs tests: unset

comment:17 by Jan Szoja, 3 years ago

Patch needs improvement: unset

comment:18 by Mariusz Felisiak, 3 years ago

Easy pickings: unset
Triage Stage: AcceptedReady for checkin

comment:19 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In 3cca5fdd:

Refs #25264 -- Doc's that not all default options are supported by every management command.

comment:20 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In 97f377c:

Refs #25264 -- Added test for command --help output with default options and custom arguments.

comment:21 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In b667ac2:

Fixed #25264 -- Allowed suppressing base command options in --help output.

This also suppresses -verbosity and --trackback options in the
runserver's help.

comment:22 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In 4e55806:

[3.2.x] Refs #25264 -- Doc's that not all default options are supported by every management command.

Backport of 3cca5fdd3eb5906a385adaf9872581d4ed359041 from main

Note: See TracTickets for help on using tickets.
Back to Top