hatchet-sdk 1.2.1__py3-none-any.whl → 1.2.3__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 hatchet-sdk might be problematic. Click here for more details.

hatchet_sdk/__init__.py CHANGED
@@ -138,7 +138,7 @@ from hatchet_sdk.contracts.workflows_pb2 import (
138
138
  )
139
139
  from hatchet_sdk.features.runs import BulkCancelReplayOpts, RunFilter
140
140
  from hatchet_sdk.hatchet import Hatchet
141
- from hatchet_sdk.runnables.task import NonRetryableException, Task
141
+ from hatchet_sdk.runnables.task import Task
142
142
  from hatchet_sdk.runnables.types import (
143
143
  ConcurrencyExpression,
144
144
  ConcurrencyLimitStrategy,
@@ -269,5 +269,4 @@ __all__ = [
269
269
  "BulkCancelReplayOpts",
270
270
  "RunFilter",
271
271
  "V1TaskStatus",
272
- "NonRetryableException",
273
272
  ]
hatchet_sdk/config.py CHANGED
@@ -78,12 +78,17 @@ class ClientConfig(BaseSettings):
78
78
 
79
79
  @model_validator(mode="after")
80
80
  def validate_addresses(self) -> "ClientConfig":
81
- if self.host_port == DEFAULT_HOST_PORT:
82
- server_url, grpc_broadcast_address = get_addresses_from_jwt(self.token)
83
- self.host_port = grpc_broadcast_address
84
- self.server_url = server_url
85
- else:
86
- self.server_url = self.host_port
81
+ ## If nothing is set, read from the token
82
+ ## If either is set, override what's in the JWT
83
+ server_url_from_jwt, grpc_broadcast_address_from_jwt = get_addresses_from_jwt(
84
+ self.token
85
+ )
86
+
87
+ if "host_port" not in self.model_fields_set:
88
+ self.host_port = grpc_broadcast_address_from_jwt
89
+
90
+ if "server_url" not in self.model_fields_set:
91
+ self.server_url = server_url_from_jwt
87
92
 
88
93
  if not self.tls_config.server_name:
89
94
  self.tls_config.server_name = self.host_port.split(":")[0]
@@ -0,0 +1,2 @@
1
+ class NonRetryableException(Exception):
2
+ pass
hatchet_sdk/hatchet.py CHANGED
@@ -56,7 +56,7 @@ class Hatchet:
56
56
  self,
57
57
  debug: bool = False,
58
58
  client: Client | None = None,
59
- config: ClientConfig = ClientConfig(),
59
+ config: ClientConfig | None = None,
60
60
  ):
