Remove Python3.7 support (#2777)
This commit is contained in:
parent
5dd1623192
commit
4a2b82e42e
1
.github/workflows/pr-bandit.yml
vendored
1
.github/workflows/pr-bandit.yml
vendored
|
@ -17,7 +17,6 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
config:
|
config:
|
||||||
- { python-version: 3.7, tox-env: security}
|
|
||||||
- { python-version: 3.8, tox-env: security}
|
- { python-version: 3.8, tox-env: security}
|
||||||
- { python-version: 3.9, tox-env: security}
|
- { python-version: 3.9, tox-env: security}
|
||||||
- { python-version: "3.10", tox-env: security}
|
- { python-version: "3.10", tox-env: security}
|
||||||
|
|
4
.github/workflows/pr-python-pypy.yml
vendored
4
.github/workflows/pr-python-pypy.yml
vendored
|
@ -5,11 +5,11 @@ on:
|
||||||
tox-env:
|
tox-env:
|
||||||
description: "Tox Env to run on the PyPy Infra"
|
description: "Tox Env to run on the PyPy Infra"
|
||||||
required: false
|
required: false
|
||||||
default: "pypy37"
|
default: "pypy310"
|
||||||
pypy-version:
|
pypy-version:
|
||||||
description: "Version of PyPy to use"
|
description: "Version of PyPy to use"
|
||||||
required: false
|
required: false
|
||||||
default: "pypy-3.7"
|
default: "pypy-3.10"
|
||||||
jobs:
|
jobs:
|
||||||
testPyPy:
|
testPyPy:
|
||||||
name: ut-${{ matrix.config.tox-env }}-${{ matrix.os }}
|
name: ut-${{ matrix.config.tox-env }}-${{ matrix.os }}
|
||||||
|
|
36
.github/workflows/pr-python37.yml
vendored
36
.github/workflows/pr-python37.yml
vendored
|
@ -1,36 +0,0 @@
|
||||||
name: Python 3.7 Tests
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- current-release
|
|
||||||
- "*LTS"
|
|
||||||
types: [opened, synchronize, reopened, ready_for_review]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
testPy37:
|
|
||||||
if: github.event.pull_request.draft == false
|
|
||||||
name: ut-${{ matrix.config.tox-env }}-${{ matrix.os }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: true
|
|
||||||
matrix:
|
|
||||||
# os: [ubuntu-latest, macos-latest]
|
|
||||||
os: [ubuntu-latest]
|
|
||||||
config:
|
|
||||||
- { python-version: 3.7, tox-env: py37 }
|
|
||||||
- { python-version: 3.7, tox-env: py37-no-ext }
|
|
||||||
steps:
|
|
||||||
- name: Checkout the Repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
id: checkout-branch
|
|
||||||
|
|
||||||
- name: Run Unit Tests
|
|
||||||
uses: harshanarayana/custom-actions@main
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.config.python-version }}
|
|
||||||
test-infra-tool: tox
|
|
||||||
test-infra-version: latest
|
|
||||||
action: tests
|
|
||||||
test-additional-args: "-e=${{ matrix.config.tox-env }}"
|
|
||||||
test-failure-retry: "3"
|
|
1
.github/workflows/pr-type-check.yml
vendored
1
.github/workflows/pr-type-check.yml
vendored
|
@ -17,7 +17,6 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
config:
|
config:
|
||||||
# - { python-version: 3.7, tox-env: type-checking}
|
|
||||||
- { python-version: 3.8, tox-env: type-checking}
|
- { python-version: 3.8, tox-env: type-checking}
|
||||||
- { python-version: 3.9, tox-env: type-checking}
|
- { python-version: 3.9, tox-env: type-checking}
|
||||||
- { python-version: "3.10", tox-env: type-checking}
|
- { python-version: "3.10", tox-env: type-checking}
|
||||||
|
|
2
.github/workflows/pr-windows.yml
vendored
2
.github/workflows/pr-windows.yml
vendored
|
@ -16,12 +16,10 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
config:
|
config:
|
||||||
- { python-version: 3.7, tox-env: py37-no-ext }
|
|
||||||
- { python-version: 3.8, tox-env: py38-no-ext }
|
- { python-version: 3.8, tox-env: py38-no-ext }
|
||||||
- { python-version: 3.9, tox-env: py39-no-ext }
|
- { python-version: 3.9, tox-env: py39-no-ext }
|
||||||
- { python-version: "3.10", tox-env: py310-no-ext }
|
- { python-version: "3.10", tox-env: py310-no-ext }
|
||||||
- { python-version: "3.11", tox-env: py310-no-ext }
|
- { python-version: "3.11", tox-env: py310-no-ext }
|
||||||
- { python-version: pypy-3.7, tox-env: pypy37-no-ext }
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
|
|
2
.github/workflows/publish-images.yml
vendored
2
.github/workflows/publish-images.yml
vendored
|
@ -14,7 +14,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
python-version: ["3.8", "3.9", "3.10", "3.11"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
11
sanic/app.py
11
sanic/app.py
|
@ -1227,18 +1227,9 @@ class Sanic(StaticHandleMixin, BaseSanic, StartupMixin, metaclass=TouchUpMeta):
|
||||||
) -> Task:
|
) -> Task:
|
||||||
if not isinstance(task, Future):
|
if not isinstance(task, Future):
|
||||||
prepped = cls._prep_task(task, app, loop)
|
prepped = cls._prep_task(task, app, loop)
|
||||||
if sys.version_info < (3, 8): # no cov
|
|
||||||
task = loop.create_task(prepped)
|
|
||||||
if name:
|
|
||||||
error_logger.warning(
|
|
||||||
"Cannot set a name for a task when using Python 3.7. "
|
|
||||||
"Your task will be created without a name."
|
|
||||||
)
|
|
||||||
task.get_name = lambda: name
|
|
||||||
else:
|
|
||||||
task = loop.create_task(prepped, name=name)
|
task = loop.create_task(prepped, name=name)
|
||||||
|
|
||||||
if name and register and sys.version_info > (3, 7):
|
if name and register:
|
||||||
app._task_registry[name] = task
|
app._task_registry[name] = task
|
||||||
|
|
||||||
return task
|
return task
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import sys
|
|
||||||
|
|
||||||
from typing import Any, Awaitable, Callable, MutableMapping, Optional, Union
|
from typing import Any, Awaitable, Callable, MutableMapping, Optional, Union
|
||||||
|
|
||||||
|
@ -16,20 +15,10 @@ ASGIReceive = Callable[[], Awaitable[ASGIMessage]]
|
||||||
|
|
||||||
class MockProtocol: # no cov
|
class MockProtocol: # no cov
|
||||||
def __init__(self, transport: "MockTransport", loop):
|
def __init__(self, transport: "MockTransport", loop):
|
||||||
# This should be refactored when < 3.8 support is dropped
|
|
||||||
self.transport = transport
|
self.transport = transport
|
||||||
# Fixup for 3.8+; Sanic still supports 3.7 where loop is required
|
|
||||||
loop = loop if sys.version_info[:2] < (3, 8) else None
|
|
||||||
# Optional in 3.9, necessary in 3.10 because the parameter "loop"
|
|
||||||
# was completely removed
|
|
||||||
if not loop:
|
|
||||||
self._not_paused = asyncio.Event()
|
self._not_paused = asyncio.Event()
|
||||||
self._not_paused.set()
|
self._not_paused.set()
|
||||||
self._complete = asyncio.Event()
|
self._complete = asyncio.Event()
|
||||||
else:
|
|
||||||
self._not_paused = asyncio.Event(loop=loop)
|
|
||||||
self._not_paused.set()
|
|
||||||
self._complete = asyncio.Event(loop=loop)
|
|
||||||
|
|
||||||
def pause_writing(self) -> None:
|
def pause_writing(self) -> None:
|
||||||
self._not_paused.clear()
|
self._not_paused.clear()
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from ssl import SSLContext
|
from ssl import SSLContext
|
||||||
from typing import TYPE_CHECKING, Dict, Optional, Type, Union
|
from typing import TYPE_CHECKING, Dict, Optional, Type, Union
|
||||||
|
|
||||||
|
@ -251,7 +249,6 @@ def _serve_http_1(
|
||||||
loop.run_until_complete(asyncio.sleep(0.1))
|
loop.run_until_complete(asyncio.sleep(0.1))
|
||||||
start_shutdown = start_shutdown + 0.1
|
start_shutdown = start_shutdown + 0.1
|
||||||
|
|
||||||
if sys.version_info > (3, 7):
|
|
||||||
app.shutdown_tasks(graceful - start_shutdown)
|
app.shutdown_tasks(graceful - start_shutdown)
|
||||||
|
|
||||||
# Force close non-idle connection after waiting for
|
# Force close non-idle connection after waiting for
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -83,12 +83,11 @@ setup_kwargs = {
|
||||||
"packages": find_packages(exclude=("tests", "tests.*")),
|
"packages": find_packages(exclude=("tests", "tests.*")),
|
||||||
"package_data": {"sanic": ["py.typed", "pages/styles/*"]},
|
"package_data": {"sanic": ["py.typed", "pages/styles/*"]},
|
||||||
"platforms": "any",
|
"platforms": "any",
|
||||||
"python_requires": ">=3.7",
|
"python_requires": ">=3.8",
|
||||||
"classifiers": [
|
"classifiers": [
|
||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
"Environment :: Web Environment",
|
"Environment :: Web Environment",
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Programming Language :: Python :: 3.7",
|
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from sanic_testing.testing import HOST, PORT
|
from sanic_testing.testing import HOST, PORT
|
||||||
|
|
||||||
from sanic import Sanic
|
from sanic import Sanic
|
||||||
|
|
8
tox.ini
8
tox.ini
|
@ -1,14 +1,14 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py37, py38, py39, py310, py311, pyNightly, pypy37, {py37,py38,py39,py310,py311,pyNightly,pypy37}-no-ext, lint, check, security, docs, type-checking
|
envlist = py38, py39, py310, py311, pyNightly, pypy310, {py38,py39,py310,py311,pyNightly,pypy310}-no-ext, lint, check, security, docs, type-checking
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
usedevelop = true
|
usedevelop = true
|
||||||
setenv =
|
setenv =
|
||||||
{py37,py38,py39,py310,py311,pyNightly}-no-ext: SANIC_NO_UJSON=1
|
{py38,py39,py310,py311,pyNightly}-no-ext: SANIC_NO_UJSON=1
|
||||||
{py37,py38,py39,py310,py311,pyNightly}-no-ext: SANIC_NO_UVLOOP=1
|
{py38,py39,py310,py311,pyNightly}-no-ext: SANIC_NO_UVLOOP=1
|
||||||
extras = test, http3
|
extras = test, http3
|
||||||
deps =
|
deps =
|
||||||
httpx==0.23
|
httpx>=0.23
|
||||||
allowlist_externals =
|
allowlist_externals =
|
||||||
pytest
|
pytest
|
||||||
coverage
|
coverage
|
||||||
|
|
Loading…
Reference in New Issue
Block a user