-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Add __all__ to __init__.py files to silence mypy(strict) errors #2237
Comments
Hi @ycd . Thanks a lot for explanation. I had the feeling this might be by design. What got me confused was that from |
I've tried creating a fresh project with a single .py file: 1st version:
2nd version:
On both scenarios I get the same result. Not using --strict mode all is good:
Whilst enabling strict mode compains on both cases:
My mypi.ini looks as follows:
Is it expected behaviour? Or is it something wrong with my mypy config? If that's expected as of now, is there anything else to be done except placing |
I follow the mypy suggestion on Pydantic side: mypy --ignore-missing-imports --follow-imports=skip --strict-optional <file> I think it makes sense to use this configuration as FastAPI is based on it. |
Thanks, @Kludex . Me myself have ended up adding |
Does that mean that we'll always have to add Thanks a lot for the lib! |
Thanks for the discussion here everyone! I added support for It is available in FastAPI 0.63.0 🎉 |
Thank you so much, @tiangolo ! |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Strict mypy mode gives such errors:
on such import statement:
Tried using
as per recommendations in fastapi/typer#112 discussion. But the errors remain.
It seems that adding all to the init.py files for the stuff that's reexported is a way to go (as per python/mypy#7042 discussion).
Thanks for considering this!
The text was updated successfully, but these errors were encountered: