Skip to content

Commit

Permalink
AirbyteLib: detect REPL and disable Rich.Live if so (#34782)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers authored Feb 6, 2024
1 parent 22b63c7 commit 6e8b87f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion airbyte-lib/airbyte_lib/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import datetime
import math
import sys
import time
from contextlib import suppress
from typing import cast
Expand All @@ -14,6 +15,8 @@
from rich.markdown import Markdown as RichMarkdown


IS_REPL = hasattr(sys, "ps1") # True if we're in a Python REPL, in which case we can use Rich.

try:
IS_NOTEBOOK = True
from IPython import display as ipy_display
Expand Down Expand Up @@ -93,7 +96,7 @@ def __init__(self) -> None:
self.last_update_time: float | None = None

self.rich_view: RichLive | None = None
if not IS_NOTEBOOK:
if not IS_NOTEBOOK and not IS_REPL:
# If we're in a terminal, use a Rich view to display the progress updates.
self.rich_view = RichLive()
try:
Expand Down

0 comments on commit 6e8b87f

Please sign in to comment.