wmill 1.227.1__py3-none-any.whl → 1.228.1__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/__init__.py
CHANGED
wmill/client.py
CHANGED
|
@@ -13,6 +13,8 @@ from typing import Dict, Any, Union, Literal
|
|
|
13
13
|
|
|
14
14
|
import httpx
|
|
15
15
|
|
|
16
|
+
from .s3_types import Boto3ConnectionSettings, DuckDbConnectionSettings, PolarsConnectionSettings
|
|
17
|
+
|
|
16
18
|
_client: "Windmill | None" = None
|
|
17
19
|
|
|
18
20
|
logger = logging.getLogger("windmill_client")
|
|
@@ -318,16 +320,17 @@ class Windmill:
|
|
|
318
320
|
self,
|
|
319
321
|
s3_resource_path: str = "",
|
|
320
322
|
none_if_undefined: bool = False,
|
|
321
|
-
) ->
|
|
323
|
+
) -> DuckDbConnectionSettings | None:
|
|
322
324
|
"""
|
|
323
325
|
Convenient helpers that takes an S3 resource as input and returns the settings necessary to
|
|
324
326
|
initiate an S3 connection from DuckDB
|
|
325
327
|
"""
|
|
326
328
|
try:
|
|
327
|
-
|
|
329
|
+
raw_obj = self.post(
|
|
328
330
|
f"/w/{self.workspace}/job_helpers/v2/duckdb_connection_settings",
|
|
329
331
|
json={} if s3_resource_path == "" else {"s3_resource_path": s3_resource_path},
|
|
330
332
|
).json()
|
|
333
|
+
return DuckDbConnectionSettings(raw_obj)
|
|
331
334
|
except JSONDecodeError as e:
|
|
332
335
|
if none_if_undefined:
|
|
333
336
|
return None
|
|
@@ -337,16 +340,17 @@ class Windmill:
|
|
|
337
340
|
self,
|
|
338
341
|
s3_resource_path: str = "",
|
|
339
342
|
none_if_undefined: bool = False,
|
|
340
|
-
) ->
|
|
343
|
+
) -> PolarsConnectionSettings | None:
|
|
341
344
|
"""
|
|
342
345
|
Convenient helpers that takes an S3 resource as input and returns the settings necessary to
|
|
343
346
|
initiate an S3 connection from Polars
|
|
344
347
|
"""
|
|
345
348
|
try:
|
|
346
|
-
|
|
349
|
+
raw_obj = self.post(
|
|
347
350
|
f"/w/{self.workspace}/job_helpers/v2/polars_connection_settings",
|
|
348
351
|
json={} if s3_resource_path == "" else {"s3_resource_path": s3_resource_path},
|
|
349
352
|
).json()
|
|
353
|
+
return PolarsConnectionSettings(raw_obj)
|
|
350
354
|
except JSONDecodeError as e:
|
|
351
355
|
if none_if_undefined:
|
|
352
356
|
return None
|
|
@@ -356,16 +360,28 @@ class Windmill:
|
|
|
356
360
|
self,
|
|
357
361
|
s3_resource_path: str = "",
|
|
358
362
|
none_if_undefined: bool = False,
|
|
359
|
-
) ->
|
|
363
|
+
) -> Boto3ConnectionSettings | None:
|
|
360
364
|
"""
|
|
361
365
|
Convenient helpers that takes an S3 resource as input and returns the settings necessary to
|
|
362
366
|
initiate an S3 connection using boto3
|
|
363
367
|
"""
|
|
364
368
|
try:
|
|
365
|
-
|
|
366
|
-
f"/w/{self.workspace}/job_helpers/v2/
|
|
369
|
+
s3_resource = self.post(
|
|
370
|
+
f"/w/{self.workspace}/job_helpers/v2/s3_resource_info",
|
|
367
371
|
json={} if s3_resource_path == "" else {"s3_resource_path": s3_resource_path},
|
|
368
372
|
).json()
|
|
373
|
+
endpoint_url_prefix = "https://" if s3_resource["useSSL"] else "http://"
|
|
374
|
+
boto3_settings = Boto3ConnectionSettings(
|
|
375
|
+
{
|
|
376
|
+
"endpoint_url": "{}{}".format(endpoint_url_prefix, s3_resource["endPoint"]),
|
|
377
|
+
"region_name": s3_resource["region"],
|
|
378
|
+
"use_ssl": s3_resource["useSSL"],
|
|
379
|
+
"aws_access_key_id": s3_resource["accessKey"],
|
|
380
|
+
"aws_secret_access_key": s3_resource["secretKey"],
|
|
381
|
+
# no need for path_style here as boto3 is clever enough to determine which one to use
|
|
382
|
+
}
|
|
383
|
+
)
|
|
384
|
+
return boto3_settings
|
|
369
385
|
except JSONDecodeError as e:
|
|
370
386
|
if none_if_undefined:
|
|
371
387
|
return None
|
|
@@ -574,7 +590,9 @@ def get_result(job_id: str, assert_result_is_not_none=True) -> Dict[str, Any]:
|
|
|
574
590
|
|
|
575
591
|
|
|
576
592
|
@init_global_client
|
|
577
|
-
def duckdb_connection_settings(
|
|
593
|
+
def duckdb_connection_settings(
|
|
594
|
+
s3_resource_path: str = "", none_if_undefined: bool = False
|
|
595
|
+
) -> DuckDbConnectionSettings | None:
|
|
578
596
|
"""
|
|
579
597
|
Convenient helpers that takes an S3 resource as input and returns the settings necessary to
|
|
580
598
|
initiate an S3 connection from DuckDB
|
|
@@ -585,7 +603,9 @@ def duckdb_connection_settings(s3_resource_path: str = "", none_if_undefined: bo
|
|
|
585
603
|
|
|
586
604
|
|
|
587
605
|
@init_global_client
|
|
588
|
-
def polars_connection_settings(
|
|
606
|
+
def polars_connection_settings(
|
|
607
|
+
s3_resource_path: str = "", none_if_undefined: bool = False
|
|
608
|
+
) -> PolarsConnectionSettings | None:
|
|
589
609
|
"""
|
|
590
610
|
Convenient helpers that takes an S3 resource as input and returns the settings necessary to
|
|
591
611
|
initiate an S3 connection from Polars
|
|
@@ -594,7 +614,9 @@ def polars_connection_settings(s3_resource_path: str = "", none_if_undefined: bo
|
|
|
594
614
|
|
|
595
615
|
|
|
596
616
|
@init_global_client
|
|
597
|
-
def boto3_connection_settings(
|
|
617
|
+
def boto3_connection_settings(
|
|
618
|
+
s3_resource_path: str = "", none_if_undefined: bool = False
|
|
619
|
+
) -> Boto3ConnectionSettings | None:
|
|
598
620
|
"""
|
|
599
621
|
Convenient helpers that takes an S3 resource as input and returns the settings necessary to
|
|
600
622
|
initiate an S3 connection using boto3
|
wmill/s3_types.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
class S3Object(dict):
|
|
2
|
+
s3: str
|
|
3
|
+
|
|
4
|
+
def __getattr__(self, attr):
|
|
5
|
+
return self[attr]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class S3FsClientKwargs(dict):
|
|
9
|
+
region_name: str
|
|
10
|
+
|
|
11
|
+
def __getattr__(self, attr):
|
|
12
|
+
return self[attr]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class S3FsArgs(dict):
|
|
16
|
+
endpoint_url: str
|
|
17
|
+
key: str
|
|
18
|
+
secret: str
|
|
19
|
+
use_ssl: bool
|
|
20
|
+
cache_regions: bool
|
|
21
|
+
client_kwargs: S3FsClientKwargs
|
|
22
|
+
|
|
23
|
+
def __getattr__(self, attr):
|
|
24
|
+
return self[attr]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class PolarsCloudOptions(dict):
|
|
28
|
+
aws_endpoint_url: str
|
|
29
|
+
aws_access_key_id: str
|
|
30
|
+
aws_secret_access_key: str
|
|
31
|
+
aws_region: bool
|
|
32
|
+
aws_allow_http: bool
|
|
33
|
+
|
|
34
|
+
def __getattr__(self, attr):
|
|
35
|
+
return self[attr]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class PolarsConnectionSettings(dict):
|
|
39
|
+
s3fs_args: S3FsArgs
|
|
40
|
+
polars_cloud_options: PolarsCloudOptions
|
|
41
|
+
|
|
42
|
+
def __getattr__(self, attr):
|
|
43
|
+
return self[attr]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class Boto3ConnectionSettings(dict):
|
|
47
|
+
endpoint_url: str
|
|
48
|
+
region_name: str
|
|
49
|
+
use_ssl: bool
|
|
50
|
+
aws_access_key_id: str
|
|
51
|
+
aws_secret_access_key: str
|
|
52
|
+
|
|
53
|
+
def __getattr__(self, attr):
|
|
54
|
+
return self[attr]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class DuckDbConnectionSettings(dict):
|
|
58
|
+
connection_settings_str: str
|
|
59
|
+
|
|
60
|
+
def __getattr__(self, attr):
|
|
61
|
+
return self[attr]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
wmill/__init__.py,sha256=nGZnQPezTdrBnBW1D0JqUtm75Gdf_xi3tAcPGwHRZ5A,46
|
|
2
|
+
wmill/client.py,sha256=Ko7kOwFXQ3TuWUC72b2pxb3D19dUCS75LMzL6V3IOZM,23208
|
|
3
|
+
wmill/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
|
|
4
|
+
wmill/s3_types.py,sha256=Zh-HCCVx06Z_9vLsVOEC-GrFlWqM22365kjDNpmO7Ig,1164
|
|
5
|
+
wmill-1.228.1.dist-info/METADATA,sha256=7qdijAqmM1GufONd-EXPS25cVXXcyKGzy1iMbXL_C9A,2699
|
|
6
|
+
wmill-1.228.1.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
7
|
+
wmill-1.228.1.dist-info/RECORD,,
|
wmill-1.227.1.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
wmill/__init__.py,sha256=d0Q6Fn44e7wFfLabDOBxpcJ1DPKWlFunGYDUBmO-4hA,22
|
|
2
|
-
wmill/client.py,sha256=MIjrDuwm3KyiFuYjDEV14ZPUU2Fn0rGp0cSCFfqRmzM,22165
|
|
3
|
-
wmill/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
|
|
4
|
-
wmill-1.227.1.dist-info/METADATA,sha256=8qQbSknWFRiROnqsY4jHmG_7hIZG4gLn2WQggaftF1k,2699
|
|
5
|
-
wmill-1.227.1.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
6
|
-
wmill-1.227.1.dist-info/RECORD,,
|
|
File without changes
|