Skip to content

Conversation

dpgaspar
Copy link

Currently there are no package constraints defined for Flask's version, yet flask-sqlalchemy-lite fails with:

  File "./venv/lib/python3.10/site-packages/flask_sqlalchemy_lite/_extension.py", line 12, in <module>
    from flask.sansio.app import App
ModuleNotFoundError: No module named 'flask.sansio'

Solution:
Since App is only used for type checking, this PR introduces a try/except import to fall back to Flask from flask.app in environments where flask.sansio.app is unavailable. This ensures retro compatibility without requiring users to upgrade Flask unnecessarily.

Impact:
This is a minimal and safe change that restores compatibility with Flask versions <3.0 while preserving type checking behavior for 3.x+.

@davidism
Copy link
Member

This wasn't my intention when writing this extension, I missed adding a lower bound on Flask >= 3.1. Flask < 3.1 is no longer supported: https://palletsprojects.com/versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants