diff --git a/pyproject.toml b/pyproject.toml index ab7ff0f..053c568 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "Flask-DebugToolbar" -version = "0.15.1" +version = "0.16.0.dev" description = "A toolbar overlay for debugging Flask applications." readme = "README.md" license = { file = "LICENSE.txt" } diff --git a/src/flask_debugtoolbar/__init__.py b/src/flask_debugtoolbar/__init__.py index dbd0520..c39a4f7 100644 --- a/src/flask_debugtoolbar/__init__.py +++ b/src/flask_debugtoolbar/__init__.py @@ -27,7 +27,6 @@ from .utils import gzip_compress from .utils import gzip_decompress -__version__ = importlib.metadata.version("flask-debugtoolbar") _jinja_version = importlib.metadata.version("jinja2") module: Blueprint = Blueprint("debugtoolbar", __name__) @@ -298,3 +297,19 @@ def teardown_request(self, exc: BaseException | None) -> None: def render(self, template_name: str, context: dict[str, t.Any]) -> str: template = self.jinja_env.get_template(template_name) return template.render(**context) + + +def __getattr__(name: str) -> t.Any: + import warnings + + if name == "__version__": + warnings.warn( + "The '__version__' attribute is deprecated and will be removed in" + " Flask-DebugToolbar 0.17. Use feature detection or" + " 'importlib.metadata.version(\"flask-debugtoolbar\")' instead.", + DeprecationWarning, + stacklevel=2, + ) + return importlib.metadata.version("flask-debugtoolbar") + + raise AttributeError(name)