Skip to content

Commit 3d59242

Browse files
authored
fix(typing): Add @sentry_sdk.traces.trace overloads to fix typing (#6236)
Changing `sentry_sdk.trace` to `sentry_sdk.traces.trace` introduced a whole avalanche of [typing issues](https://github.com/getsentry/seer/actions/runs/25495762136/job/74814929830?pr=6291). Adding the overloads we have for the original `trace`.
1 parent 106fe71 commit 3d59242

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

sentry_sdk/traces.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
Callable,
3838
Iterator,
3939
Optional,
40+
overload,
4041
ParamSpec,
4142
TypeVar,
4243
Union,
@@ -703,6 +704,23 @@ def timestamp(self) -> "Optional[datetime]":
703704
return None
704705

705706

707+
if TYPE_CHECKING:
708+
709+
@overload
710+
def trace(
711+
func: "Callable[P, R]",
712+
) -> "Callable[P, R]": ...
713+
714+
@overload
715+
def trace(
716+
func: None = None,
717+
*,
718+
name: "Optional[str]" = None,
719+
attributes: "Optional[dict[str, Any]]" = None,
720+
active: bool = True,
721+
) -> "Callable[[Callable[P, R]], Callable[P, R]]": ...
722+
723+
706724
def trace(
707725
func: "Optional[Callable[P, R]]" = None,
708726
*,

0 commit comments

Comments
 (0)