snowflake-cli-labs 2.5.0rc0__py3-none-any.whl → 2.5.0rc2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snowflake/cli/__about__.py +1 -1
- snowflake/cli/api/utils/definition_rendering.py +9 -6
- snowflake/cli/api/utils/models.py +18 -0
- snowflake/cli/plugins/nativeapp/artifacts.py +1 -1
- snowflake/cli/plugins/nativeapp/codegen/snowpark/callback_source.py.jinja +1 -1
- {snowflake_cli_labs-2.5.0rc0.dist-info → snowflake_cli_labs-2.5.0rc2.dist-info}/METADATA +1 -1
- {snowflake_cli_labs-2.5.0rc0.dist-info → snowflake_cli_labs-2.5.0rc2.dist-info}/RECORD +10 -10
- {snowflake_cli_labs-2.5.0rc0.dist-info → snowflake_cli_labs-2.5.0rc2.dist-info}/WHEEL +0 -0
- {snowflake_cli_labs-2.5.0rc0.dist-info → snowflake_cli_labs-2.5.0rc2.dist-info}/entry_points.txt +0 -0
- {snowflake_cli_labs-2.5.0rc0.dist-info → snowflake_cli_labs-2.5.0rc2.dist-info}/licenses/LICENSE +0 -0
snowflake/cli/__about__.py
CHANGED
|
@@ -18,11 +18,12 @@ import copy
|
|
|
18
18
|
import os
|
|
19
19
|
from typing import Any, Optional
|
|
20
20
|
|
|
21
|
-
from jinja2 import Environment,
|
|
21
|
+
from jinja2 import Environment, nodes
|
|
22
22
|
from packaging.version import Version
|
|
23
23
|
from snowflake.cli.api.exceptions import CycleDetectedError, InvalidTemplate
|
|
24
|
-
from snowflake.cli.api.utils.dict_utils import
|
|
24
|
+
from snowflake.cli.api.utils.dict_utils import traverse
|
|
25
25
|
from snowflake.cli.api.utils.graph import Graph, Node
|
|
26
|
+
from snowflake.cli.api.utils.models import EnvironWithDefinedDictFallback
|
|
26
27
|
from snowflake.cli.api.utils.rendering import CONTEXT_KEY, get_snowflake_cli_jinja_env
|
|
27
28
|
from snowflake.cli.api.utils.types import Context, Definition
|
|
28
29
|
|
|
@@ -146,7 +147,7 @@ class TemplateVar:
|
|
|
146
147
|
|
|
147
148
|
Returns the value in that location.
|
|
148
149
|
|
|
149
|
-
Raise
|
|
150
|
+
Raise InvalidTemplate if the variable is None or not found.
|
|
150
151
|
"""
|
|
151
152
|
current_dict_level = context
|
|
152
153
|
for key in self._vars_chain:
|
|
@@ -154,12 +155,12 @@ class TemplateVar:
|
|
|
154
155
|
not isinstance(current_dict_level, dict)
|
|
155
156
|
or key not in current_dict_level
|
|
156
157
|
):
|
|
157
|
-
raise
|
|
158
|
+
raise InvalidTemplate(f"Could not find template variable {self.key}")
|
|
158
159
|
current_dict_level = current_dict_level[key]
|
|
159
160
|
|
|
160
161
|
value = current_dict_level
|
|
161
162
|
if value is None or isinstance(value, (dict, list)):
|
|
162
|
-
raise
|
|
163
|
+
raise InvalidTemplate(
|
|
163
164
|
f"Template variable {self.key} does not contain a valid value"
|
|
164
165
|
)
|
|
165
166
|
|
|
@@ -263,6 +264,8 @@ def render_definition_template(original_definition: Definition) -> Definition:
|
|
|
263
264
|
definition,
|
|
264
265
|
update_action=lambda val: template_env.render(val, final_context),
|
|
265
266
|
)
|
|
266
|
-
|
|
267
|
+
|
|
268
|
+
current_env = definition.setdefault("env", {})
|
|
269
|
+
definition["env"] = EnvironWithDefinedDictFallback(current_env)
|
|
267
270
|
|
|
268
271
|
return definition
|
|
@@ -17,8 +17,26 @@ from __future__ import annotations
|
|
|
17
17
|
import os
|
|
18
18
|
from typing import Any, Dict
|
|
19
19
|
|
|
20
|
+
from snowflake.cli.api.exceptions import InvalidTemplate
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _validate_env(current_env: dict):
|
|
24
|
+
if not isinstance(current_env, dict):
|
|
25
|
+
raise InvalidTemplate(
|
|
26
|
+
"env section in project definition file should be a mapping"
|
|
27
|
+
)
|
|
28
|
+
for variable, value in current_env.items():
|
|
29
|
+
if value is None or isinstance(value, (dict, list)):
|
|
30
|
+
raise InvalidTemplate(
|
|
31
|
+
f"Variable {variable} in env section or project definition file should be a scalar"
|
|
32
|
+
)
|
|
33
|
+
|
|
20
34
|
|
|
21
35
|
class EnvironWithDefinedDictFallback(Dict):
|
|
36
|
+
def __init__(self, dict_input: dict):
|
|
37
|
+
_validate_env(dict_input)
|
|
38
|
+
super().__init__(dict_input)
|
|
39
|
+
|
|
22
40
|
def __getattr__(self, item):
|
|
23
41
|
try:
|
|
24
42
|
return self[item]
|
|
@@ -541,7 +541,7 @@ def symlink_or_copy(src: Path, dst: Path, deploy_root: Path) -> None:
|
|
|
541
541
|
relative_root = Path(root).relative_to(absolute_src)
|
|
542
542
|
absolute_root_in_deploy = Path(dst, relative_root)
|
|
543
543
|
absolute_root_in_deploy.mkdir(parents=True, exist_ok=True)
|
|
544
|
-
for file in files:
|
|
544
|
+
for file in sorted(files):
|
|
545
545
|
absolute_file_in_project = Path(absolute_src, relative_root, file)
|
|
546
546
|
absolute_file_in_deploy = Path(absolute_root_in_deploy, file)
|
|
547
547
|
symlink_or_copy(
|
|
@@ -169,7 +169,7 @@ try:
|
|
|
169
169
|
import importlib
|
|
170
170
|
with contextlib.redirect_stdout(None):
|
|
171
171
|
with contextlib.redirect_stderr(None):
|
|
172
|
-
__snowflake_internal_spec = importlib.util.spec_from_file_location("<string>", "{{py_file}}")
|
|
172
|
+
__snowflake_internal_spec = importlib.util.spec_from_file_location("<string>", r"{{py_file}}")
|
|
173
173
|
__snowflake_internal_module = importlib.util.module_from_spec(__snowflake_internal_spec)
|
|
174
174
|
__snowflake_internal_spec.loader.exec_module(__snowflake_internal_module)
|
|
175
175
|
except Exception as exc: # Catch any error
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
snowflake/cli/__about__.py,sha256=
|
|
1
|
+
snowflake/cli/__about__.py,sha256=9s_AeTZSPyjs8hb8BWhppIxqSlppSykJpB9s_qoRQ1A,636
|
|
2
2
|
snowflake/cli/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
3
3
|
snowflake/cli/api/__init__.py,sha256=kD6lYv5et7QJvW7vzvLN9p2ibfD7pjh9KRWsp2QoYqo,1330
|
|
4
4
|
snowflake/cli/api/cli_global_context.py,sha256=_rGbRUonigVH09w-HnlSiIioZtPk5pe7goeuFMIqENo,10424
|
|
@@ -50,11 +50,11 @@ snowflake/cli/api/project/schemas/streamlit/__init__.py,sha256=uGA_QRGW3iGwaegpF
|
|
|
50
50
|
snowflake/cli/api/project/schemas/streamlit/streamlit.py,sha256=9rf6Ose7cS1PfZoNvVyzTC_8AiRD4udGFBHpB3tu2M4,1725
|
|
51
51
|
snowflake/cli/api/utils/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
52
52
|
snowflake/cli/api/utils/cursor.py,sha256=JlyUG5b4EXii71Dm7qiTdptjwIsOOmEv2QmZA1cY8NQ,1222
|
|
53
|
-
snowflake/cli/api/utils/definition_rendering.py,sha256=
|
|
53
|
+
snowflake/cli/api/utils/definition_rendering.py,sha256=dC-K8EPDu_ZZS0tmedQXEhGaMnlyaVedwgjZPxnGnME,10263
|
|
54
54
|
snowflake/cli/api/utils/dict_utils.py,sha256=8vb9EyiT8gNHCtPNfE1S-0WcWdP6G_kiwJ-aizu3Pzs,2799
|
|
55
55
|
snowflake/cli/api/utils/error_handling.py,sha256=etIGdS8kd9APgyeUecnY2XMivDORSRV8q-WuBtpriZY,708
|
|
56
56
|
snowflake/cli/api/utils/graph.py,sha256=XZgcTySyS1je9ARdPWqJyrfzuqFBNt9SSLnGeE2na8M,3045
|
|
57
|
-
snowflake/cli/api/utils/models.py,sha256=
|
|
57
|
+
snowflake/cli/api/utils/models.py,sha256=iRTr_wOOCqXSD6ml6fxPrdAKC1650S4qluD43cT6NGg,1818
|
|
58
58
|
snowflake/cli/api/utils/naming_utils.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
59
59
|
snowflake/cli/api/utils/path_utils.py,sha256=ru0jgw6Ur5zhqpHhj_eAqcaJdrgEgr3bC7Z02FnQV18,1218
|
|
60
60
|
snowflake/cli/api/utils/rendering.py,sha256=6AcxuC7BkweXtMOjQ3ghVjMl2V-u9KDK2zhUp0JkFRU,4358
|
|
@@ -101,7 +101,7 @@ snowflake/cli/plugins/git/commands.py,sha256=iD-8smP3BqHPgx9vx3WlM0MtrJQ2Fmv5FGD
|
|
|
101
101
|
snowflake/cli/plugins/git/manager.py,sha256=1viE-Zq13okQDtOIqAIrzo0ZSgJ77V8DQAhjo9cecQA,2856
|
|
102
102
|
snowflake/cli/plugins/git/plugin_spec.py,sha256=RgGZ744MYXfBMnR1-f11c9_n5XoH7GaIsPocrazq52A,991
|
|
103
103
|
snowflake/cli/plugins/nativeapp/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
104
|
-
snowflake/cli/plugins/nativeapp/artifacts.py,sha256=
|
|
104
|
+
snowflake/cli/plugins/nativeapp/artifacts.py,sha256=KntAir6StSLHoADAiYwnO7UfrwyCaVCXa2ZNdhDnsWg,26950
|
|
105
105
|
snowflake/cli/plugins/nativeapp/commands.py,sha256=OWZ1ABDtRB1Cl5KM5gyZCQNC1dU7w5OskoNt0N_viKg,12561
|
|
106
106
|
snowflake/cli/plugins/nativeapp/common_flags.py,sha256=7OUXprC2n3B0a9gGTj4AezHaJyt8-C7vgRI5q9l-UXE,1610
|
|
107
107
|
snowflake/cli/plugins/nativeapp/constants.py,sha256=u7eB8gjVZ_HZjPIZ7hux76wS8F76S4J0ze5D7K28zTc,1168
|
|
@@ -117,7 +117,7 @@ snowflake/cli/plugins/nativeapp/codegen/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgO
|
|
|
117
117
|
snowflake/cli/plugins/nativeapp/codegen/artifact_processor.py,sha256=OLYD01rZAMC_PwBeibLK3OU6S5xFVNWpDDs9y1iaLDY,1868
|
|
118
118
|
snowflake/cli/plugins/nativeapp/codegen/compiler.py,sha256=MLoacXP1IRwvTzjkxc6e8JIoFLDHkP_Cj8qne0EQOBU,4878
|
|
119
119
|
snowflake/cli/plugins/nativeapp/codegen/sandbox.py,sha256=oxHNiDD9Vp2vFstb8tZwgIhoIoOj3Qlv_fLVOn9fNII,8243
|
|
120
|
-
snowflake/cli/plugins/nativeapp/codegen/snowpark/callback_source.py.jinja,sha256=
|
|
120
|
+
snowflake/cli/plugins/nativeapp/codegen/snowpark/callback_source.py.jinja,sha256=JiMs2NKhtFFvKotQFU61wpKBAqPAfBthGsdT1aZgY-c,7531
|
|
121
121
|
snowflake/cli/plugins/nativeapp/codegen/snowpark/extension_function_utils.py,sha256=E2bQFVmiC7MdRCWBtWo3BjzcBUr-9BBzwKduWmZdXdw,7626
|
|
122
122
|
snowflake/cli/plugins/nativeapp/codegen/snowpark/models.py,sha256=xPC7Igbyo_A6Su4xWeXNYV421uefMqHpQbwFGG8AprI,2225
|
|
123
123
|
snowflake/cli/plugins/nativeapp/codegen/snowpark/python_processor.py,sha256=33Vc6InyEM59nXxeMIB4KPOVZjIRQsrFdSUgihFK7nk,20374
|
|
@@ -199,8 +199,8 @@ snowflake/cli/templates/default_streamlit/snowflake.yml,sha256=yWFU-vqJ7Z17K3loU
|
|
|
199
199
|
snowflake/cli/templates/default_streamlit/streamlit_app.py,sha256=BtWuwdkgcMiYt21ghyi6Y1b_ITcIunN13ulUknvQbgI,688
|
|
200
200
|
snowflake/cli/templates/default_streamlit/common/hello.py,sha256=3kZSJggAWSYgi06NuI_5USV06mcCOBEzzz2DYeNGpc0,617
|
|
201
201
|
snowflake/cli/templates/default_streamlit/pages/my_page.py,sha256=wj2nMJmpAH_e9hOHoAUxyG4q17vyeVdnBtaXv_5KG24,628
|
|
202
|
-
snowflake_cli_labs-2.5.
|
|
203
|
-
snowflake_cli_labs-2.5.
|
|
204
|
-
snowflake_cli_labs-2.5.
|
|
205
|
-
snowflake_cli_labs-2.5.
|
|
206
|
-
snowflake_cli_labs-2.5.
|
|
202
|
+
snowflake_cli_labs-2.5.0rc2.dist-info/METADATA,sha256=cFJ5avP9eVi3CYn4VB2OkJ17l6okOrgkIdBrhPR_My4,17543
|
|
203
|
+
snowflake_cli_labs-2.5.0rc2.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
|
204
|
+
snowflake_cli_labs-2.5.0rc2.dist-info/entry_points.txt,sha256=_qdnT44fYFbH78kb6Em5jr2_26amIg3UIAvSdmqT6TY,57
|
|
205
|
+
snowflake_cli_labs-2.5.0rc2.dist-info/licenses/LICENSE,sha256=mJMA3Uz2AbjU_kVggo1CAx01XhBsI7BSi2H7ggUg_-c,11344
|
|
206
|
+
snowflake_cli_labs-2.5.0rc2.dist-info/RECORD,,
|
|
File without changes
|
{snowflake_cli_labs-2.5.0rc0.dist-info → snowflake_cli_labs-2.5.0rc2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{snowflake_cli_labs-2.5.0rc0.dist-info → snowflake_cli_labs-2.5.0rc2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|