pallets-eco / flask-debugtoolbar

A toolbar overlay for debugging Flask applications
https://flask-debugtoolbar.readthedocs.io
BSD 3-Clause "New" or "Revised" License
952 stars 146 forks source link

Address Flask 3.0 deprecation warnings on using __version__ (to be removed in Flask 3.1) #229

Closed nickjj closed 7 months ago

nickjj commented 11 months ago

Now that this extension is compatible with Flask 3.0, I'm seeing this with 0.14.1:

../home/python/.local/lib/python3.11/site-packages/flask_debugtoolbar/__init__.py:10
  /home/python/.local/lib/python3.11/site-packages/flask_debugtoolbar/__init__.py:10: DeprecationWarning: The '__version__' attribute is deprecated and will be removed in Flask 3.1. Use feature detection or 'importlib.metadata.version("flask")' instead.
    if version_builder.parse(flask.__version__) >= version_builder.parse("2.2.0"):

  /app/hello/page/views.py:4: DeprecationWarning: The '__version__' attribute is deprecated and will be removed in Flask 3.1. Use feature detection or 'importlib.metadata.version("flask")' instead.
    from flask import __version__

../home/python/.local/lib/python3.11/site-packages/flask_debugtoolbar/panels/versions.py:4
../home/python/.local/lib/python3.11/site-packages/flask_debugtoolbar/panels/versions.py:4
  /home/python/.local/lib/python3.11/site-packages/flask_debugtoolbar/panels/versions.py:4: DeprecationWarning: The '__version__' attribute is deprecated and will be removed in Flask 3.1. Use feature detection or 'importlib.metadata.version("flask")' instead.
    from flask import __version__ as flask_version
nickjj commented 11 months ago

This looks like it'll be addressed in https://github.com/pallets-eco/flask-debugtoolbar/pull/224.

Given 0.14.1 just went out maybe we can keep this open to help avoid duplicate issues, it also documents this issue as being resolved by that PR.

jeffwidman commented 7 months ago

This wasn't addressed by #224, and needs to stay open until this code is removed/updated: https://github.com/pallets-eco/flask-debugtoolbar/blob/efe447fb5fa53258c2e289c579179542bfa0036d/src/flask_debugtoolbar/panels/versions.py#L4