- Drop support for Python 3.7, 3.8, and 3.9.
- Update minimum MarkupSafe version to >= 3.0.
- Update minimum Babel version to >= 2.17.
+- Deprecate the ``__version__`` attribute. Use feature detection or
+ ``importlib.metadata.version("jinja2")`` instead.
- Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``.
:pr:`1793`
- Use ``flit_core`` instead of ``setuptools`` as build backend.
[project]
name = "Jinja2"
+version = "3.2.0.dev"
description = "A very fast and expressive template engine."
readme = "README.md"
license = "BSD-3-Clause"
]
requires-python = ">=3.10"
dependencies = ["MarkupSafe>=3.0"]
-dynamic = ["version"]
[project.urls]
Donate = "https://palletsprojects.com/donate"
sandboxed environment.
"""
+from __future__ import annotations
+
+import typing as t
+
from .bccache import BytecodeCache as BytecodeCache
from .bccache import FileSystemBytecodeCache as FileSystemBytecodeCache
from .bccache import MemcachedBytecodeCache as MemcachedBytecodeCache
from .utils import pass_eval_context as pass_eval_context
from .utils import select_autoescape as select_autoescape
-__version__ = "3.2.0.dev0"
+
+def __getattr__(name: str) -> t.Any:
+ if name == "__version__":
+ import importlib.metadata
+ import warnings
+
+ warnings.warn(
+ "The `__version__` attribute is deprecated and will be removed in"
+ " Werkzeug 3.3. Use feature detection or"
+ ' `importlib.metadata.version("werkzeug")` instead.',
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ return importlib.metadata.version("werkzeug")
+
+ raise AttributeError(name)