wmill 1.600.0__py3-none-any.whl → 1.609.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.
wmill/client.py CHANGED
@@ -707,13 +707,25 @@ class Windmill:
707
707
  params=params if params else None,
708
708
  ).json()
709
709
 
710
- def set_state(self, value: Any):
710
+ def set_state(self, value: Any, path: str | None = None) -> None:
711
711
  """Set the workflow state.
712
712
 
713
713
  Args:
714
714
  value: State value to set
715
+ path: Optional state resource path override.
715
716
  """
716
- self.set_resource(value, path=self.state_path, resource_type="state")
717
+ self.set_resource(value, path=path or self.state_path, resource_type="state")
718
+
719
+ def get_state(self, path: str | None = None) -> Any:
720
+ """Get the workflow state.
721
+
722
+ Args:
723
+ path: Optional state resource path override.
724
+
725
+ Returns:
726
+ State value or None if not set
727
+ """
728
+ return self.get_resource(path=path or self.state_path, none_if_undefined=True)
717
729
 
718
730
  def set_progress(self, value: int, job_id: Optional[str] = None):
719
731
  """Set job progress percentage (0-99).
@@ -963,7 +975,7 @@ class Windmill:
963
975
  ).json()
964
976
  except Exception as e:
965
977
  raise Exception("Could not write file to S3") from e
966
- return S3Object(s3=response["file_key"])
978
+ return S3Object(s3=response["file_key"], storage=s3object["storage"])
967
979
 
968
980
  def sign_s3_objects(self, s3_objects: list[S3Object | str]) -> list[S3Object]:
969
981
  """Sign S3 objects for use by anonymous users in public apps.
@@ -1167,20 +1179,26 @@ class Windmill:
1167
1179
  with open(f"/shared/{path}", "r", encoding="utf-8") as f:
1168
1180
  return json.load(f)
1169
1181
 
1170
- def get_resume_urls(self, approver: str = None) -> dict:
1182
+ def get_resume_urls(self, approver: str = None, flow_level: bool = None) -> dict:
1171
1183
  """Get URLs needed for resuming a flow after suspension.
1172
1184
 
1173
1185
  Args:
1174
1186
  approver: Optional approver name
1187
+ flow_level: If True, generate resume URLs for the parent flow instead of the
1188
+ specific step. This allows pre-approvals that can be consumed by any later
1189
+ suspend step in the same flow.
1175
1190
 
1176
1191
  Returns:
1177
1192
  Dictionary with approvalPage, resume, and cancel URLs
1178
1193
  """
1179
1194
  nonce = random.randint(0, 1000000000)
1180
1195
  job_id = os.environ.get("WM_JOB_ID") or "NO_ID"
1196
+ params = {"approver": approver}
1197
+ if flow_level is not None:
1198
+ params["flow_level"] = flow_level
1181
1199
  return self.get(
1182
1200
  f"/w/{self.workspace}/jobs/resume_urls/{job_id}/{nonce}",
1183
- params={"approver": approver},
1201
+ params=params,
1184
1202
  ).json()
1185
1203
 
1186
1204
  def request_interactive_slack_approval(
@@ -1725,12 +1743,11 @@ def whoami() -> dict:
1725
1743
 
1726
1744
 
1727
1745
  @init_global_client
1728
- @deprecate("Windmill().state")
1729
- def get_state() -> Any:
1746
+ def get_state(path: str | None = None) -> Any:
1730
1747
  """
1731
1748
  Get the state
1732
1749
  """
1733
- return _client.state
1750
+ return _client.get_state(path=path)
1734
1751
 
1735
1752
 
1736
1753
  @init_global_client
@@ -1781,11 +1798,11 @@ def list_resources(
1781
1798
 
1782
1799
 
1783
1800
  @init_global_client
1784
- def set_state(value: Any) -> None:
1801
+ def set_state(value: Any, path: str | None = None) -> None:
1785
1802
  """
1786
1803
  Set the state
1787
1804
  """
1788
- return _client.set_state(value)
1805
+ return _client.set_state(value, path=path)
1789
1806
 
1790
1807
 
1791
1808
  @init_global_client
@@ -1876,16 +1893,19 @@ def get_state_path() -> str:
1876
1893
 
1877
1894
 
1878
1895
  @init_global_client
1879
- def get_resume_urls(approver: str = None) -> dict:
1896
+ def get_resume_urls(approver: str = None, flow_level: bool = None) -> dict:
1880
1897
  """Get URLs needed for resuming a flow after suspension.
1881
1898
 
1882
1899
  Args:
1883
1900
  approver: Optional approver name
1901
+ flow_level: If True, generate resume URLs for the parent flow instead of the
1902
+ specific step. This allows pre-approvals that can be consumed by any later
1903
+ suspend step in the same flow.
1884
1904
 
1885
1905
  Returns:
1886
1906
  Dictionary with approvalPage, resume, and cancel URLs
1887
1907
  """
1888
- return _client.get_resume_urls(approver)
1908
+ return _client.get_resume_urls(approver, flow_level)
1889
1909
 
1890
1910
 
1891
1911
  @init_global_client
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wmill
3
- Version: 1.600.0
3
+ Version: 1.609.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
@@ -1,8 +1,8 @@
1
1
  wmill/__init__.py,sha256=nGZnQPezTdrBnBW1D0JqUtm75Gdf_xi3tAcPGwHRZ5A,46
2
- wmill/client.py,sha256=QhJbL2osMHO-v_ngjvB1_r8gtasS43_CwzOTsH6e5ek,72774
2
+ wmill/client.py,sha256=CM6DOs7LQFWDnKFKeViiAUX708vWdxRfvfT0sgcMJOQ,73878
3
3
  wmill/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
4
4
  wmill/s3_reader.py,sha256=ySd1R2F9krbyhFU_-ogGDZAWQsF2CkPgq7K7xCEvhDU,2662
5
5
  wmill/s3_types.py,sha256=gQZRdQoDRp7IRS9MTgGAiHZr1MIdtrbWeN-NJ28kIkA,1804
6
- wmill-1.600.0.dist-info/METADATA,sha256=6PP6MZYMlj025r-xzKWR9PS4wne60N_cHxUkUyJDMIk,2693
7
- wmill-1.600.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
8
- wmill-1.600.0.dist-info/RECORD,,
6
+ wmill-1.609.0.dist-info/METADATA,sha256=Ir13sM7IFpTWzWNOkBijzBreRZxYmvU6NHsL6BSnZKo,2693
7
+ wmill-1.609.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
8
+ wmill-1.609.0.dist-info/RECORD,,