Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Refs #29392 -- Added command line short option -s for specifying setting. #10029

Closed
wants to merge 1 commit into from
Closed

[WIP] Refs #29392 -- Added command line short option -s for specifying setting. #10029

wants to merge 1 commit into from

Conversation

carltongibson
Copy link
Member

@carltongibson carltongibson commented Jun 6, 2018

PR #9933 (for ticket #29392) removed the ability to use abbreviations of the shared options in commands. The key one there is --settings.

Why? Because you couldn't define a command with e.g. a --set option, as this was getting swallowed as --settings by the first pre-run parser. (This even though it's unambiguous to the final command parser.)

Someone at DjangoCon (who will remain anonymous 🙂) said this was a usability back-step: in the shell they were used to doing something like --s and having it work.

The example provided in the bug report struck me (and still does) as compelling. I think it was the right fix (correctness trumping convenience) but I'm opening this to discuss.

This PR adds a short option -s to --settings. The hope is, that's the best of both worlds.

BC Issues:

  • makemessages already uses -s. It does this for --symlinks. I'd argue moving it to --settings is a win (--settings is always in use, --symlinks how often?) (Discuss)
  • User-land commands may be using -s. Again, I'd probably be happy to steal that. (Discuss.)

Other options:

Todo to merge:

  • Update 2.1 release notes with extra changes.
  • Update django-admin.txt with changes to --settings in general and makemessages in particular.
  • ...anything else...?

Is this worth A) a new ticket, B) a post to Django Developers?

@carltongibson
Copy link
Member Author

@rpkilby: PING. You did #9933, so your input is important here.

@apollo13
Copy link
Member

apollo13 commented Jun 6, 2018

Haha, so this is embarrassing. I wanted to check if and why -s worked before just to realize that I have been complaining about a non existing issue: I had shell magic set up for me which expanded -s to --settings for manage.py and django-admin 😭 It's impressive how little helper can go into muscle memory and feel like they have been ever in Django itself.

Sorry for wasting your time @carltongibson -_-

@apollo13 apollo13 closed this Jun 6, 2018
@apollo13
Copy link
Member

apollo13 commented Jun 6, 2018

I honestly didn't know that --s would actually work (or --sett for that matter). Either way, my initial problem was loosing -s which I thought short forms ment but which didn't exist either way (see my comment above).

@apollo13
Copy link
Member

apollo13 commented Jun 6, 2018 via email

@carltongibson
Copy link
Member Author

Hey @apollo13. Thanks for the follow up. No issues on the confusion. I prefer to double check.

Personally I’m not fussed by the -s, so we can leave it. 👍

@carltongibson carltongibson deleted the 21/settings-short-option branch June 6, 2018 18:44
@MarkusH
Copy link
Member

MarkusH commented Jun 6, 2018

FWIW, I ran into the "some prefix of 'settings' works" behavior the other day. I wouldn't mind having a -s again, though.

@apollo13
Copy link
Member

apollo13 commented Jun 7, 2018

@MarkusH I cheked in 1.11 -- -s never existed. The prefix stuff is weird at best :D

@carltongibson carltongibson restored the 21/settings-short-option branch June 8, 2018 07:01
@carltongibson carltongibson reopened this Jun 8, 2018
@carltongibson
Copy link
Member Author

carltongibson commented Jun 8, 2018

...-s again...

Yes. The only option is to add it. I can see the appeal of that. I think we could make the case for the breaking change (and for 2.1 would be a good time given #9933), but I'd want someone to champion that (as I haven't got time/bandwidth/energy for the flack/discussion).

I republished my branch in case someone wants to drive this forward: I'm happy to finish the PR, but I don't want to do the politics 😃.

@rpkilby
Copy link

rpkilby commented Jun 8, 2018

I feel a bit silly, but for such a small change, I'm finding myself quite strongly opposed to it. The utility of the settings short option seems marginal at best, and I don't think the breaking change is worth the tradeoff.

  • In my experience, it's not common to use --settings in day to day use (where a -s shorthand would be most relevant). I've tended to use --settings in combination with supervisor or other cases where the command is written to a config file and ran indirectly.
  • If for whatever reason I need to use --settings and it's clumsy/annoying to keep repeating it, I just set the DJANGO_SETTINGS_MODULE environment variable (possibly with autoenv or direnv).
  • In terms of starting characters for words in the English language, "s" is the 5th most common, representing about ~6.5% of all words. In projects I've worked on, I have a tendency to expose administrative functions as management commands. Losing this short option would be annoying.

@carltongibson
Copy link
Member Author

Losing this short option would be annoying.

I think that's probably the swinger. No doubt loads of people would be affected.

@carltongibson carltongibson deleted the 21/settings-short-option branch May 12, 2021 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants