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

✨ Improve column help display, ensure commands column width is the same on all panels #567

Merged
merged 6 commits into from
Apr 8, 2024

Conversation

ssbarnea
Copy link
Contributor

@ssbarnea ssbarnea commented Mar 13, 2023

Previously the width of table columns for commands in each panel used
auto-width, making hard to read the commands.

Before

After

@github-actions
Copy link

📝 Docs preview for commit f70ff2c at: https://640f3954f300560548fa88fa--typertiangolo.netlify.app

Previously the width of table columns for commands in each panel used
auto-width, making hard to read the commands.
@github-actions
Copy link

📝 Docs preview for commit 0e5fa16 at: https://640f39bbca7db60a79d17d5a--typertiangolo.netlify.app

@ssbarnea ssbarnea changed the title Ensure commands column is the same on all panels Ensure commands column width is the same on all panels Mar 13, 2023
@Skyler-Altol
Copy link

Skyler-Altol commented Jul 22, 2023

This is awesome, @tiangolo can we get this merged please? A bunch of people at my work have not liked the fact that the panels didn't align in some of the CLI utilities we built that use Typer, and that help text for commands was sometimes wayyyy off to the far right instead of being close to the command name as you'd expect. This PR fixes that and all tests have passed.

@Tremeschin
Copy link

Adding my two cents in;

I've been waiting ages for this to be accepted 😭, I discovered this PR near the time it was created after my research advisor pointed the "misalignment" on a meeting last year showcasing an internal management tool; Even thought I've some level of OCD myself, I've never really noticed this, but now I can't unsee it 😂

There's a workaround to install the PR as a git dependency on pip/poetry with..

  • pip install git+https://github.com/tiangolo/typer.git@refs/pull/567/head

..but, magically, some PCs on the lab didn't have git, and future-proofing documentation for non tech-savy students on multiple OSs wasn't ideal, and stuff could easily break on their hands I reckon.

The CLIs are much more elegant and professional with the alignment, please @tiangolo, consider merging this PR ❤️

@svlandeg svlandeg added feature New feature, enhancement or request p3 labels Mar 1, 2024
@svlandeg
Copy link
Member

svlandeg commented Mar 1, 2024

This looks great, thanks for the contribution! We'll get this reviewed soonish.

@svlandeg
Copy link
Member

svlandeg commented Mar 8, 2024

[maintenance note] related PR: #489

@NikosAlexandris
Copy link

NikosAlexandris commented Mar 17, 2024

For some reason this downgrades to typer 0.7.0 here.

Update I just copied over the new file over the old file locally. It works. Looks nice. No idea why pip downgrades typer when install this PR.

@svlandeg
Copy link
Member

svlandeg commented Apr 5, 2024

No idea why pip downgrades typer when install this PR.

That's probably because this PR was created branching off an older version of master. I'm bringing it up-to-date now.

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 tested this with a slightly altered version of docs_src/commands/help/tutorial006.py (making the command names differ more in length) and I do think this change improves readability overall of the console output, as also demonstrated by the screenshots in the PR description.

typer/rich_utils.py Outdated Show resolved Hide resolved
typer/rich_utils.py Outdated Show resolved Hide resolved
@tiangolo tiangolo changed the title Ensure commands column width is the same on all panels ✨ Improve column help display, ensure commands column width is the same on all panels Apr 8, 2024
@tiangolo
Copy link
Member

tiangolo commented Apr 8, 2024

Awesome, thank you @ssbarnea! 🚀

Thanks for the discussion here everyone. ☕

Thanks for the help and review as always @svlandeg! 🙇

This will be available in the next few hours in Typer 0.12.2 🎉

@tiangolo tiangolo merged commit cfae1d2 into fastapi:master Apr 8, 2024
15 checks passed
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.

6 participants