From 0f0fae053c4358469ebfee8b155b94e4749464ca Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Thu, 17 Apr 2025 13:22:14 +0200 Subject: [PATCH 1/3] Make all relevant types public --- sentry_sdk/types.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sentry_sdk/types.py b/sentry_sdk/types.py index 2b9f04c097..1a65247584 100644 --- a/sentry_sdk/types.py +++ b/sentry_sdk/types.py @@ -11,15 +11,39 @@ from typing import TYPE_CHECKING if TYPE_CHECKING: - from sentry_sdk._types import Event, EventDataCategory, Hint, Log + # Re-export types to make them available in the public API + from sentry_sdk._types import ( + Breadcrumb, + BreadcrumbHint, + Event, + EventDataCategory, + Hint, + Log, + MonitorConfig, + SamplingContext, + ) else: from typing import Any # The lines below allow the types to be imported from outside `if TYPE_CHECKING` # guards. The types in this module are only intended to be used for type hints. + Breadcrumb = Any + BreadcrumbHint = Any Event = Any EventDataCategory = Any Hint = Any Log = Any + MonitorConfig = Any + SamplingContext = Any -__all__ = ("Event", "EventDataCategory", "Hint", "Log") + +__all__ = ( + "Breadcrumb", + "BreadcrumbHint", + "Event", + "EventDataCategory", + "Hint", + "Log", + "MonitorConfig", + "SamplingContext", +) From 1948cf0e705acde0d36bc39d725a3033c8a307ed Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Thu, 17 Apr 2025 15:17:48 +0200 Subject: [PATCH 2/3] added some todos --- sentry_sdk/_types.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sentry_sdk/_types.py b/sentry_sdk/_types.py index 9bcb5a61f9..930b808285 100644 --- a/sentry_sdk/_types.py +++ b/sentry_sdk/_types.py @@ -220,7 +220,9 @@ class SDKInfo(TypedDict): tuple[None, None, None], ] + # TODO: Make a proper type definition for this Hint = Dict[str, Any] + Log = TypedDict( "Log", { @@ -233,9 +235,13 @@ class SDKInfo(TypedDict): }, ) + # TODO: Make a proper type definition for this Breadcrumb = Dict[str, Any] + + # TODO: Make a proper type definition for this BreadcrumbHint = Dict[str, Any] + # TODO: Make a proper type definition for this SamplingContext = Dict[str, Any] EventProcessor = Callable[[Event, Hint], Optional[Event]] From 039c4392f9534514e78eca5be006f641303a8022 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Thu, 17 Apr 2025 15:18:26 +0200 Subject: [PATCH 3/3] better --- sentry_sdk/_types.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sentry_sdk/_types.py b/sentry_sdk/_types.py index 930b808285..7da76e63dc 100644 --- a/sentry_sdk/_types.py +++ b/sentry_sdk/_types.py @@ -220,7 +220,7 @@ class SDKInfo(TypedDict): tuple[None, None, None], ] - # TODO: Make a proper type definition for this + # TODO: Make a proper type definition for this (PRs welcome!) Hint = Dict[str, Any] Log = TypedDict( @@ -235,13 +235,13 @@ class SDKInfo(TypedDict): }, ) - # TODO: Make a proper type definition for this + # TODO: Make a proper type definition for this (PRs welcome!) Breadcrumb = Dict[str, Any] - # TODO: Make a proper type definition for this + # TODO: Make a proper type definition for this (PRs welcome!) BreadcrumbHint = Dict[str, Any] - # TODO: Make a proper type definition for this + # TODO: Make a proper type definition for this (PRs welcome!) SamplingContext = Dict[str, Any] EventProcessor = Callable[[Event, Hint], Optional[Event]]