61
61
  """
62
62
  Initialize a new Hatchet instance.
@@ -74,7 +74,9 @@ class Hatchet:
74
74
  if debug:
75
75
  logger.setLevel(logging.DEBUG)
76
76
 
77
- self._client = client if client else Client(config=config, debug=debug)
77
+ self._client = (
78
+ client if client else Client(config=config or ClientConfig(), debug=debug)
79
+ )
78
80
 
79
81
  @property
80
82
  def cron(self) -> CronClient:
@@ -44,10 +44,6 @@ def fall_back_to_default(value: T, default: T, fallback_value: T) -> T:
44
44
  return fallback_value
45
45
 
46
46
 
47
- class NonRetryableException(Exception):
48
- pass
49
-
50
-
51
47
  class Task(Generic[TWorkflowInput, R]):
52
48
  def __init__(
53
49
  self,
@@ -30,6 +30,7 @@ from hatchet_sdk.contracts.dispatcher_pb2 import (
30
30
  STEP_EVENT_TYPE_FAILED,
31
31
  STEP_EVENT_TYPE_STARTED,
32
32
  )
33
+ from hatchet_sdk.exceptions import NonRetryableException
33
34
  from hatchet_sdk.logger import logger
34
35
  from hatchet_sdk.runnables.contextvars import (
35
36
  ctx_step_run_id,
@@ -38,7 +39,7 @@ from hatchet_sdk.runnables.contextvars import (
38
39
  spawn_index_lock,
39
40
  workflow_spawn_indices,
40
41
  )
41
- from hatchet_sdk.runnables.task import NonRetryableException, Task
42
+ from hatchet_sdk.runnables.task import Task
42
43
  from hatchet_sdk.runnables.types import R, TWorkflowInput
43
44
  from hatchet_sdk.utils.typing import WorkflowValidator
44
45
  from hatchet_sdk.worker.action_listener_process import ActionEvent
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hatchet-sdk
3
- Version: 1.2.1
3
+ Version: 1.2.3
4
4
  Summary:
5
5
  Author: Alexander Belanger
6
6
  Author-email: alexander@hatchet.run
@@ -18,7 +18,6 @@ Requires-Dist: grpcio (>=1.64.1,!=1.68.*) ; python_version < "3.13"
18
18
  Requires-Dist: grpcio (>=1.69.0) ; python_version >= "3.13"
19
19
  Requires-Dist: grpcio-tools (>=1.64.1,!=1.68.*) ; python_version < "3.13"
20
20
  Requires-Dist: grpcio-tools (>=1.69.0) ; python_version >= "3.13"
21
- Requires-Dist: nest-asyncio (>=1.6.0,<2.0.0)
22
21
  Requires-Dist: opentelemetry-api (>=1.28.0,<2.0.0) ; extra == "otel"
23
22
  Requires-Dist: opentelemetry-distro (>=0.49b0) ; extra == "otel"
24
23
  Requires-Dist: opentelemetry-exporter-otlp (>=1.28.0,<2.0.0) ; extra == "otel"
@@ -29,9 +28,7 @@ Requires-Dist: prometheus-client (>=0.21.1,<0.22.0)
29
28
  Requires-Dist: protobuf (>=5.29.1,<6.0.0)
30
29
  Requires-Dist: pydantic (>=2.6.3,<3.0.0)
31
30
  Requires-Dist: pydantic-settings (>=2.7.1,<3.0.0)
32
- Requires-Dist: pytest-timeout (>=2.3.1,<3.0.0)
33
31
  Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
34
- Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
35
32
  Requires-Dist: tenacity (>=8.4.1)
36
33
  Requires-Dist: urllib3 (>=1.26.20)
37
34
  Description-Content-Type: text/markdown
@@ -64,26 +61,7 @@ poetry add hatchet-sdk
64
61
 
65
62
  ## Quick Start
66
63
 
67
- Here's a simple example of how to use the Hatchet Python SDK:
68
-
69
- ```python
70
- from hatchet_sdk import Context, EmptyModel, Hatchet
71
-
72
- hatchet = Hatchet(debug=True)
73
-
74
-
75
- @hatchet.task(name="SimpleWorkflow")
76
- def step1(input: EmptyModel, ctx: Context) -> None:
77
- print("executed step1")
78
-
79
-
80
- def main() -> None:
81
- worker = hatchet.worker("test-worker", slots=1, workflows=[step1])
82
- worker.start()
83
-
84
- if __name__ == "__main__":
85
- main()
86
- ```
64
+ For examples of how to use the Hatchet Python SDK, including worker setup and task execution, please see our [official documentation](https://docs.hatchet.run/home/setup).
87
65
 
88
66
  ## Features
89
67
 
@@ -1,4 +1,4 @@
1
- hatchet_sdk/__init__.py,sha256=xpvq4zASQag5sYGlkaU8cg9wmACaAaeXXCdTtU17-UM,10054
1
+ hatchet_sdk/__init__.py,sha256=o_06wLLKCKRq4uQuCF62yDRb8hTQYYcqPC3FIDNHxuQ,10002
2
2
  hatchet_sdk/client.py,sha256=lApcV1-qlvIdiHyGrQJAIlT9qzP96I0mQ2STZ1ZV_2g,1940
3
3
  hatchet_sdk/clients/admin.py,sha256=cc-TyZL6uLz3MGpdVKYziiZlmi29twP8MUJ66CboLtU,15160
4
4
  hatchet_sdk/clients/dispatcher/action_listener.py,sha256=FogjHd6vhj4HeQs--Z-99kPwCfaETo1-EcotjdIkrig,16266
@@ -217,7 +217,7 @@ hatchet_sdk/clients/rest/tenacity_utils.py,sha256=n6QvwuGwinLQpiWNU5GxrDNhFBE8_w
217
217
  hatchet_sdk/clients/run_event_listener.py,sha256=rIjBLRF7d7FBoEq7RKbmbOA84lX_hHSU26trwnthqV8,10230
218
218
  hatchet_sdk/clients/v1/api_client.py,sha256=L5dbAvIJMnoe9oiUuwLJx8Atn_NTpCctGJ_cXxE-KFs,1247
219
219
  hatchet_sdk/clients/workflow_listener.py,sha256=x6FQ8d786MiubARPG0B92L3Jbs4Ve0CQJFx_udJIB3s,10522
220
- hatchet_sdk/config.py,sha256=piNrTA4EuYNNl0FpsFWceOuIOps-6R95PWZomQWOMBA,3426
220
+ hatchet_sdk/config.py,sha256=jJA76BOvVdfOQHy6TKclAvr2qyblcM-Pz5J-hVAdpQ4,3588
221
221
  hatchet_sdk/connection.py,sha256=B5gT5NL9BBB5-l9U_cN6pMlraQk880rEYMnqaK_dgL0,2590
222
222
  hatchet_sdk/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
223
223
  hatchet_sdk/context/context.py,sha256=jxT4HHrocY9dftiXxob-f06JRIYENRLrSgXE-t8hgxY,9347
@@ -240,6 +240,7 @@ hatchet_sdk/contracts/v1/workflows_pb2_grpc.py,sha256=XytYpV2kJQZT8iAs14z4SWsv-9
240
240
  hatchet_sdk/contracts/workflows_pb2.py,sha256=9j6-YMrtgp2yxX-BePwyaqxuFhrI6OftoZSR53JPDWw,11739
241
241
  hatchet_sdk/contracts/workflows_pb2.pyi,sha256=2r5d4DWaR0kwY8jKSzcffTAMMlWrusRXCziE_03SFYc,15434
242
242
  hatchet_sdk/contracts/workflows_pb2_grpc.py,sha256=2V8E72DlJx5qlH2yiQpVCu5cQbKUba5X7T1yNrQDF_s,10819
243
+ hatchet_sdk/exceptions.py,sha256=HGmYSZy3bCY2rBDEOQfhYGRa7_j9GvYT9Pc0B8Ic5Ug,49
243
244
  hatchet_sdk/features/cron.py,sha256=VRq5w15QpVYMkvkyIUgBO77IQpASbTxyplbgGukdmE8,9218
244
245
  hatchet_sdk/features/logs.py,sha256=Fm3l0f2VUlQ_YqYrKqHYviK5g_j9_wUEW6J_Ax9cYzc,724
245
246
  hatchet_sdk/features/metrics.py,sha256=Lmmu-3TITHyGGx5moA_emuzy-ZrbJhXLBDzR7Fm73pk,2897
@@ -248,7 +249,7 @@ hatchet_sdk/features/runs.py,sha256=th2czurM9uawOlcm48MBalvQTqSmfVhOMcAbHjPH_hk,
248
249
  hatchet_sdk/features/scheduled.py,sha256=MfUrUOYNWewoX6GJ4YV2UWmKrxVJrgj4fX8wCxkkgv0,8900
249
250
  hatchet_sdk/features/workers.py,sha256=HpUX8LyvFfseNn677tTvQukNqyD90-uWPhdf10znUkA,1589
250
251
  hatchet_sdk/features/workflows.py,sha256=4hZgk7vhRhMK8wb2K3b9617TolnxRkeYL35aeLWHY2c,2143
251
- hatchet_sdk/hatchet.py,sha256=tmTGNRKcpLZlVquqMPmvS14OCgcMsYEsGTeFpKay5NE,22933
252
+ hatchet_sdk/hatchet.py,sha256=mVvUOovp_e6d0Z5GEHmz4AMKfsGePBK2b7BTQkhwD7U,22972
252
253
  hatchet_sdk/labels.py,sha256=nATgxWE3lFxRTnfISEpoIRLGbMfAZsHF4lZTuG4Mfic,182
253
254
  hatchet_sdk/logger.py,sha256=5uOr52T4mImSQm1QvWT8HvZFK5WfPNh3Y1cBQZRFgUQ,333
254
255
  hatchet_sdk/metadata.py,sha256=XkRbhnghJJGCdVvF-uzyGBcNaTqpeQ3uiQvNNP1wyBc,107
@@ -257,7 +258,7 @@ hatchet_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
257
258
  hatchet_sdk/rate_limit.py,sha256=TwbCuggiZaWpYuo4mjVLlE-z1OfQ2mRBiVvCSaG3lv4,3919
258
259
  hatchet_sdk/runnables/contextvars.py,sha256=6MDocAMmlyiRW37oQ1jyx10tAlJs-xgDjR3xPoPz05g,426
259
260
  hatchet_sdk/runnables/standalone.py,sha256=2jgUgILYIyHSYy3S6M6n2QAQ7UyvxfSQk0DDRar5RpI,5996
260
- hatchet_sdk/runnables/task.py,sha256=O0DEDvYZT6gC5eNF6ObsE2MhCBUNKWkr2JXPZx2aUZM,4883
261
+ hatchet_sdk/runnables/task.py,sha256=jQiRPeE9EbIzNOxv6hkmJ8RqyVR7hMLXX4cnGRl_GF8,4832
261
262
  hatchet_sdk/runnables/types.py,sha256=JWo4hkYb2XYoktIFVvnqud6Ywmo7AHMK_upYpdNmij0,4235
262
263
  hatchet_sdk/runnables/workflow.py,sha256=eYIbpAAwlArhEZrd3NHDT4Yy8_GejgCzRG6TZomPugI,30681
263
264
  hatchet_sdk/token.py,sha256=KjIiInwG5Kqd_FO4BSW1x_5Uc7PFbnzIVJqr50-ZldE,779
@@ -501,11 +502,11 @@ hatchet_sdk/waits.py,sha256=mBJVOjvTJfhXCngyIfNccYFtg7eiFM2B2n7lcg90S3A,3327
501
502
  hatchet_sdk/worker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
502
503
  hatchet_sdk/worker/action_listener_process.py,sha256=KxS7-wBpfKnsq0LNSvk-MG442Lh60iQMy3VpD1FW3mU,11703
503
504
  hatchet_sdk/worker/runner/run_loop_manager.py,sha256=GKIH2ncGdM7nwtPn--8f6dAxQqBQv6O82mZYCEM5qnk,3971
504
- hatchet_sdk/worker/runner/runner.py,sha256=kO53akS6-a3_UPCj6V1nDL4V4hlUgElpS0vPE3gtvn4,17141
505
+ hatchet_sdk/worker/runner/runner.py,sha256=ZocvR7dDgEvSxcHAWDDaoTasSz3Wio70TbEbBRE3GFA,17175
505
506
  hatchet_sdk/worker/runner/utils/capture_logs.py,sha256=nHRPSiDBqzhObM7i2X7t03OupVFnE7kQBdR2Ckgg-2w,2709
506
507
  hatchet_sdk/worker/worker.py,sha256=qyHs64H-grF9HR1CgH7MlnoDmTQ8mm4d8basx-ZDyWc,14490
507
508
  hatchet_sdk/workflow_run.py,sha256=Q1nTpnWNsFfjWWpx49xXYUHsVbqTnHL6JWnSKoFM3_I,1029
508
- hatchet_sdk-1.2.1.dist-info/METADATA,sha256=IA4Kbj31BDt_xxA2LYoTS-MOfJAYPzYP9m-EMCLvbd4,3961
509
- hatchet_sdk-1.2.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
510
- hatchet_sdk-1.2.1.dist-info/entry_points.txt,sha256=5mTp_AsCWK5raiVxP_MU9eBCgkRGl4OsN6chpHcvm7o,1235
511
- hatchet_sdk-1.2.1.dist-info/RECORD,,
509
+ hatchet_sdk-1.2.3.dist-info/METADATA,sha256=ix70mJ0CDQ0s-8MQRt_1KaVyCozNUXqFzd5iDspc7GE,3571
510
+ hatchet_sdk-1.2.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
511
+ hatchet_sdk-1.2.3.dist-info/entry_points.txt,sha256=5mTp_AsCWK5raiVxP_MU9eBCgkRGl4OsN6chpHcvm7o,1235
512
+ hatchet_sdk-1.2.3.dist-info/RECORD,,