Skip to content

Make all relevant types public #4315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sentry_sdk/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ class SDKInfo(TypedDict):
tuple[None, None, None],
]

# TODO: Make a proper type definition for this (PRs welcome!)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] I'd suggest we just remove these TODO comments and make GitHub issues for them; I think TODO comments will just get ignored

Suggested change
# TODO: Make a proper type definition for this (PRs welcome!)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will keep them. Maybe someone wants to earn some internet points and creates nice types here :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay fair enough 😂

Hint = Dict[str, Any]

Log = TypedDict(
"Log",
{
Expand All @@ -233,9 +235,13 @@ class SDKInfo(TypedDict):
},
)

# TODO: Make a proper type definition for this (PRs welcome!)
Breadcrumb = Dict[str, Any]

# TODO: Make a proper type definition for this (PRs welcome!)
BreadcrumbHint = Dict[str, Any]

# TODO: Make a proper type definition for this (PRs welcome!)
SamplingContext = Dict[str, Any]

EventProcessor = Callable[[Event, Hint], Optional[Event]]
Expand Down
28 changes: 26 additions & 2 deletions sentry_sdk/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
Loading