← oracle_full

rich_3777

resolved RESOLVED UNSUBMITTED PASS · None tool calls · 0 s · Textualize/rich

Task input

TTY_INTERACTIVE env var

Adds a `TTY_INTERACTIVE` to disable things like progress bar / status spinners in CI

This adds to the new `TTY_COMPATIBLE` which enables styles even when the file is not technically a tty, as is the case in Github Actions. `TTY_INTERACTIVE=0` will remove superfluous animations and progress bars in the CI output.

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Patch

--- a/rich/console.py
+++ b/rich/console.py
@@ -22,18 +22,20 @@
     Dict,
     Iterable,
     List,
+    Literal,
     Mapping,
     NamedTuple,
     Optional,
+    Protocol,
     TextIO,
     Tuple,
     Type,
     Union,
     cast,
+    runtime_checkable,
 )
 
 from rich._null_file import NULL_FILE
-from typing import Literal, Protocol, runtime_checkable
 
 from . import errors, themes
 from ._emoji_replace import _emoji_replace
@@ -731,6 +733,14 @@ def __init__(
             if no_color is not None
             else self._environ.get("NO_COLOR", "") != ""
         )
+        if force_interactive is None:
+            tty_interactive = self._environ.get("TTY_INTERACTIVE", None)
+            if tty_interactive is not None:
+                if tty_interactive == "0":
+                    force_interactive = False
+                elif tty_interactive == "1":
+                    force_interactive = True
+
         self.is_interactive = (
             (self.is_terminal and not self.is_dumb_terminal)
             if force_interactive is None
--- a/rich/diagnose.py
+++ b/rich/diagnose.py
@@ -26,6 +26,7 @@ def report() -> None:  # pragma: no cover
         "TERM_PROGRAM",
         "TERM",
         "TTY_COMPATIBLE",
+        "TTY_INTERACTIVE",
         "VSCODE_VERBOSE_LOGGING",
     )
     env = {name: os.getenv(name) for name in env_names}

Test output

show
........................................................................ [ 72%]
...........................                                              [100%]
99 passed in 0.73s