sveint / flask-swagger-ui

Swagger UI blueprint for flask

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import fails after pip install: from flask_swagger_ui import get_swaggerui_blueprint

mgardnerpsu opened this issue · comments

I think the import needs to be removed from the flask_swagger_ui/__init__.py file - this works from context of example.py , but not after pip installation into site-packages

Sorry for late reply!

I cannot reproduce this. Tried a clean virtualenv, pip installed the package and tried to import using from flask_swagger_ui import get_swaggerui_blueprint which works fine.

The line in the __init__.py exists to expose the function get_swaggerui_blueprint from the module flask_swagger_ui on the package level, basically letting you write from flask_swagger_ui import get_swaggerui_blueprint instead of from flask_swagger_ui.flask_swagger_ui import get_swaggerui_blueprint.

Please let me know if I misunderstood something.

I have the same issue, which led me to fork it and move everything into the init.py file, othewise using it with tox wouldn't work

edit:
could be related to python3.5 possibly?

Have same issue with import on python3, hovewer successfully resolved after adding relative import in module __init__.py

from .flask_swagger_ui import get_swaggerui_blueprint

have the same problem using python 3.5.1, solved using @rredkovich solution.

Thanks!

I should of course have used relative imports (even though I use python2 still, so I didn't notice). I have committed the fix, will push to pypi shortly.