Skip to content

Commit

Permalink
Re-export Event in types.py (#2829)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
szokeasaurusrex committed Mar 18, 2024
1 parent ab0c32e commit 9dc517b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sentry_sdk/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
This module contains type definitions for the Sentry SDK's public API.
The types are re-exported from the internal module `sentry_sdk._types`.
Disclaimer: Since types are a form of documentation, type definitions
may change in minor releases. Removing a type would be considered a
breaking change, and so we will only remove type definitions in major
releases.
"""

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from sentry_sdk._types import Event, Hint # noqa: F401

0 comments on commit 9dc517b

Please sign in to comment.