Skip to content
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

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

Merged
merged 4 commits into from
Jan 16, 2024

Conversation

szokeasaurusrex
Copy link
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
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
Contributor

@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
122 of 123 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/trace-type-hints-2460 branch January 16, 2024 11:01
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