-
Notifications
You must be signed in to change notification settings - Fork 413
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
mypy stub files #951
Comments
@jasonkuhrt thank you for opening the request, this has been on my personal todo list for awhile. I also do not know how to do it, but would love to try and find the time to do this. |
@brettlangdon fwiw this is what we did locally in our project to satisfy mypy (we're only stubbing the parts we use, not complete, of course) |
Nice! Thanks for sharing. |
I ended up creating a compat module so that I could use from typing import Any, Callable, TypeVar
import ddtrace
# This allows us to use a type annotated ddtrace.tracer.wrap.
# First, we assign the name "trace" to ddtrace.tracer.wrap.
# Then, we assign a type:
# "trace" is a callable that takes arguments, and returns a function.
# That function takes another function as an argument and returns it.
F = TypeVar("F", bound=Callable[..., Any])
trace: Callable[..., Callable[[F], F]] = ddtrace.tracer.wrap |
mypy throws an error when ddtrace is in use:
It would be nice if this library could ship with stub files or be put on https://github.com/python/typeshed. I'm not sure how to do that yet but maybe someone here is.
More info from mypy side here https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
The text was updated successfully, but these errors were encountered: