relative importing from a `.py` inside a `.pyi` file doesn't work
I created stub file for flask_smorest to fix problem with typing, but after that basedpyright start to show errors about "Blueprint" is unkown import and Type of "Blueprint" is unknown
from flask.views import MethodView
from flask_smorest import Blueprint # <-
blp = Blueprint('folder')
although in typings/flask_smorest/__init__.pyi there is an import/re-export of Blueprint
"""
This type stub file was generated by pyright.
"""
from webargs.flaskparser import abort
from .spec import APISpecMixin
from .blueprint import Blueprint # <-
from .pagination import Page
...
this seems to work:
- from .blueprint import Blueprint # <-
+ from flask_smorest.blueprint import Blueprint # <-
i don't think relative imports in .pyi files are able to see the source modules. as far as i can tell this is an upstream issue
Thank you for quick reply! I tried to play with different imports and found a solution using an alias (as operator) in stub file
from .blueprint import Blueprint as Blueprint
that's the correct way to do a re-export anyway (see here). though i'm confused as to why that would prevent the import from being resolved at all. will investigate this