Skip to content

Comments

📝 Add information about terminal width for testing output#1521

Open
mbergen wants to merge 3 commits intofastapi:masterfrom
mbergen:patch-1
Open

📝 Add information about terminal width for testing output#1521
mbergen wants to merge 3 commits intofastapi:masterfrom
mbergen:patch-1

Conversation

@mbergen
Copy link

@mbergen mbergen commented Feb 6, 2026

Followup for #1520:

Add a section about setting the terminal width for testing purposes using environment variables as read by Typer and Rich.

Add instructions for checking rich output and setting terminal width in testing.
@github-actions github-actions bot added the docs Improvements or additions to documentation label Feb 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

@svlandeg svlandeg self-assigned this Feb 6, 2026
@svlandeg svlandeg changed the title docs: Add information about terminal width for testing output 📝 Add information about terminal width for testing output Feb 16, 2026
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 users who read this might be a bit confused about COLUMNS vs. TERMINAL_WIDTH, when to use one and when the other.


/// tip

It is necessary to set these variables *before* importing a Typer app for testing.
Copy link
Member

@svlandeg svlandeg Feb 16, 2026

Choose a reason for hiding this comment

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

There's a difference between the two though, TERMINAL_WIDTH needs to be defined even before importing typer. COLUMNS can be set at runtime. Perhaps it would make sense to provide an example in the line of #1542.

Copy link
Author

Choose a reason for hiding this comment

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

I've clarified the tip to mention only TERMINAL_WIDTH.

I'm a bit confused about the PR you've linked; in my tests (and thats what started the discussion as well as this PR), COLUMNS has no effect on the output of a typer app with --help.
I'll test a bit more and add an example if i can reproduce the behavior of the linked PR

@svlandeg svlandeg removed their assignment Feb 16, 2026
@github-actions github-actions bot removed the waiting label Feb 17, 2026
@svlandeg svlandeg self-assigned this Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants