Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1917 from Textualize/diagnose
Expose diagnose.report as a function
- Loading branch information
Showing
4 changed files
with
47 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.pretty import Pretty | ||
|
||
|
||
def report() -> None: # pragma: no cover | ||
"""Print a report to the terminal with debugging information""" | ||
console = Console() | ||
inspect(console) | ||
features = get_windows_console_features() | ||
inspect(features) | ||
|
||
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 | ||
report() |