Skip to content

Commit 9745d22

Browse files
committed
Replace NON_INTERACTIVE with CI
1 parent 1deb3f6 commit 9745d22

3 files changed

Lines changed: 8 additions & 13 deletions

File tree

docs/reference/configuration.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ It accepts the following values, which will cause SQLMesh to behave as if it wer
304304
- `google_colab` (Google Colab notebook)
305305
- `jupyter` (Jupyter notebook)
306306
- `debugger` (Debugging output)
307-
- `non_interactive` (environment without real-time interactivity, such as CI/CD)
308-
- `ci` (CI/CD environment, equivalent to `non_interactive`)
309-
307+
- `ci` (CI/CD or other non-interactive environment)
310308

311309
## Anonymized usage information
312310

sqlmesh/__init__.py

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

6060
@classmethod
6161
def get(cls) -> RuntimeEnv:
@@ -66,13 +66,10 @@ def get(cls) -> RuntimeEnv:
6666
"""
6767
runtime_env_var = os.getenv("SQLMESH_RUNTIME_ENVIRONMENT")
6868
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
7269
try:
7370
return RuntimeEnv(runtime_env_var)
7471
except ValueError:
75-
valid_values = [f'"{member.value}"' for member in RuntimeEnv] + ['"ci"']
72+
valid_values = [f'"{member.value}"' for member in RuntimeEnv]
7673
raise ValueError(
7774
f"Invalid SQLMESH_RUNTIME_ENVIRONMENT value: {runtime_env_var}. Must be one of {', '.join(valid_values)}."
7875
)
@@ -92,7 +89,7 @@ def get(cls) -> RuntimeEnv:
9289
return RuntimeEnv.DEBUGGER
9390

9491
if is_cicd_environment() or not is_interactive_environment():
95-
return RuntimeEnv.NON_INTERACTIVE
92+
return RuntimeEnv.CI
9693

9794
return RuntimeEnv.TERMINAL
9895

@@ -113,12 +110,12 @@ def is_google_colab(self) -> bool:
113110
return self == RuntimeEnv.GOOGLE_COLAB
114111

115112
@property
116-
def is_non_interactive(self) -> bool:
117-
return self == RuntimeEnv.NON_INTERACTIVE
113+
def is_ci(self) -> bool:
114+
return self == RuntimeEnv.CI
118115

119116
@property
120117
def is_notebook(self) -> bool:
121-
return not self.is_terminal and not self.is_non_interactive
118+
return not self.is_terminal and not self.is_ci
122119

123120

124121
def is_cicd_environment() -> bool:

sqlmesh/core/console.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3512,7 +3512,7 @@ def create_console(
35123512
RuntimeEnv.TERMINAL: TerminalConsole,
35133513
RuntimeEnv.GOOGLE_COLAB: NotebookMagicConsole,
35143514
RuntimeEnv.DEBUGGER: DebuggerTerminalConsole,
3515-
RuntimeEnv.NON_INTERACTIVE: MarkdownConsole,
3515+
RuntimeEnv.CI: MarkdownConsole,
35163516
}
35173517
rich_console_kwargs: t.Dict[str, t.Any] = {"theme": srich.theme}
35183518
if runtime_env.is_jupyter or runtime_env.is_google_colab:

0 commit comments

Comments
 (0)