Skip to content

Conversation

@harkabeeparolus
Copy link

@harkabeeparolus harkabeeparolus commented Dec 20, 2024

Provide an option for using Rich Panel.fit() aka Panel(expand=False) for help panels and errors. This was mentioned in discussion #607 and #680. To opt into this new, non-default behavior, just use:

app = typer.Typer(rich_expand=False)

I think this can look nicer on very wide terminals, especially for CLIs with few parameters, or short parameter descriptions, so I would prefer to have the option to choose this style sometimes.

Status

  • The code worked fine on all the examples I tried from the Typer tutorial
  • The documentation I added is perhaps a little sparse.
    • I don't know yet how to capture command output for the Typer docs, and I think an example is needed. Help?
  • I'm not sure how to write tests for this. Suggestions are welcome!

Example

rich_expand_example

@github-actions

This comment was marked as outdated.

@svlandeg svlandeg added the feature New feature, enhancement or request label Dec 26, 2024
@github-actions

This comment was marked as outdated.

@mshonichev
Copy link

Any chances to merge this PR soon? Can someone please restart CI?

@github-actions

This comment was marked as outdated.

@harkabeeparolus
Copy link
Author

harkabeeparolus commented Apr 9, 2025

Any chances to merge this PR soon?

I believe what's missing is test coverage for my new code and logic, which is not my strong suit. I would appreciate any help or suggestions on how to approach writing tests for this.

@github-actions github-actions bot added the conflicts Automatically generated when a PR has a merge conflict label Sep 1, 2025
@github-actions

This comment was marked as resolved.

@svlandeg svlandeg self-assigned this Nov 10, 2025
@github-actions github-actions bot removed the conflicts Automatically generated when a PR has a merge conflict label Nov 12, 2025
@github-actions
Copy link
Contributor

@harkabeeparolus
Copy link
Author

I updated the PR to remove merge conflicts, and:

  • Fixed a bug.
  • Added rich_expand to typer.run() for convenience. 😊

Remaining issues:

  • I still need help with test coverage. 😬 I'm not familiar enough with the codebase to understand what's going on.
    • I have manually tested this code on many of the code samples in the Typer documentation, and some of my own code, with no issues so far.
    • As far as I can tell, the only failing CI tests right now are on 3.8 and 3.9, which are end of life. Should we address these? 🤨
  • I have updated the text of the documentation, but I haven't made any screenshots, because I don't know what procedure you use to make them consistent with the rest of the docs.

@harkabeeparolus harkabeeparolus changed the title Panels Can Fit To Content 💄 Add option for panels to fit to content Nov 12, 2025
@harkabeeparolus harkabeeparolus marked this pull request as ready for review November 12, 2025 13:11
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants