wmill 1.227.1__tar.gz → 1.228.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wmill
3
- Version: 1.227.1
3
+ Version: 1.228.1
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "wmill"
3
- version = "1.227.1"
3
+ version = "1.228.1"
4
4
  description = "A client library for accessing Windmill server wrapping the Windmill client API"
5
5
  license = "Apache-2.0"
6
6
  homepage = "https://windmill.dev"
@@ -0,0 +1,2 @@
1
+ from .client import *
2
+ from .s3_types import *
@@ -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
- ) -> Union[str, None]:
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
- return self.post(
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
- ) -> Any:
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
- return self.post(
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
- ) -> Any:
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
- return self.post(
366
- f"/w/{self.workspace}/job_helpers/v2/boto3_connection_settings",
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(s3_resource_path: str = "", none_if_undefined: bool = False) -> Union[str, None]:
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(s3_resource_path: str = "", none_if_undefined: bool = False) -> Any:
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(s3_resource_path: str = "", none_if_undefined: bool = False) -> Any:
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
@@ -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]
@@ -1 +0,0 @@
1
- from .client import *
File without changes
File without changes