Skip to content

feat(types): export Attributes from the public types module - #8019

Merged
sentrivana merged 2 commits into
getsentry:masterfrom
sansynx:fix/public-attributes-type
Oct 13, 2026
Merged

sentrivana merged 2 commits into
getsentry:masterfrom
sansynx:fix/public-attributes-type

Conversation

@sansynx

@sansynx sansynx commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

Expose Attributes from sentry_sdk.types so callers can annotate span attributes without importing the private sentry_sdk._types module

The export follows the existing public type pattern:

  • Re-export the original definition during type checking
  • Provide an Any fallback for runtime annotation imports
  • Include Attributes in __all__

This is a three-line change in sentry_sdk/types.py. No test files are changed

The internal type definition remains unchanged. No dependencies or configuration changes are needed

Validation

Local checks run on Windows with Python 3.12:

  • Focused tox run of tests/test_types.py: 2 existing tests passed
  • Public Attributes import checked at runtime
  • SDK mypy check: no issues in 202 source files
  • Consumer mypy checks: supported attribute values accepted, unsupported object values rejected, and wildcard import accepted
  • Ruff lint and formatting checks passed for the export module and existing type tests
  • Wheel build passed
  • git diff --check passed

The full integration matrix has not been run locally. GitHub's CI and Test workflows currently report action_required; no jobs have run

AI assistance was used for implementation and local validation

Issues

Reminders

Comment thread tests/test_types.py Outdated
Comment on lines +9 to +12
def test_attributes_optional_runtime():
from sentry_sdk.types import Attributes

Optional[Attributes]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not sure what this test is doing, can remove

@sansynx sansynx Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've removed the test and pushed the update

@sansynx
sansynx marked this pull request as ready for review October 13, 2026 12:29
@sansynx
sansynx requested a review from a team as a code owner October 13, 2026 12:29
Copilot AI balanced review requested due to automatic review settings October 13, 2026 12:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sentrivana

Copy link
Copy Markdown
Collaborator

LGTM, thanks!

@sentrivana
sentrivana enabled auto-merge (squash) October 13, 2026 12:39
@sentrivana
sentrivana merged commit 916942d into getsentry:master Oct 13, 2026
309 of 311 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose Attributes type definition in public place

4 participants