Skip to content

Conversation

kinuax
Copy link
Contributor

@kinuax kinuax commented May 9, 2024

The generated Markdown docs ignore the division given by rich_help_panel while listing the commands. This is a proposal to support it.

@kinuax kinuax marked this pull request as draft May 9, 2024 21:03
@kinuax
Copy link
Contributor Author

kinuax commented May 10, 2024

I added the tests to verify the cases with default (None, "", "Commands") and custom panel titles. All format, linting, and tests pass locally on 3.11. CI only breaks on 3.7 with a syntax error due to the walrus operator (introduced on 3.8). Having that Python 3.7's end of life was almost a year ago and that click dropped 3.7 support 9 months ago, I wonder if this is a good moment to drop its support as well, I can take care of that before considering these changes.

@kinuax kinuax marked this pull request as ready for review May 10, 2024 13:34
@svlandeg svlandeg added feature New feature, enhancement or request p3 labels May 13, 2024
@kinuax kinuax changed the title Add support for rich_help_panel of commands in generated docs ✨ Add support for rich_help_panel of commands in generated docs May 13, 2024
@kinuax
Copy link
Contributor Author

kinuax commented May 17, 2024

As clarified at #830, click still supports 3.7 so I have refactored to avoid assignment expressions and pass 3.7 tests. Tests are updated too to verify mixed commands in same app and pass coverage. Ready to be reviewed.

@svlandeg svlandeg self-assigned this Aug 28, 2025
@svlandeg svlandeg marked this pull request as draft August 28, 2025 15:03
@svlandeg
Copy link
Member

Tricky merge conflict with #944, which has changed the order of commands being displayed. Should be all good and green again.

@svlandeg svlandeg marked this pull request as ready for review August 28, 2025 15:23
@kinuax
Copy link
Contributor Author

kinuax commented Aug 28, 2025

@svlandeg, many thanks for checking this out and fixing the merge conflicts! 🙏

Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a nice feature! I tested it with

typer docs_src/commands/help/tutorial006.py utils docs

to see the difference between master and this PR, and you nicely get the subdivision in the markdown with this PR:
image

whereas on master it's just:

image

There's a few issues with the code though. I'll comment inline, and will put the PR in draft as I push some changes.

@svlandeg svlandeg marked this pull request as draft September 9, 2025 13:06
@svlandeg svlandeg changed the title ✨ Add support for rich_help_panel of commands in generated docs ✨ Add support for rich_help_panel of commands in generated docs Sep 9, 2025
Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ready for review by Tiangolo.

One final remark I have here is that this code is not tested in our test suite without having rich installed. This is why the initial implementation didn't result in a test failure, while it really should have. #1297 should improve that situation (that said, I think these PRs can be reviewed/merged independently).

@svlandeg svlandeg marked this pull request as ready for review September 9, 2025 14:42
@svlandeg svlandeg removed their assignment Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature, enhancement or request p3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants