Closed RafaelWO closed 8 months ago
To debug Python ASGI apps it is common to add some code to your main.py file which could look as follows:
main.py
if __name__ == "__main__": import granian granian.Granian("app.main:app", port=8000, interface="asgi", reload=True).serve()
While this works perfectly, one now gets an error when running mypy:
mypy
error: Module "granian" does not explicitly export attribute "Granian" [attr-defined]
See also the mypy docs on this error.
This PR attempts to fix this error by explicitly re-export the class Granian within the __init__.py file. (AFAIS FastAPI does it the same way.)
Granian
__init__.py
P.S. Thanks for the great work on this project! :rocket:
@RafaelWO thank you for your contribution ❤️
Background
To debug Python ASGI apps it is common to add some code to your
main.py
file which could look as follows:While this works perfectly, one now gets an error when running
mypy
:See also the mypy docs on this error.
PR Description
This PR attempts to fix this error by explicitly re-export the class
Granian
within the__init__.py
file. (AFAIS FastAPI does it the same way.)P.S. Thanks for the great work on this project! :rocket: