Skip to content
Myr

drop support for Python 3.8 (#5623)

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

authored by David Lord · committed by GitHub · parents e8b91cd, 1d610e4 · Browse files · 12 files+25 added−42 removed
This commit

State

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

Diff stats

12 files+25 added−42 removed

  • other:+25 added−42 removed

12 files+25 added−42 removed

modified:.github/workflows/tests.yaml-1 removed
modified:docs/async-await.rst-6 removed
21 unmodified lines
22method in views that inherit from the :class:`flask.views.View` class, as23well as all the HTTP method handlers in views that inherit from the24:class:`flask.views.MethodView` class.2526.. admonition:: Using ``async`` on Windows on Python 3.82728 Python 3.8 has a bug related to asyncio on Windows. If you encounter29 something like ``ValueError: set_wakeup_fd only works in main thread``,30 please upgrade to Python 3.9.3126.. admonition:: Using ``async`` with greenlet2728 When using gevent or eventlet to serve an application or patch the29 runtime, greenlet>=1.0 is required. When using PyPy, PyPy>=7.3.7 is
96 unmodified lines
modified:docs/extensiondev.rst+2 added-1 removed
292 unmodified lines
293 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 using ``python_requires=">=version"``.297 Flask itself supports Python >=3.8 as of April 2023, but this will update over time.297 Flask itself supports Python >=3.9 as of October 2024, and this will update298 over time.299300.. _PyPI: https://pypi.org/search/?c=Framework+%3A%3A+Flask301.. _Discord Chat: https://discord.gg/pallets302.. _GitHub Discussions: https://github.com/pallets/flask/discussions
2 unmodified lines
modified:docs/installation.rst+1 added-1 removed
3 unmodified lines
45Python Version6--------------78We recommend using the latest version of Python. Flask supports Python 3.8 and newer.8We recommend using the latest version of Python. Flask supports Python 3.9 and newer.91011Dependencies12------------
132 unmodified lines
modified:src/flask/sansio/scaffold.py+2 added-11 removed
704 unmodified lines
705 assert view_func is not None, "expected view func if endpoint is not provided."706 return view_func.__name__707708709def _path_is_relative_to(path: pathlib.PurePath, base: str) -> bool:710 # Path.is_relative_to doesn't exist until Python 3.9711 try:712 path.relative_to(base)713 return True714 except ValueError:715 return False716717709def _find_package_path(import_name: str) -> str:710 """Find the path that contains the package or module."""711 root_mod_name, _, _ = import_name.partition(".")712
22 unmodified lines
735 )736 search_location = next(737 location738 for location in root_spec.submodule_search_locations748 if _path_is_relative_to(package_path, location)739 if package_path.is_relative_to(location)740 )741 else:742 # Pick the first path.743 search_location = root_spec.submodule_search_locations[0]
23 unmodified lines
767 package_path = _find_package_path(import_name)768 py_prefix = os.path.abspath(sys.prefix)769770 # installed to the system780 if _path_is_relative_to(pathlib.PurePath(package_path), py_prefix):771 if pathlib.PurePath(package_path).is_relative_to(py_prefix):772 return py_prefix, package_path773774 site_parent, site_folder = os.path.split(package_path)775
17 unmodified lines
modified:src/flask/app.py+1 added-1 removed
1243 unmodified lines
1244 rv.status_code = status12451246 # extend existing headers with provided headers1247 if headers:1248 rv.headers.update(headers) # type: ignore[arg-type]1248 rv.headers.update(headers)12491250 return rv12511252 def preprocess_request(self) -> ft.ResponseReturnValue | None:
265 unmodified lines
modified:src/flask/config.py+1 added-4 removed
148 unmodified lines
149150 .. versionadded:: 2.1151 """152 prefix = f"{prefix}_"153 len_prefix = len(prefix)153154 for key in sorted(os.environ):155 if not key.startswith(prefix):156 continue157158 value = os.environ[key]159 key = key.removeprefix(prefix)160161 try:162 value = loads(value)163 except Exception:164 # Keep the value as a string if loading failed.165 pass166167 # Change to key.removeprefix(prefix) on Python >= 3.9.168 key = key[len_prefix:]169167 if "__" not in key:168 # A non-nested key, set directly.169 self[key] = value170 continue
197 unmodified lines
modified:src/flask/helpers.py+2 added-2 removed
3 unmodified lines
4import os5import sys6import typing as t7from datetime import datetime8from functools import lru_cache8from functools import cache9from functools import update_wrapper1011import werkzeug.utils12from werkzeug.exceptions import abort as _wz_abort
609 unmodified lines
622 # filepath is import_name.py for a module, or __init__.py for a package.623 return os.path.dirname(os.path.abspath(filepath)) # type: ignore[no-any-return]624625626@lru_cache(maxsize=None)626@cache627def _split_blueprint_path(name: str) -> list[str]:628 out: list[str] = [name]629630 if "." in name:
3 unmodified lines
modified:src/flask/typing.py+11 added-11 removed
10 unmodified lines
11ResponseValue = t.Union[12 "Response",13 str,14 bytes,15 t.List[t.Any],15 list[t.Any],16 # Only dict is actually accepted, but Mapping allows for TypedDict.17 t.Mapping[str, t.Any],18 t.Iterator[str],19 t.Iterator[bytes],20]2122# the possible types for an individual HTTP header23# This should be a Union, but mypy doesn't pass unless it's a TypeVar.24HeaderValue = t.Union[str, t.List[str], t.Tuple[str, ...]]24HeaderValue = t.Union[str, list[str], tuple[str, ...]]2526# the possible types for HTTP headers27HeadersValue = t.Union[28 "Headers",29 t.Mapping[str, HeaderValue],30 t.Sequence[t.Tuple[str, HeaderValue]],30 t.Sequence[tuple[str, HeaderValue]],31]3233# The possible types returned by a route function.34ResponseReturnValue = t.Union[35 ResponseValue,36 t.Tuple[ResponseValue, HeadersValue],37 t.Tuple[ResponseValue, int],38 t.Tuple[ResponseValue, int, HeadersValue],36 tuple[ResponseValue, HeadersValue],37 tuple[ResponseValue, int],38 tuple[ResponseValue, int, HeadersValue],39 "WSGIApplication",40]4142# Allow any subclass of werkzeug.Response, such as the one from Flask,
12 unmodified lines
55BeforeRequestCallable = t.Union[56 t.Callable[[], t.Optional[ResponseReturnValue]],57 t.Callable[[], t.Awaitable[t.Optional[ResponseReturnValue]]],58]59ShellContextProcessorCallable = t.Callable[[], t.Dict[str, t.Any]]59ShellContextProcessorCallable = t.Callable[[], dict[str, t.Any]]60TeardownCallable = t.Union[61 t.Callable[[t.Optional[BaseException]], None],62 t.Callable[[t.Optional[BaseException]], t.Awaitable[None]],63]64TemplateContextProcessorCallable = t.Union[65 t.Callable[[], t.Dict[str, t.Any]],66 t.Callable[[], t.Awaitable[t.Dict[str, t.Any]]],65 t.Callable[[], dict[str, t.Any]],66 t.Callable[[], t.Awaitable[dict[str, t.Any]]],67]68TemplateFilterCallable = t.Callable[..., t.Any]69TemplateGlobalCallable = t.Callable[..., t.Any]70TemplateTestCallable = t.Callable[..., bool]71URLDefaultCallable = t.Callable[[str, t.Dict[str, t.Any]], None]71URLDefaultCallable = t.Callable[[str, dict[str, t.Any]], None]72URLValuePreprocessorCallable = t.Callable[73 [t.Optional[str], t.Optional[t.Dict[str, t.Any]]], None73 [t.Optional[str], t.Optional[dict[str, t.Any]]], None74]7576# This should take Exception, but that either breaks typing the argument77# with a specific exception, or decorating multiple times with different
13 unmodified lines
modified:CHANGES.rst+1 added
1 unmodified line
2-------------34Unreleased56- Drop support for Python 3.8. :pr:`5623`7- Provide a configuration option to control automatic option8 responses. :pr:`5496`9- ``Flask.open_resource``/``open_instance_resource`` and10 ``Blueprint.open_resource`` take an ``encoding`` parameter to use when
1568 unmodified lines
modified:pyproject.toml+3 added-3 removed
17 unmodified lines
18 "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",19 "Topic :: Software Development :: Libraries :: Application Frameworks",20 "Typing :: Typed",21]22requires-python = ">=3.8"22requires-python = ">=3.9"23dependencies = [24 "Werkzeug>=3.0.0",25 "Jinja2>=3.1.2",26 "itsdangerous>=2.1.2",
50 unmodified lines
77[tool.coverage.paths]78source = ["src", "*/site-packages"]7980[tool.mypy]81python_version = "3.8"81python_version = "3.9"82files = ["src/flask", "tests/typing"]83show_error_codes = true84pretty = true85strict = true
7 unmodified lines
93]94ignore_missing_imports = true9596[tool.pyright]97pythonVersion = "3.8"97pythonVersion = "3.9"98include = ["src/flask", "tests/typing"]99typeCheckingMode = "basic"100101[tool.ruff]
23 unmodified lines
modified:tox.ini+1 added-1 removed
1[tox]2envlist =3 py3{13,12,11,10,9,8}3 py3{13,12,11,10,9}4 pypy3105 py312-min6 py39-dev7 style
53 unmodified lines