Expose diagnose.report as a function add a little more info to hint at environment

This commit is contained in:
Darren Burns 2022-02-04 13:51:58 +00:00
parent 94273ee703
commit 731f984822
2 changed files with 34 additions and 4 deletions

View file

@ -2,7 +2,8 @@
omit = rich/jupyter.py
rich/_windows.py
rich/_timer.py
rich/diagnose.py
[report]
exclude_lines =
pragma: no cover

View file

@ -1,6 +1,35 @@
if __name__ == "__main__": # pragma: no cover
from rich.console import Console
from rich import inspect
import os
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
def report(): # pragma: no cover
"""Print a report to the terminal with debugging information"""
console = Console()
inspect(console)
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}"
),
),
)
console.print(f'platform="{platform.system()}"')
if __name__ == "__main__": # pragma: no cover
console = Console()
inspect(console)