Debian Codegraph @

src/flask_sqlalchemy/__init__.py

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