Open thomthom opened 3 months ago
As I understand, flask-sqlalchemy-lite is already typed. Importing both flask_sqlalchemy and flask_sqlalchemy_lite in the stubs would be problematic, since that means that users would need to install both with the stubs or using conditional imports in the stubs.
I think the best solution here is to define a protocol in the flask-migrate stubs that describes the common interface used by flask migrate and import and depend on neither in the migrate stubs.
Flask-SQLAlchemy-Lite was just released which is intended to be a replacement for Flask-SQLAlchemy. https://flask-sqlalchemy-lite.readthedocs.io/en/stable/
With that there is then a type conflict with
flask_migrate
: https://github.com/python/typeshed/blob/main/stubs/Flask-Migrate/flask_migrate/__init__.pyi#L52It expects
flask_sqlalchemy.extension.SQLAlchemy
, butflask_sqlalchemy_lite._extension.SQLAlchemy
is now a compatible alternativeI'm pretty new to python so I'm not sure what the best approach to allow the flask_migrate typings to allow both.
Would it work to:
Or is there a better approach?