Skip to content

flask-sqlalchemy-compat v0.2.0

Choose a tag to compare

@cainmagi cainmagi released this 13 Dec 22:39
· 6 commits to main since this release

Introduction

GitHub release (latest SemVer) GitHub all releases GitHub PyPI - Downloads

GitHub Actions (Build) GitHub Actions (Release)

Support the compatibility between flask_sqlalchemy and flask_sqlalchemy_lite. It allows users to make minimal changes when they need to migrate from either one of these two packages to each other.

The main motivation of this package is because flask_sqlalchemy_lite does not support python<=3.8. This package is designed for providing the similar usages when users have to make the flask_sqlalchemy_lite working with python<=3.8 by using flask_sqlalchemy. In this case, users can get rid of the difficulty of maintaining two sets of codes.

Changelog

0.2.0 @ 12/13/2024

📣 New

  1. Make backends.fsa and backends.fsa_lite protected by backends.proxy. The other parts of this project will access backends module by this newly added proxy. This change allows users to deliberately change proxy for testing purposes. For example, the users can disable flask-sqlalchemy by setting proxy.fsa = None even if the package is already installed.
  2. Provide two new methods get_flask_sqlalchemy_proxy_ver(...) and get_flask_sqlalchemy_lite_proxy_ver(...). In run time, they are totally the same as get_flask_sqlalchemy(...) and get_flask_sqlalchemy_lite(...), respectively. The only difference is that the returned values of _proxy_ver(...) are notated by the the proxy classes like SQLAlchemyProxy. Users can use these methods to check the compatibility with the falling back version via the static type checker.
  3. Add three examples (demos): examples.app_fsqla, examples.app_fsqla_lite, usage.
  4. Add unit tests and the corresponding configurations.
  5. Add the GitHub workflow for running the unit tests.

🔧 Fix

  1. Fix: When the module is reloaded, accessing the SQLAlchemyProxy().Model.query may cause RuntimeError. Now, this error has been catched.
  2. Fix: Prevent flake8 from raising F722 when working with older python versions (Python<3.10).

💾 Change

  1. Update the metadata of the package. The chages are made for adjusting the new optional dependencies and tests.
  2. Update the project information for preparing to upload a new PyPI release.

Full Changelog: v0.1.3...v0.2.0