Add more diagnose.report env variables, invoke from __main__

This commit is contained in:
Darren Burns 2022-02-07 10:06:36 +00:00
parent bcbaed2b95
commit c8c2cf117f
2 changed files with 16 additions and 16 deletions

View File

@ -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
```

View File

@ -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()