__init__.py 653 B

1234567891011121314151617181920212223242526
  1. from __future__ import annotations
  2. import typing as t
  3. from .extension import SQLAlchemy
  4. __all__ = [
  5. "SQLAlchemy",
  6. ]
  7. def __getattr__(name: str) -> t.Any:
  8. if name == "__version__":
  9. import importlib.metadata
  10. import warnings
  11. warnings.warn(
  12. "The '__version__' attribute is deprecated and will be removed in"
  13. " Flask-SQLAlchemy 3.2. Use feature detection or"
  14. " 'importlib.metadata.version(\"flask-sqlalchemy\")' instead.",
  15. DeprecationWarning,
  16. stacklevel=2,
  17. )
  18. return importlib.metadata.version("flask-sqlalchemy")
  19. raise AttributeError(name)