question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE] Add __all__ to fastapi

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
hmvpcommented, Jun 10, 2020

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…

0reactions
github-actions[bot]commented, May 10, 2021

Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found