Skip to content

Commit

Permalink
Remove deprecated Flask version attribute (#243)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
greyli authored Apr 12, 2024
1 parent fb28aa9 commit 716f05d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/flask_debugtoolbar/panels/versions.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down

0 comments on commit 716f05d

Please sign in to comment.