Skip to content
Myr

deprecate `__version__` attribute (#5242)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by GitHub · parents 153433f, 293041a · Browse files · 3 files+23 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+23 added−2 removed

  • other:+23 added−2 removed

3 files+23 added−2 removed

modified:src/flask/__init__.py+20 added-1 removed
1from __future__ import annotations23import typing as t45from . import json as json6from .app import Flask as Flask7from .blueprints import Blueprint as Blueprint8from .config import Config as Config
32 unmodified lines
41from .templating import stream_template_string as stream_template_string42from .wrappers import Request as Request43from .wrappers import Response as Response4441__version__ = "3.0.0.dev"4546def __getattr__(name: str) -> t.Any:47 if name == "__version__":48 import importlib.metadata49 import warnings5051 warnings.warn(52 "The '__version__' attribute is deprecated and will be removed in"53 " Flask 3.1. Use feature detection or"54 " 'importlib.metadata.version(\"flask\")' instead.",55 DeprecationWarning,56 stacklevel=2,57 )58 return importlib.metadata.version("flask")5960 raise AttributeError(name)
modified:CHANGES.rst+2 added
2 unmodified lines
34Unreleased56- Remove previously deprecated code. :pr:`5223`7- Deprecate the ``__version__`` attribute. Use feature detection, or8 ``importlib.metadata.version("flask")``, instead. :issue:`5230`9- Restructure the code such that the Flask (app) and Blueprint10 classes have Sans-IO bases. :pr:`5127`1112
1516 unmodified lines
modified:pyproject.toml+1 added-1 removed