forked from orbit-oss/flask
deprecate __version__ attribute
This commit is contained in:
parent
153433f612
commit
293041a290
3 changed files with 23 additions and 2 deletions
|
|
@ -4,6 +4,8 @@ Version 3.0.0
|
|||
Unreleased
|
||||
|
||||
- Remove previously deprecated code. :pr:`5223`
|
||||
- Deprecate the ``__version__`` attribute. Use feature detection, or
|
||||
``importlib.metadata.version("flask")``, instead. :issue:`5230`
|
||||
- Restructure the code such that the Flask (app) and Blueprint
|
||||
classes have Sans-IO bases. :pr:`5127`
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
[project]
|
||||
name = "Flask"
|
||||
version = "3.0.0.dev"
|
||||
description = "A simple framework for building complex web applications."
|
||||
readme = "README.rst"
|
||||
license = {file = "LICENSE.rst"}
|
||||
|
|
@ -26,7 +27,6 @@ dependencies = [
|
|||
"blinker>=1.6.2",
|
||||
"importlib-metadata>=3.6.0; python_version < '3.10'",
|
||||
]
|
||||
dynamic = ["version"]
|
||||
|
||||
[project.urls]
|
||||
Donate = "https://palletsprojects.com/donate"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import typing as t
|
||||
|
||||
from . import json as json
|
||||
from .app import Flask as Flask
|
||||
from .blueprints import Blueprint as Blueprint
|
||||
|
|
@ -38,4 +42,19 @@ from .templating import stream_template_string as stream_template_string
|
|||
from .wrappers import Request as Request
|
||||
from .wrappers import Response as Response
|
||||
|
||||
__version__ = "3.0.0.dev"
|
||||
|
||||
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"
|
||||
" Flask 3.1. Use feature detection or"
|
||||
" 'importlib.metadata.version(\"flask\")' instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return importlib.metadata.version("flask")
|
||||
|
||||
raise AttributeError(name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue