Skip to content

Commit 9dc517b

Browse files
Re-export Event in types.py (#2829)
End-users may need to use the Event type for their type hinting to work following the Event type changes. However, we define Event in a private module sentry_sdk._types, which provides no stability guarantees. Therefore, this PR creates a new public module sentry_sdk.types, where we re-export the Event type, and explicitly make it available as public API via sentry_sdk.types.Event. The new sentry_sdk.types module includes a docstring to inform users that we reserve the right to modify types in minor releases, since we consider types to be a form of documentation (they are not enforced by the Python language), but that we guarantee that we will only remove type definitions in a major release.
1 parent ab0c32e commit 9dc517b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

sentry_sdk/types.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
This module contains type definitions for the Sentry SDK's public API.
3+
The types are re-exported from the internal module `sentry_sdk._types`.
4+
5+
Disclaimer: Since types are a form of documentation, type definitions
6+
may change in minor releases. Removing a type would be considered a
7+
breaking change, and so we will only remove type definitions in major
8+
releases.
9+
"""
10+
11+
from typing import TYPE_CHECKING
12+
13+
if TYPE_CHECKING:
14+
from sentry_sdk._types import Event, Hint # noqa: F401

0 commit comments

Comments
 (0)