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
Are there plans to add type hints or library stubs for MyPy? #31
Comments
I got so used to disabling stubs in
It's a great idea to add them and I will be happy with your contribution.
Stubgen does the thing. Cool! |
Yeah, I tried with stubgen to auto-gen the |
@ginomempin for the last few days I was reading about mypy, stubgen and I was testing it in a few test apps. My conclusions:
Can you please share your configuration? I don't think mypy should complain. Are you using |
I don't use a mypy.ini or any mypy-specific configuration file. I use VS Code and with mypy enabled. Here are some files that reproduce the error: main.py
VS Code's settings.json
VS Code's logs on running mypy on main.py
Manually running mypy manually on main.py with default configs
|
After re-reading MyPy's docs on Creating PEP 561 compatible packages, I realized that since everything on your package is already properly typed, it is only required that a
I retested based on my example above, and true enough, just exporting a
|
I submitted PR #36 to basically remove all the 14 It should be enough to keep the |
No worries. We both learned something new :) Anyway, the way I understand it indeed only Anyway, it should be working well for all cases now. |
released :) |
I'm using your library right now in a FastAPI app, and since everything's heavily typed in FastAPI (and Pydantic), I have MyPy enabled and it's using quite a strict configuration. Right now, it's complaining about the imports from
starlette_context
:Code:
Error:
I can always just suppress the error with
# type: ignore
but I was wondering if you were planning on adding type hints or stub packages/files, as recommended by MyPy here: https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-type-hints-for-third-party-library. I think that would be a better approach.In case there's no plan for this yet, what would you say to a PR to add stub files? Basically, I think just adding the appropriate
.pyi
files next to each.py
file would satisfy MyPy.The text was updated successfully, but these errors were encountered: