diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 2adf9a35..7654a223 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -31,7 +31,6 @@ jobs: - {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: '3.6', python: '3.6', os: ubuntu-latest, tox: py36} - {name: 'PyPy', python: 'pypy-3.7', os: ubuntu-latest, tox: pypy37} - {name: Typing, python: '3.10', os: ubuntu-latest, tox: typing} steps: diff --git a/docs/cli.rst b/docs/cli.rst index 6036cb2d..1f29d107 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -112,10 +112,9 @@ shell with the :func:`shell ` command. An application context will be active, and the app instance will be imported. :: $ flask shell - Python 3.6.2 (default, Jul 20 2017, 03:52:27) - [GCC 7.1.1 20170630] on linux - App: example - Instance: /home/user/Projects/hello/instance + Python 3.10.0 (default, Oct 27 2021, 06:59:51) [GCC 11.1.0] on linux + App: example [production] + Instance: /home/david/Projects/pallets/flask/instance >>> Use :meth:`~Flask.shell_context_processor` to add other automatic imports. diff --git a/docs/extensiondev.rst b/docs/extensiondev.rst index 18b4fa7d..dbaf62cb 100644 --- a/docs/extensiondev.rst +++ b/docs/extensiondev.rst @@ -322,9 +322,9 @@ ecosystem remain consistent and compatible. `Official Pallets Themes`_. A link to the documentation or project website must be in the PyPI metadata or the readme. 7. For maximum compatibility, the extension should support the same - versions of Python that Flask supports. 3.6+ is recommended as of - 2020. Use ``python_requires=">= 3.6"`` in ``setup.py`` to indicate - supported versions. + versions of Python that Flask supports. 3.7+ is recommended as of + December 2021. Use ``python_requires=">= 3.7"`` in ``setup.py`` to + indicate supported versions. .. _PyPI: https://pypi.org/search/?c=Framework+%3A%3A+Flask .. _mailinglist: https://mail.python.org/mailman/listinfo/flask diff --git a/docs/installation.rst b/docs/installation.rst index a5d105f7..6007bbb7 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -6,9 +6,7 @@ Python Version -------------- We recommend using the latest version of Python. Flask supports Python -3.6 and newer. - -``async`` support in Flask requires Python 3.7+ for ``contextvars.ContextVar``. +3.7 and newer. Dependencies diff --git a/setup.cfg b/setup.cfg index e25c1e27..131b3ad3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ classifiers = packages = find: package_dir = = src include_package_data = true -python_requires = >= 3.6 +python_requires = >= 3.7 # Dependencies are in setup.py for GitHub's dependency graph. [options.packages.find] @@ -88,7 +88,7 @@ per-file-ignores = [mypy] files = src/flask -python_version = 3.6 +python_version = 3.7 allow_redefinition = True disallow_subclassing_any = True # disallow_untyped_calls = True diff --git a/src/flask/json/__init__.py b/src/flask/json/__init__.py index 10d5123a..9e553046 100644 --- a/src/flask/json/__init__.py +++ b/src/flask/json/__init__.py @@ -1,3 +1,4 @@ +import dataclasses import decimal import io import json as _json @@ -16,12 +17,6 @@ if t.TYPE_CHECKING: from ..app import Flask from ..wrappers import Response -try: - import dataclasses -except ImportError: - # Python < 3.7 - dataclasses = None # type: ignore - class JSONEncoder(_json.JSONEncoder): """The default JSON encoder. Handles extra types compared to the diff --git a/tests/test_async.py b/tests/test_async.py index 8276c4a8..c8bb9bf0 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -1,5 +1,4 @@ import asyncio -import sys import pytest @@ -79,7 +78,6 @@ def _async_app(): return app -@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires Python >= 3.7") @pytest.mark.parametrize("path", ["/", "/home", "/bp/", "/view", "/methodview"]) def test_async_route(path, async_app): test_client = async_app.test_client() @@ -89,7 +87,6 @@ def test_async_route(path, async_app): assert b"POST" in response.get_data() -@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires Python >= 3.7") @pytest.mark.parametrize("path", ["/error", "/bp/error"]) def test_async_error_handler(path, async_app): test_client = async_app.test_client() @@ -97,7 +94,6 @@ def test_async_error_handler(path, async_app): assert response.status_code == 412 -@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires Python >= 3.7") def test_async_before_after_request(): app_first_called = False app_before_called = False @@ -154,10 +150,3 @@ def test_async_before_after_request(): test_client.get("/bp/") assert bp_before_called assert bp_after_called - - -@pytest.mark.skipif(sys.version_info >= (3, 7), reason="should only raise Python < 3.7") -def test_async_runtime_error(): - app = Flask(__name__) - with pytest.raises(RuntimeError): - app.async_to_sync(None) diff --git a/tests/test_basic.py b/tests/test_basic.py index 2cb96794..ce85ee71 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -1,6 +1,5 @@ import gc import re -import sys import time import uuid import weakref @@ -1323,7 +1322,6 @@ def test_jsonify_mimetype(app, req_ctx): assert rv.mimetype == "application/vnd.api+json" -@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires Python >= 3.7") def test_json_dump_dataclass(app, req_ctx): from dataclasses import make_dataclass diff --git a/tox.ini b/tox.ini index 6f6e804f..3cbe50f5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py3{11,10,9,8,7,6},pypy37 + py3{11,10,9,8,7},pypy3{8,7} py39-click7 style typing