[FEATURE] Add __all__ to fastapi
See original GitHub issueIs your feature request related to a problem
We use mypy with the option implicit_reexport = False
. This triggers on idiomatic fastapi imports because fastapi/__init__.py
reexports everything without declaring any in __all__
The solution you would like
Add a __all__
for all types that should be imported from the main module.
Describe alternatives you’ve considered
Direct imports from the respective submodules is a workaround but all examples assume an import from the main package
Additional context
https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Bigger Applications - Multiple Files - FastAPI
And we can add a list of dependencies that will be added to all the path operations in the router and will be...
Read more >5 Advanced Features of FastAPI You Should Try
FastAPI offers all the standard features of an API building tool but it is not limited ... We will also add the prefixes...
Read more >High-performing Apps With Python: A FastAPI Tutorial - Toptal
Our tiny app will provide the following features: Signup and Login; Add new TODO item; Get a list of all TODOs; Delete/Update a...
Read more >FastAPI Python Tutorial - 6: Add users: Request body with ...
FastAPI Python Tutorial - 6: Add users: Request body with Pydantic model · Chapters. View all · Chapters · Description · Chapters. View...
Read more >Building REST APIs using FastAPI, SQLAlchemy & Uvicorn
The key features of FastAPI are: Fast: Very high performance, ... Next, install all the required dependencies using Pipenv as shown.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah currently we use direct imports from the place where they are defined (because mypy complains otheriwise). I don’t think there is anything wrong with that, but since the docs mostly use examples that import from main, I think
__all__
should match canonical usage…Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.