Skip to content

Commit 9861b6b

Browse files
committed
PR feedback
1 parent 1deb3f6 commit 9861b6b

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

sqlmesh/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class RuntimeEnv(str, Enum):
5555
GOOGLE_COLAB = "google_colab" # Not currently officially supported
5656
JUPYTER = "jupyter"
5757
DEBUGGER = "debugger"
58+
CI = "ci"
5859
NON_INTERACTIVE = "non_interactive" # CI or other envs that shouldn't use emojis
5960

6061
@classmethod
@@ -66,13 +67,10 @@ def get(cls) -> RuntimeEnv:
6667
"""
6768
runtime_env_var = os.getenv("SQLMESH_RUNTIME_ENVIRONMENT")
6869
if runtime_env_var:
69-
runtime_env_var = runtime_env_var.lower().strip().replace(" ", "").replace("-", "_")
70-
runtime_env_var = "non_interactive" if runtime_env_var == "ci" else runtime_env_var
71-
runtime_env_var = "debugger" if "debug" in runtime_env_var else runtime_env_var
7270
try:
7371
return RuntimeEnv(runtime_env_var)
7472
except ValueError:
75-
valid_values = [f'"{member.value}"' for member in RuntimeEnv] + ['"ci"']
73+
valid_values = [f'"{member.value}"' for member in RuntimeEnv]
7674
raise ValueError(
7775
f"Invalid SQLMESH_RUNTIME_ENVIRONMENT value: {runtime_env_var}. Must be one of {', '.join(valid_values)}."
7876
)
@@ -112,6 +110,10 @@ def is_jupyter(self) -> bool:
112110
def is_google_colab(self) -> bool:
113111
return self == RuntimeEnv.GOOGLE_COLAB
114112

113+
@property
114+
def is_ci(self) -> bool:
115+
return self == RuntimeEnv.CI
116+
115117
@property
116118
def is_non_interactive(self) -> bool:
117119
return self == RuntimeEnv.NON_INTERACTIVE

sqlmesh/core/console.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3512,6 +3512,7 @@ def create_console(
35123512
RuntimeEnv.TERMINAL: TerminalConsole,
35133513
RuntimeEnv.GOOGLE_COLAB: NotebookMagicConsole,
35143514
RuntimeEnv.DEBUGGER: DebuggerTerminalConsole,
3515+
RuntimeEnv.CI: MarkdownConsole,
35153516
RuntimeEnv.NON_INTERACTIVE: MarkdownConsole,
35163517
}
35173518
rich_console_kwargs: t.Dict[str, t.Any] = {"theme": srich.theme}

0 commit comments

Comments
 (0)