Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop python 3.7 support #255

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
- {name: '3.10', python: '3.10', os: ubuntu-latest, tox: py310}
- {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39}
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
- {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
- {name: Style, python: '3.10', os: ubuntu-latest, tox: stylecheck}
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ package_dir =

packages = find:
include_package_data = True
python_requires = >=3.7
python_requires = >=3.8

[options.packages.find]
where = src
16 changes: 3 additions & 13 deletions src/flask_debugtoolbar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
import contextvars
import importlib.metadata
import os
import urllib.parse
import warnings

import flask
from flask import Blueprint, current_app, request, g, send_from_directory, url_for
from flask.globals import request_ctx

from jinja2 import __version__ as __jinja_version__
from jinja2 import Environment, PackageLoader

from flask_debugtoolbar.compat import iteritems
from flask_debugtoolbar.toolbar import DebugToolbar
from flask_debugtoolbar.utils import decode_text, gzip_compress, gzip_decompress

try:
# Python 3.8+
from importlib.metadata import version

__version__ = version("Flask-DebugToolbar")
except ImportError:
import pkg_resources

__version__ = pkg_resources.get_distribution("Flask-DebugToolbar").version

__version__ = importlib.metadata.version("flask-debugtoolbar")

module = Blueprint('debugtoolbar', __name__)

Expand Down Expand Up @@ -80,7 +70,7 @@ def __init__(self, app=None):
self.init_app(app)

def init_app(self, app):
for k, v in iteritems(self._default_config(app)):
for k, v in self._default_config(app).items():
app.config.setdefault(k, v)

if not app.config['DEBUG_TB_ENABLED']:
Expand Down
9 changes: 0 additions & 9 deletions src/flask_debugtoolbar/compat.py

This file was deleted.

17 changes: 4 additions & 13 deletions src/flask_debugtoolbar/panels/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import datetime
import logging
try:
import threading
except ImportError:
threading = None
import threading

from flask_debugtoolbar.panels import DebugPanel
from flask_debugtoolbar.utils import format_fname
Expand All @@ -15,9 +12,6 @@

class ThreadTrackingHandler(logging.Handler):
def __init__(self):
if threading is None:
raise NotImplementedError("threading module is not available, \
the logging panel cannot be used without it")
logging.Handler.__init__(self)
self.records = {} # a dictionary that maps threads to log records

Expand Down Expand Up @@ -59,12 +53,9 @@ def _init_once():
# and not configure console logging for the request log.
# Werkzeug's default log level is INFO so this message probably won't
# be seen.
try:
from werkzeug._internal import _log
except ImportError:
pass
else:
_log('debug', 'Initializing Flask-DebugToolbar log handler')
from werkzeug._internal import _log

_log('debug', 'Initializing Flask-DebugToolbar log handler')

handler = ThreadTrackingHandler()
logging.root.addHandler(handler)
Expand Down
21 changes: 4 additions & 17 deletions src/flask_debugtoolbar/panels/versions.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import importlib.metadata
import os
from sysconfig import get_path

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
flask_version = importlib.metadata.version("flask")

_ = lambda x: x

Expand All @@ -37,13 +29,8 @@ def title(self):
return _('Versions')

def content(self):
try:
import importlib.metadata
except ImportError:
packages = []
else:
packages_metadata = [p.metadata for p in importlib.metadata.distributions()]
packages = sorted(packages_metadata, key=lambda p: p['Name'].lower())
packages_metadata = [p.metadata for p in importlib.metadata.distributions()]
packages = sorted(packages_metadata, key=lambda p: p['Name'].lower())

return self.render('panels/versions.html', {
'packages': packages,
Expand Down
6 changes: 0 additions & 6 deletions src/flask_debugtoolbar/templates/panels/versions.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ <h4>Installed Packages</h4>
<td>{{ package.get('Home-page') }}</td>
<td>{{ package.get('Summary') }}</td>
</tr>
{% else %}
<tr>
<td>Python 3.8</td>
<td>NOT INSTALLED</td>
<td>This panel requires Python >= 3.8 in order to display installed packages and version information.</td>
</tr>
{% endfor %}
</tbody>
</table>
5 changes: 1 addition & 4 deletions src/flask_debugtoolbar/toolbar.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
try:
from urllib.parse import unquote
except ImportError:
from urllib import unquote
from urllib.parse import unquote

from flask import url_for, current_app
from werkzeug.utils import import_string
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py3{12,11,10,9,8,7}
py3{12,11,10,9,8}
stylecheck
minimal
skip_missing_interpreters = True
Expand Down
Loading