Skip to content

Commit

Permalink
Add more diagnose.report env variables, invoke from __main__
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Feb 7, 2022
1 parent bcbaed2 commit c8c2cf1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
30 changes: 15 additions & 15 deletions rich/diagnose.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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
Expand All @@ -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()

0 comments on commit c8c2cf1

Please sign in to comment.