Repository navigation
Replies: 2 comments
|
Hi @bckohan! Thanks for the report. We've actually been thinking about this more and we do want to provide functionality that will allow users to more easily tweak how things are displayed, leaning on Rich, and ideally also supporting themes. AFAIK noone is working on this right now though. I'll briefly talk to Tiangolo to see what he thinks of the "quick fix" you propose here, but considering that there's a way for you to work around this for now, I think I'd be leaning towards waiting until we can deal with this properly rather than implementing some small ad-hoc things now (sorry, I know that's not a satisfying answer, but probably a realistic one...). |
|
Thanks @svlandeg I'll just add that I also have to use this same monkey patch to get access to the console object to make sphinxcontrib-typer work. There are reasons you might need access to the Rich console object beyond tweaking its construction parameters. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
First Check
Example Code
Description
django-typer invokes typer apps as subcommands of the django-admin. Some of the parent command's options tweak console settings (like color). I currently have to monkey patch typer to get access to the command console object.
Aside from my django-commons/django-typer#170 above, I think it would be generally useful to expose the Console object that Typer commands use to print their helps/exceptions. It could be a building block for supporting themes #1797
A per-app hook would also eliminate all of the synchronization problems when tweaking per-command console behavior outside of standalone mode (the main reason for my monkey patch).
The change could be quite simple, with only 2 components:
Add a per-app hook:
Typer(rich_console_factory=...)typer.rich_utils.get_rich_console(stderr=False, **console_kwargs)Thoughts? Happy to submit a PR
Operating System
macOS
Operating System Details
No response
Project Version
0.27.2
Python Version
3.14
Additional Context
No response
All reactions