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

[REQUEST] Increase default terminal width in GitHub Actions #2769

Closed
samuelcolvin opened this issue Jan 22, 2023 · 7 comments
Closed

[REQUEST] Increase default terminal width in GitHub Actions #2769

samuelcolvin opened this issue Jan 22, 2023 · 7 comments

Comments

@samuelcolvin
Copy link

Have you checked the issues for a similar suggestions?

yes

How would you improve Rich?

Currently the terminal width is very narrow in github actions, making content, particuarly in tables hard to read, or missing completely.

Example: https://github.com/pydantic/pydantic-core/actions/runs/3933397938/jobs/6727055614

Screenshot 2023-01-22 at 12 31 56

Would be great if rich could detect that it's being used in github actions and use a wider default width.


Otherwise/until this is changed, is there a env var I can see to increase the default?

@github-actions
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@samuelcolvin
Copy link
Author

(Comes from use of rich via pytest-pretty)

@willmcgugan
Copy link
Collaborator

You can set the COLUMNS env var. There’s no other way for Rich to detect the width when not writing to a real tty

@samuelcolvin
Copy link
Author

I understand you can't detect the width, but you could detect with a high detect of confidence that you're in a github action, and increase the default width?

@willmcgugan
Copy link
Collaborator

Increase it to what though? There’s no optional width for everyone. Any value I pick will be wrong for someone. And if I go down road route I’ll soon have a load of spaghetti logic to try and detect what CI system is in use.

I think think is best left to the user. Columns being a standard env var that might already be set.

@samuelcolvin
Copy link
Author

I get that, but I think github actions is so widely used that something like

# GitHub Actions is extremely widely used, so we make an exception for it
# and increase the default terminal width
if os.getenv('GITHUB_ACTION'):
    default_columns = 120
else:
    default_columns = ...

Wouldn't be too crazy.

But I also understand if you don't want to.


For anyone else coming to this, adding the following the to the top level of your workflow file helps rich and also appears to help pytest.

env:
  COLUMNS: 120

@github-actions
Copy link

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

feryardiant added a commit to feryardiant/test-deploy that referenced this issue Sep 19, 2024
see Textualize/rich#2769 (comment)

Signed-off-by: Fery Wardiyanto <ferywardiyanto@gmail.com>
feryardiant added a commit to feryardiant/test-deploy that referenced this issue Sep 19, 2024
see Textualize/rich#2769 (comment)

Signed-off-by: Fery Wardiyanto <ferywardiyanto@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants