mirror of
https://github.com/pallets-eco/flask-debugtoolbar.git
synced 2026-04-28 12:29:48 -05:00
Remove deprecated Flask version attribute (#243)
The `flask.__version__` attr is deprecated and will be removed in the Flask 3.1 version. This PR replaced this attr to `importlib.metadata.version`. We could remove the use of `pkg_resources` when we drop the Python 3.7 support.
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
import os
|
||||
from sysconfig import get_path
|
||||
|
||||
from flask import __version__ as flask_version
|
||||
from flask_debugtoolbar.panels import DebugPanel
|
||||
|
||||
try:
|
||||
# Python 3.8+
|
||||
from importlib.metadata import version
|
||||
|
||||
flask_version = version('flask')
|
||||
|
||||
except ImportError:
|
||||
import pkg_resources
|
||||
|
||||
flask_version = pkg_resources.get_distribution('flask').version
|
||||
|
||||
_ = lambda x: x
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user