Skip to content

ref(api): Improve sentry_sdk.trace type hints - #2633

Merged
szokeasaurusrex merged 4 commits into
masterfrom
szokeasaurusrex/trace-type-hints-2460
Jan 16, 2024
Merged

szokeasaurusrex merged 4 commits into
masterfrom
szokeasaurusrex/trace-type-hints-2460

Conversation

@szokeasaurusrex

Copy link
Copy Markdown
Member

Type hints for sentry_sdk.trace decorator function now indicate that the decorator returns a function with the same signature as it was called with. Previously, the type hints indicated that the decorator could return Any, which caused users to lose type hints for decorated functions.

Before this change:
image

After this change:
image

Fixes GH-2460

@szokeasaurusrex szokeasaurusrex changed the title Improve sentry_sdk.trace type hints docs(api): Improve sentry_sdk.trace type hints Jan 11, 2024
@szokeasaurusrex

Copy link
Copy Markdown
Member Author

@sentrivana Is docs the correct commit message scope here? It seems appropriate to me since type hints in Python aren't part of the code, but rather they serve only to document expected types. Or do you have a different idea?

@sentrivana

Copy link
Copy Markdown
Collaborator

@szokeasaurusrex Looking at sentry folks seem to usually either go with ref or fix for type hint fixes/changes so I'd probably pick one of those.

@szokeasaurusrex szokeasaurusrex changed the title docs(api): Improve sentry_sdk.trace type hints ref(api): Improve sentry_sdk.trace type hints Jan 11, 2024
@szokeasaurusrex
szokeasaurusrex enabled auto-merge (squash) January 16, 2024 10:23
@szokeasaurusrex
szokeasaurusrex merged commit 2f05ccb into master Jan 16, 2024
@szokeasaurusrex
szokeasaurusrex deleted the szokeasaurusrex/trace-type-hints-2460 branch January 16, 2024 11:01
@MerlinVeritas MerlinVeritas mentioned this pull request Nov 28, 2025
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.

Typing issue

2 participants