You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to disable Rich for all 3rd party libraries that are installed within a virtual environment and only have it enabled where it is explicitly allowed?
My use case is that I would like to use Rich for a specific formatting task. But after installing it, many 3rd party libraries, like Typer, will automatically start using it if it can be imported. It might be possible to disable this behavior by tweaking the configuration of these libraries. But it is cumbersome as every library would typically need a custom configuration change. Moreover, some libraries might not offer a way to disable integration with Rich when it is installed.
I am aware of the TERM=dumb override. But that only disables colors. The frame-based text layout with borders around some blocks of text will still remain in place. In my opinion, this is the part which is the most distracting in some situations. The presence of these table-like layouts is the primary reason why I would like to turn integration with Rich off by default for every library.
It seems to me that one of the simpler ways to do so would be to prevent importing the rich package, e.g. by intentionally raising ImportError based on some configuration, e.g. an environment variable like RICH_AVAILABLE. Then it would be possible to keep Rich enabled for a particular piece of code and disabled everywhere else.
Can something like that be done with the current version of Rich? If not, are there any work-arounds which can be used to achieve the same or similar effect?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
Is there a way to disable Rich for all 3rd party libraries that are installed within a virtual environment and only have it enabled where it is explicitly allowed?
My use case is that I would like to use Rich for a specific formatting task. But after installing it, many 3rd party libraries, like Typer, will automatically start using it if it can be imported. It might be possible to disable this behavior by tweaking the configuration of these libraries. But it is cumbersome as every library would typically need a custom configuration change. Moreover, some libraries might not offer a way to disable integration with Rich when it is installed.
I am aware of the
TERM=dumb
override. But that only disables colors. The frame-based text layout with borders around some blocks of text will still remain in place. In my opinion, this is the part which is the most distracting in some situations. The presence of these table-like layouts is the primary reason why I would like to turn integration with Rich off by default for every library.It seems to me that one of the simpler ways to do so would be to prevent importing the
rich
package, e.g. by intentionally raisingImportError
based on some configuration, e.g. an environment variable likeRICH_AVAILABLE
. Then it would be possible to keep Rich enabled for a particular piece of code and disabled everywhere else.Can something like that be done with the current version of Rich? If not, are there any work-arounds which can be used to achieve the same or similar effect?
Beta Was this translation helpful? Give feedback.
All reactions