diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 723781db..6d6f4567 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -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 ``` diff --git a/rich/diagnose.py b/rich/diagnose.py index 7e8ad989..09c4e062 100644 --- a/rich/diagnose.py +++ b/rich/diagnose.py @@ -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()