wmill 1.149.0__py3-none-any.whl → 1.151.0__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.
Potentially problematic release.
This version of wmill might be problematic. Click here for more details.
wmill/client.py
CHANGED
|
@@ -2,6 +2,7 @@ from typing import Any, Union, Dict
|
|
|
2
2
|
from typing import Generic, TypeVar, TypeAlias
|
|
3
3
|
|
|
4
4
|
import os
|
|
5
|
+
import json
|
|
5
6
|
|
|
6
7
|
from time import sleep
|
|
7
8
|
from windmill_api.models.whoami_response_200 import WhoamiResponse200
|
|
@@ -24,10 +25,6 @@ mysql = TypeAlias
|
|
|
24
25
|
bigquery = TypeAlias
|
|
25
26
|
|
|
26
27
|
|
|
27
|
-
VAR_RESOURCE_PREFIX = "$var:"
|
|
28
|
-
RES_RESOURCE_PREFIX = "$res:"
|
|
29
|
-
|
|
30
|
-
|
|
31
28
|
class JobStatus(Enum):
|
|
32
29
|
WAITING = 1
|
|
33
30
|
RUNNING = 2
|
|
@@ -160,12 +157,19 @@ def get_resource(path: str | None = None, none_if_undefined: bool = False) -> An
|
|
|
160
157
|
"""
|
|
161
158
|
Returns the resource at a given path
|
|
162
159
|
"""
|
|
163
|
-
from windmill_api.api.resource import
|
|
160
|
+
from windmill_api.api.resource import (
|
|
161
|
+
get_resource_value_interpolated as get_resource_api,
|
|
162
|
+
)
|
|
164
163
|
|
|
165
164
|
path = path or get_state_path()
|
|
166
165
|
parsed = get_resource_api.sync_detailed(
|
|
167
166
|
workspace=get_workspace(), path=path, client=create_client()
|
|
168
|
-
)
|
|
167
|
+
)
|
|
168
|
+
try:
|
|
169
|
+
parsed = json.loads(parsed.content.decode("utf-8"))
|
|
170
|
+
except:
|
|
171
|
+
parsed = None
|
|
172
|
+
|
|
169
173
|
if parsed is None:
|
|
170
174
|
if none_if_undefined:
|
|
171
175
|
return None
|
|
@@ -174,11 +178,7 @@ def get_resource(path: str | None = None, none_if_undefined: bool = False) -> An
|
|
|
174
178
|
f"Resource at path {path} does not exist or you do not have read permissions on it"
|
|
175
179
|
)
|
|
176
180
|
|
|
177
|
-
|
|
178
|
-
return None
|
|
179
|
-
|
|
180
|
-
raw = parsed.value
|
|
181
|
-
return _transform_leaf(raw)
|
|
181
|
+
return parsed
|
|
182
182
|
|
|
183
183
|
|
|
184
184
|
def whoami() -> WhoamiResponse200 | None:
|
|
@@ -286,7 +286,7 @@ def get_variable(path: str) -> str:
|
|
|
286
286
|
"""
|
|
287
287
|
Returns the variable at a given path as a string
|
|
288
288
|
"""
|
|
289
|
-
from windmill_api.api.variable import
|
|
289
|
+
from windmill_api.api.variable import get_variable_value as get_variable_api
|
|
290
290
|
|
|
291
291
|
res = get_variable_api.sync_detailed(
|
|
292
292
|
workspace=get_workspace(), path=path, client=create_client()
|
|
@@ -296,7 +296,7 @@ def get_variable(path: str) -> str:
|
|
|
296
296
|
f"Variable at path {path} does not exist or you do not have read permissions on it"
|
|
297
297
|
)
|
|
298
298
|
|
|
299
|
-
return res
|
|
299
|
+
return res
|
|
300
300
|
|
|
301
301
|
|
|
302
302
|
def set_variable(path: str, value: str) -> None:
|
|
@@ -356,23 +356,3 @@ def get_resume_urls(approver: str | None = None) -> Dict:
|
|
|
356
356
|
return res.parsed.to_dict()
|
|
357
357
|
else:
|
|
358
358
|
raise Exception("Failed to get resume urls")
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
def _transform_leaves(d: Dict[str, Any]) -> Dict[str, Any]:
|
|
362
|
-
return {k: _transform_leaf(v) for k, v in d.items()}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
def _transform_leaf(v: Any) -> Any:
|
|
366
|
-
if isinstance(v, dict):
|
|
367
|
-
return _transform_leaves(v) # type: ignore
|
|
368
|
-
elif isinstance(v, str):
|
|
369
|
-
if v.startswith(VAR_RESOURCE_PREFIX):
|
|
370
|
-
var_name = v[len(VAR_RESOURCE_PREFIX) :]
|
|
371
|
-
return get_variable(var_name)
|
|
372
|
-
if v.startswith(RES_RESOURCE_PREFIX):
|
|
373
|
-
res_name = v[len(RES_RESOURCE_PREFIX) :]
|
|
374
|
-
return get_resource(res_name)
|
|
375
|
-
else:
|
|
376
|
-
return v
|
|
377
|
-
else:
|
|
378
|
-
return v
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wmill
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.151.0
|
|
4
4
|
Summary: A client library for accessing Windmill server wrapping the Windmill client API
|
|
5
5
|
Home-page: https://windmill.dev
|
|
6
6
|
License: Apache-2.0
|
|
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
-
Requires-Dist: windmill-api (>=1.
|
|
17
|
+
Requires-Dist: windmill-api (>=1.151.0,<2.0.0)
|
|
18
18
|
Project-URL: Documentation, https://windmill.dev
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
wmill/__init__.py,sha256=d0Q6Fn44e7wFfLabDOBxpcJ1DPKWlFunGYDUBmO-4hA,22
|
|
2
|
+
wmill/client.py,sha256=In3qWF3opMsE3t38dUmEjaBKEtuBZI0esShITDciyVA,9938
|
|
3
|
+
wmill/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
|
|
4
|
+
wmill-1.151.0.dist-info/WHEEL,sha256=vxFmldFsRN_Hx10GDvsdv1wroKq8r5Lzvjp6GZ4OO8c,88
|
|
5
|
+
wmill-1.151.0.dist-info/METADATA,sha256=MJg0RKTrKnBrIr-VLAvGH5pMeru_WKvsojZeDEFCivk,1571
|
|
6
|
+
wmill-1.151.0.dist-info/RECORD,,
|
wmill-1.149.0.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
wmill/__init__.py,sha256=d0Q6Fn44e7wFfLabDOBxpcJ1DPKWlFunGYDUBmO-4hA,22
|
|
2
|
-
wmill/client.py,sha256=tZaPHcLyCttcg5eQ7pA2MaqgDfIUC-vIKV5Ty_LydT4,10579
|
|
3
|
-
wmill/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
|
|
4
|
-
wmill-1.149.0.dist-info/WHEEL,sha256=vxFmldFsRN_Hx10GDvsdv1wroKq8r5Lzvjp6GZ4OO8c,88
|
|
5
|
-
wmill-1.149.0.dist-info/METADATA,sha256=kzymAfvVucAW5BsEAADrf9kGprGwOkB4gko0Iw8oBbY,1571
|
|
6
|
-
wmill-1.149.0.dist-info/RECORD,,
|
|
File without changes
|