Skip to content
Myr

Merge pull request #5072 from pallets/drop-py37

Before adoption: this commit came in with the history the project adopted, so no landing records it.

drop support for Python 3.7

authored by David Lord · committed by GitHub · parents 9659b11, 2e8fe7b · Browse files · 14 files+19 added−40 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

14 files+19 added−40 removed

  • tests:+1 added−3 removed
  • other:+18 added−37 removed

14 files+19 added−40 removed

modified:.github/workflows/tests.yaml+1 added-2 removed
modified:docs/extensiondev.rst+2 added-3 removed
291 unmodified lines
2928. The extension's dependencies should not use upper bounds or assume293 any particular version scheme, but should use lower bounds to294 indicate minimum compatibility support. For example,295 ``sqlalchemy>=1.4``.2969. Indicate the versions of Python supported using297 ``python_requires=">=version"``. Flask itself supports Python >=3.7298 as of December 2021, but this will update over time.2969. Indicate the versions of Python supported using ``python_requires=">=version"``.297 Flask itself supports Python >=3.8 as of April 2023, but this will update over time.298299.. _PyPI: https://pypi.org/search/?c=Framework+%3A%3A+Flask300.. _Discord Chat: https://discord.gg/pallets301.. _GitHub Discussions: https://github.com/pallets/flask/discussions
2 unmodified lines
modified:docs/installation.rst+1 added-2 removed
3 unmodified lines
45Python Version6--------------78We recommend using the latest version of Python. Flask supports Python93.7 and newer.8We recommend using the latest version of Python. Flask supports Python 3.8 and newer.91011Dependencies12------------
132 unmodified lines
modified:examples/celery/pyproject.toml+1 added-1 removed
modified:requirements/tests.in+1 added-1 removed
1pytest2asgiref3greenlet ; python_version < "3.11"4python-dotenv>=1; python_version >= "3.8"4python-dotenv
modified:requirements/tests.txt+2 added-2 removed
1# SHA1:3c8dde35aba20388b22430b17974af8ef8205b4f1# SHA1:42d37aff22e2f1fc447e20d483e13d6d4e066b102#3# This file is autogenerated by pip-compile-multi4# To update, run:5#
8 unmodified lines
14pluggy==1.0.015 # via pytest16pytest==7.3.117 # via -r requirements/tests.in18python-dotenv==1.0.0 ; python_version >= "3.8"18python-dotenv==1.0.019 # via -r requirements/tests.in
modified:src/flask/app.py+2 added-17 removed
1from __future__ import annotations23import functools4import inspect3import logging4import os5import sys6import typing as t7import weakref8from collections.abc import Iterator as _abc_Iterator9from datetime import timedelta10from inspect import iscoroutinefunction11from itertools import chain12from types import TracebackType13from urllib.parse import quote as _url_quote14
53 unmodified lines
68from .wrappers import Request69from .wrappers import Response7071if t.TYPE_CHECKING: # pragma: no cover73 import typing_extensions as te72 from .blueprints import Blueprint73 from .testing import FlaskClient74 from .testing import FlaskCliRunner75
4 unmodified lines
80T_template_filter = t.TypeVar("T_template_filter", bound=ft.TemplateFilterCallable)81T_template_global = t.TypeVar("T_template_global", bound=ft.TemplateGlobalCallable)82T_template_test = t.TypeVar("T_template_test", bound=ft.TemplateTestCallable)8386if sys.version_info >= (3, 8):87 iscoroutinefunction = inspect.iscoroutinefunction88else:8490 def iscoroutinefunction(func: t.Any) -> bool:91 while inspect.ismethod(func):92 func = func.__func__9394 while isinstance(func, functools.partial):95 func = func.func9697 return inspect.iscoroutinefunction(func)989985def _make_timedelta(value: timedelta | int | None) -> timedelta | None:86 if value is None or isinstance(value, timedelta):87 return value88
1325 unmodified lines
1414 self.logger.error(1415 f"Exception on {request.path} [{request.method}]", exc_info=exc_info1416 )14171433 def raise_routing_exception(self, request: Request) -> te.NoReturn:1418 def raise_routing_exception(self, request: Request) -> t.NoReturn:1419 """Intercept routing exceptions and possibly do something else.14201421 In debug mode, intercept a routing redirect and replace it with1422 an error if the body will be discarded.
791 unmodified lines
modified:src/flask/helpers.py+1 added-2 removed
23 unmodified lines
2425if t.TYPE_CHECKING: # pragma: no cover26 from werkzeug.wrappers import Response as BaseResponse27 from .wrappers import Response28 import typing_extensions as te282930def get_debug_flag() -> bool:31 """Get whether debug mode should be enabled for the app, indicated by the
223 unmodified lines
255256 return _wz_redirect(location, code=code, Response=Response)257258260def abort(code: int | BaseResponse, *args: t.Any, **kwargs: t.Any) -> te.NoReturn:259def abort(code: int | BaseResponse, *args: t.Any, **kwargs: t.Any) -> t.NoReturn:260 """Raise an :exc:`~werkzeug.exceptions.HTTPException` for the given261 status code.262263 If :data:`~flask.current_app` is available, it will call its
430 unmodified lines
modified:src/flask/sessions.py+1 added-2 removed
11 unmodified lines
1213from .json.tag import TaggedJSONSerializer1415if t.TYPE_CHECKING: # pragma: no cover16 import typing_extensions as te16 from .app import Flask17 from .wrappers import Request, Response1819
72 unmodified lines
92 available. Will still allow read-only access to the empty session93 but fail on setting.94 """9597 def _fail(self, *args: t.Any, **kwargs: t.Any) -> te.NoReturn:96 def _fail(self, *args: t.Any, **kwargs: t.Any) -> t.NoReturn:97 raise RuntimeError(98 "The session is unavailable because no secret "99 "key was set. Set the secret_key on the "100 "application to something unique and secret."
265 unmodified lines
modified:tests/typing/typing_route.py+1 added-3 removed
1 unmodified line
23import typing as t4from http import HTTPStatus56import typing_extensions as te76from flask import Flask7from flask import jsonify8from flask import stream_template9from flask.templating import render_template
27 unmodified lines
37def hello_json_list() -> t.List[t.Any]:38 return [{"message": "Hello"}, {"message": "World"}]394043class StatusJSON(te.TypedDict):41class StatusJSON(t.TypedDict):42 status: str434445@app.route("/typed-dict")
67 unmodified lines
modified:.pre-commit-config.yaml+1 added-1 removed
4 unmodified lines
5 - repo: https://github.com/asottile/pyupgrade6 rev: v3.3.17 hooks:8 - id: pyupgrade9 args: ["--py37-plus"]9 args: ["--py38-plus"]10 - repo: https://github.com/asottile/reorder_python_imports11 rev: v3.9.012 hooks:13 - id: reorder-python-imports
24 unmodified lines
modified:CHANGES.rst+1 added
1 unmodified line
2-------------34Unreleased56- Drop support for Python 3.7. :pr:`5072`7- Remove previously deprecated code. :pr:`4995`89 - The ``push`` and ``pop`` methods of the deprecated ``_app_ctx_stack`` and10 ``_request_ctx_stack`` objects are removed. ``top`` still exists to give
1467 unmodified lines
modified:pyproject.toml+2 added-2 removed
16 unmodified lines
17 "Topic :: Internet :: WWW/HTTP :: WSGI",18 "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",19 "Topic :: Software Development :: Libraries :: Application Frameworks",20]21requires-python = ">=3.7"21requires-python = ">=3.8"22dependencies = [23 "Werkzeug>=2.2.2",24 "Jinja2>=3.0",25 "itsdangerous>=2.0",
40 unmodified lines
66[tool.coverage.paths]67source = ["src", "*/site-packages"]6869[tool.mypy]70python_version = "3.7"70python_version = "3.8"71files = ["src/flask"]72show_error_codes = true73pretty = true74#strict = true
23 unmodified lines
modified:tox.ini+2 added-2 removed
1[tox]2envlist =3 py3{12,11,10,9,8,7}3 py3{12,11,10,9,8}4 pypy395 py311-min6 py37-dev6 py38-dev7 style8 typing9 docs10skip_missing_interpreters = true
40 unmodified lines