-
Notifications
You must be signed in to change notification settings - Fork 555
Improve typings some #389
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
Improve typings some #389
Conversation
sentry_sdk/__init__.py imports * from sentry_sdk.api. Mypy can't understand the `@public` trick in sentry_sdk.api, so it thinks that sentry_sdk.api's __all__ is [], so given code like this import sentry_sdk sentry_sdk.capture_message("Something went wrong!") mypy complains Help it by not using the `@public` trick. Fixes getsentry#386.
…ss>) The type initial_client.integrations is Dict[str, something] so the integration name should be used in this check.
Basic usage, mostly taken from the API docs. Refs getsentry#386.
Enable some more strict mypy options and deal with the fallout.
I marked the PR as a draft because the fourth commit still has some errors (all in same spirit), and I don't know for sure what is the proper fix:
These happen because
Once this is decided this can go through CI (I only tested basic py3.7 configuration). |
It can be I "fixed" it by casting the type to Thanks, this is great work |
I hope you find the changes acceptable... since the btw, are you interested in joining the community Slack channel for the SDK? #390 |
Yes, they look good to me.
I don't use Slack personally. If I run into further issues with the typings I'll be sure to return with a PR though :) |
Thanks so far! |
The first commit fixes #386.
The second commit is a bug fix that mypy found.
The third commit adds a basic example as requested in #386 (comment).
The fourth commit improves the typings a bit by enabling some more strict mypy options and fixing the errors. I imagine it's quite hard to review so I can leave it off if that's preferable.