mirror of https://github.com/Textualize/rich.git
Add more diagnose.report env variables, invoke from __main__
This commit is contained in:
parent
bcbaed2b95
commit
c8c2cf117f
|
@ -25,7 +25,7 @@ I may ask you to copy and paste the output of the following commands. It may sav
|
|||
If you're using Rich in a terminal:
|
||||
|
||||
```
|
||||
python -c "from rich.diagnose import report; report()"
|
||||
python -m rich.diagnose
|
||||
pip freeze | grep rich
|
||||
```
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import platform
|
|||
from rich import inspect
|
||||
from rich.console import Console, get_windows_console_features
|
||||
from rich.panel import Panel
|
||||
from rich.text import Text
|
||||
from rich.pretty import Pretty
|
||||
|
||||
|
||||
def report() -> None: # pragma: no cover
|
||||
|
@ -14,22 +14,22 @@ def report() -> None: # pragma: no cover
|
|||
features = get_windows_console_features()
|
||||
inspect(features)
|
||||
|
||||
if console.is_jupyter:
|
||||
jpy_parent_pid = os.getenv("JPY_PARENT_PID")
|
||||
vs_code_verbose = os.getenv("VSCODE_VERBOSE_LOGGING")
|
||||
console.print(
|
||||
Panel(
|
||||
title="Jupyter Environment Hints",
|
||||
renderable=Text(
|
||||
f"JPY_PARENT_PID = {jpy_parent_pid}\n"
|
||||
f"VSCODE_VERBOSE_LOGGING = {vs_code_verbose}"
|
||||
),
|
||||
),
|
||||
)
|
||||
env_names = (
|
||||
"TERM",
|
||||
"COLORTERM",
|
||||
"CLICOLOR",
|
||||
"NO_COLOR",
|
||||
"TERM_PROGRAM",
|
||||
"COLUMNS",
|
||||
"LINES",
|
||||
"JPY_PARENT_PID",
|
||||
"VSCODE_VERBOSE_LOGGING",
|
||||
)
|
||||
env = {name: os.getenv(name) for name in env_names}
|
||||
console.print(Panel.fit((Pretty(env)), title="[b]Environment Variables"))
|
||||
|
||||
console.print(f'platform="{platform.system()}"')
|
||||
|
||||
|
||||
if __name__ == "__main__": # pragma: no cover
|
||||
console = Console()
|
||||
inspect(console)
|
||||
report()
|
||||
|
|
Loading…
Reference in New Issue