Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Commit 381520b

Browse files
HAT-301, HAT-302: Otel Constraints + Step Types (hatchet-dev#290)
* feat: better typing for step decorator * fix: patch version * fix: min allowed with current proto version * fix: try adding a py.typed marker * fix: lock
1 parent 56fde44 commit 381520b

File tree

4 files changed

+67
-57
lines changed

4 files changed

+67
-57
lines changed

hatchet_sdk/hatchet.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import asyncio
22
import logging
3-
from typing import Any, Callable, Optional, Type, TypeVar, Union
3+
from typing import Any, Callable, Optional, ParamSpec, Type, TypeVar, Union
44

55
from pydantic import BaseModel
66
from typing_extensions import deprecated
@@ -35,6 +35,9 @@
3535
)
3636

3737
T = TypeVar("T", bound=BaseModel)
38+
R = TypeVar("R")
39+
P = ParamSpec("P")
40+
3841
TWorkflow = TypeVar("TWorkflow", bound=object)
3942

4043

@@ -87,10 +90,10 @@ def step(
8790
desired_worker_labels: dict[str, DesiredWorkerLabel] = {},
8891
backoff_factor: float | None = None,
8992
backoff_max_seconds: int | None = None,
90-
) -> Callable[..., Any]:
93+
) -> Callable[[Callable[P, R]], Callable[P, R]]:
9194
parents = parents or []
9295

93-
def inner(func: Callable[[Context], Any]) -> Callable[[Context], Any]:
96+
def inner(func: Callable[P, R]) -> Callable[P, R]:
9497
limits = None
9598
if rate_limits:
9699
limits = [rate_limit._req for rate_limit in rate_limits or []]
@@ -99,7 +102,6 @@ def inner(func: Callable[[Context], Any]) -> Callable[[Context], Any]:
99102
setattr(func, "_step_parents", parents)
100103
setattr(func, "_step_timeout", timeout)
101104
setattr(func, "_step_retries", retries)
102-
setattr(func, "_step_rate_limits", retries)
103105
setattr(func, "_step_rate_limits", limits)
104106
setattr(func, "_step_backoff_factor", backoff_factor)
105107
setattr(func, "_step_backoff_max_seconds", backoff_max_seconds)

hatchet_sdk/py.typed

Whitespace-only changes.

poetry.lock

Lines changed: 52 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
[tool.poetry]
22
name = "hatchet-sdk"
3-
version = "0.43.0"
3+
version = "0.43.1"
44
description = ""
55
authors = ["Alexander Belanger <[email protected]>"]
66
readme = "README.md"
7+
include = ["hatchet_sdk/py.typed"]
78

89
[tool.poetry.dependencies]
910
python = "^3.10"
@@ -22,12 +23,12 @@ aiohttp = "^3.10.5"
2223
aiohttp-retry = "^2.8.3"
2324
tenacity = ">=8.4.1"
2425
cel-python = "^0.1.5"
25-
opentelemetry-api = "^1.27.0"
26-
opentelemetry-sdk = "^1.27.0"
27-
opentelemetry-instrumentation = "^0.48b0"
28-
opentelemetry-distro = "^0.48b0"
29-
opentelemetry-exporter-otlp = "^1.27.0"
30-
opentelemetry-exporter-otlp-proto-http = "^1.27.0"
26+
opentelemetry-api = "^1.28.0"
27+
opentelemetry-sdk = "^1.28.0"
28+
opentelemetry-instrumentation = ">=0.49b0"
29+
opentelemetry-distro = ">=0.49b0"
30+
opentelemetry-exporter-otlp = "^1.28.0"
31+
opentelemetry-exporter-otlp-proto-http = "^1.28.0"
3132
prometheus-client = "^0.21.1"
3233

3334
[tool.poetry.group.dev.dependencies]
@@ -36,7 +37,7 @@ pytest-asyncio = "^0.23.8"
3637
psutil = "^6.0.0"
3738

3839
[tool.poetry.group.lint.dependencies]
39-
mypy = "^1.13.0"
40+
mypy = "^1.14.0"
4041
types-protobuf = "^5.28.3.20241030"
4142
black = "^24.10.0"
4243
isort = "^5.13.2"

0 commit comments

Comments
 (0)