Skip to content

cli: refactor nested argparse argument groups #4651

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

Merged
merged 1 commit into from
Jul 12, 2022

Conversation

bastimeyer
Copy link
Member

  • Use a custom mapping of parent->child argument group relations
    instead of calling group.add_argument_group() for creating
    a tree structure of argument groups (deprecated in Python 3.11)
  • Override parser.add_argument_group() and add the parent keyword
    argument to nested group defintions
  • Update custom --help format output
  • Update the argparser Sphinx extension
  • Fix tests

Resolves #4648

Help text stays the same, and so do the docs (see the preview build).

$ diff \
    <(~/venv/streamlink-310/bin/streamlink --help) \
    <(~/venv/streamlink-311/bin/streamlink --help)
$ echo $?
0

- Use a custom mapping of parent->child argument group relations
  instead of calling `group.add_argument_group()` for creating
  a tree structure of argument groups (deprecated in Python 3.11)
- Override `parser.add_argument_group()` and add the `parent` keyword
  for being able to have nested argument group defintions
- Update custom `--help` format output
- Update the argparser Sphinx extension
- Fix tests
@bastimeyer bastimeyer added the CLI label Jul 12, 2022
@gravyboat gravyboat merged commit 5985f08 into streamlink:master Jul 12, 2022
@bastimeyer bastimeyer deleted the cli/nested-argparse-groups branch July 12, 2022 16:48
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Jul 18, 2022
- Use a custom mapping of parent->child argument group relations
  instead of calling `group.add_argument_group()` for creating
  a tree structure of argument groups (deprecated in Python 3.11)
- Override `parser.add_argument_group()` and add the `parent` keyword
  for being able to have nested argument group defintions
- Update custom `--help` format output
- Update the argparser Sphinx extension
- Fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cli.argparser: nested argparse groups will be deprecated in python 3.11
2 participants