-
Notifications
You must be signed in to change notification settings - Fork 43
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
Rich console width #1070
Rich console width #1070
Conversation
Looks good. This will be great. What worries me slightly is remembering to pass Would it make sense to define a console instance in console = Console(width=CONSOLE_WIDTH) or alternatively, if we need to make a new console each time, we could try: # log.py
def make_console(*args, **kwargs):
if "width" not in kwargs:
kwargs["width"] = CONSOLE_WIDTH
return Console(*args, **kwargs) and call that function in the webapi? |
yeah, that sounds better. In fact, internally rich has a similar logic https://github.com/Textualize/rich/blob/master/rich/__init__.py#L23-L36. Probably we can just use it whenever we need a console, just call |
a07a6db
to
ca80467
Compare
So, I realized we already create a console instance inside our logger, and decided just to retrieve it anytime we need a rich console. Do you see any issues with that? |
Not specifically. As long as it works properly when running different notebooks for example it should be fine. For example if notebook A and B are running simultaneously, their outputs shouldn't get mixed up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks! just a minor comment to explain the CONSOLE_WIDTH
variable for future reference and also could you add a CHANGELOG item? Thanks!
@@ -32,6 +32,8 @@ | |||
"CRITICAL": "red bold", | |||
} | |||
|
|||
CONSOLE_WIDTH = 80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you just add a comment above this saying that
# Width of the console used for rich logging (in characters).
Can you just double check that the logging level and verbose in web functions are still independent from one another. I think they should be but just to make sure. |
196d666
to
a55eb19
Compare
I'm excited to see the newly rendered docs after this fix :D |
Here's how we can adjust width of rich output, so that it should eliminate horizontal scroll bars in web documentation. Perhaps an alternative that we can consider is to define this width in the config, so that it could be changed as needed? What do you think? @tylerflex @momchil-flex