Merge in changes from 3.6 drop
This commit is contained in:
commit
070236677c
20
.travis.yml
20
.travis.yml
|
@ -5,12 +5,6 @@ cache:
|
||||||
- $HOME/.cache/pip
|
- $HOME/.cache/pip
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- env: TOX_ENV=py36
|
|
||||||
python: 3.6
|
|
||||||
name: "Python 3.6 with Extensions"
|
|
||||||
- env: TOX_ENV=py36-no-ext
|
|
||||||
python: 3.6
|
|
||||||
name: "Python 3.6 without Extensions"
|
|
||||||
- env: TOX_ENV=py37
|
- env: TOX_ENV=py37
|
||||||
python: 3.7
|
python: 3.7
|
||||||
dist: xenial
|
dist: xenial
|
||||||
|
@ -41,9 +35,6 @@ matrix:
|
||||||
dist: bionic
|
dist: bionic
|
||||||
sudo: true
|
sudo: true
|
||||||
name: "Python 3.9 without Extensions"
|
name: "Python 3.9 without Extensions"
|
||||||
- env: TOX_ENV=type-checking
|
|
||||||
python: 3.6
|
|
||||||
name: "Python 3.6 Type checks"
|
|
||||||
- env: TOX_ENV=type-checking
|
- env: TOX_ENV=type-checking
|
||||||
python: 3.7
|
python: 3.7
|
||||||
name: "Python 3.7 Type checks"
|
name: "Python 3.7 Type checks"
|
||||||
|
@ -54,17 +45,6 @@ matrix:
|
||||||
python: 3.9
|
python: 3.9
|
||||||
dist: bionic
|
dist: bionic
|
||||||
name: "Python 3.9 Type checks"
|
name: "Python 3.9 Type checks"
|
||||||
- env: TOX_ENV=lint
|
|
||||||
python: 3.6
|
|
||||||
name: "Python 3.6 Linter checks"
|
|
||||||
- env: TOX_ENV=check
|
|
||||||
python: 3.6
|
|
||||||
name: "Python 3.6 Package checks"
|
|
||||||
- env: TOX_ENV=security
|
|
||||||
python: 3.6
|
|
||||||
dist: xenial
|
|
||||||
sudo: true
|
|
||||||
name: "Python 3.6 Bandit security scan"
|
|
||||||
- env: TOX_ENV=security
|
- env: TOX_ENV=security
|
||||||
python: 3.7
|
python: 3.7
|
||||||
dist: xenial
|
dist: xenial
|
||||||
|
|
|
@ -130,6 +130,7 @@ And, we can verify it is working: ``curl localhost:8000 -i``
|
||||||
|
|
||||||
**Now, let's go build something fast!**
|
**Now, let's go build something fast!**
|
||||||
|
|
||||||
|
Minimum Python version is 3.7. If you need Python 3.6 support, please use v20.12LTS.
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
|
|
|
@ -109,12 +109,6 @@ sanic.server
|
||||||
:members:
|
:members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
sanic.static
|
|
||||||
------------
|
|
||||||
|
|
||||||
.. automodule:: sanic.static
|
|
||||||
:members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
sanic.views
|
sanic.views
|
||||||
-----------
|
-----------
|
||||||
|
|
|
@ -159,7 +159,7 @@ class Sanic(BaseSanic):
|
||||||
is delayed until before server start.
|
is delayed until before server start.
|
||||||
|
|
||||||
`See user guide
|
`See user guide
|
||||||
<https://sanicframework.org/guide/basics/tasks.html#background-tasks>`_
|
<https://sanicframework.org/guide/basics/tasks.html#background-tasks>`__
|
||||||
|
|
||||||
:param task: future, couroutine or awaitable
|
:param task: future, couroutine or awaitable
|
||||||
"""
|
"""
|
||||||
|
@ -357,7 +357,7 @@ class Sanic(BaseSanic):
|
||||||
the output URL's query string.
|
the output URL's query string.
|
||||||
|
|
||||||
`See user guide
|
`See user guide
|
||||||
<https://sanicframework.org/guide/basics/routing.html#generating-a-url>`_
|
<https://sanicframework.org/guide/basics/routing.html#generating-a-url>`__
|
||||||
|
|
||||||
:param view_name: string referencing the view name
|
:param view_name: string referencing the view name
|
||||||
:param kwargs: keys and values that are used to build request
|
:param kwargs: keys and values that are used to build request
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
Any,
|
Any,
|
||||||
|
|
|
@ -10,14 +10,13 @@ from typing import (
|
||||||
Dict,
|
Dict,
|
||||||
Iterator,
|
Iterator,
|
||||||
Optional,
|
Optional,
|
||||||
|
Protocol,
|
||||||
Tuple,
|
Tuple,
|
||||||
Union,
|
Union,
|
||||||
)
|
)
|
||||||
from urllib.parse import quote_plus
|
from urllib.parse import quote_plus
|
||||||
from warnings import warn
|
from warnings import warn
|
||||||
|
|
||||||
from typing_extensions import Protocol
|
|
||||||
|
|
||||||
from sanic.compat import Header, open_async
|
from sanic.compat import Header, open_async
|
||||||
from sanic.cookies import CookieJar
|
from sanic.cookies import CookieJar
|
||||||
from sanic.helpers import has_message_body, remove_entity_headers
|
from sanic.helpers import has_message_body, remove_entity_headers
|
||||||
|
|
|
@ -24,7 +24,6 @@ import os
|
||||||
import secrets
|
import secrets
|
||||||
import socket
|
import socket
|
||||||
import stat
|
import stat
|
||||||
import sys
|
|
||||||
|
|
||||||
from asyncio import CancelledError
|
from asyncio import CancelledError
|
||||||
from asyncio.transports import Transport
|
from asyncio.transports import Transport
|
||||||
|
@ -58,7 +57,9 @@ class Signal:
|
||||||
|
|
||||||
|
|
||||||
class ConnInfo:
|
class ConnInfo:
|
||||||
"""Local and remote addresses and SSL status info."""
|
"""
|
||||||
|
Local and remote addresses and SSL status info.
|
||||||
|
"""
|
||||||
|
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
"sockname",
|
"sockname",
|
||||||
|
@ -146,7 +147,6 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
):
|
):
|
||||||
asyncio.set_event_loop(loop)
|
asyncio.set_event_loop(loop)
|
||||||
self.loop = loop
|
self.loop = loop
|
||||||
deprecated_loop = self.loop if sys.version_info < (3, 7) else None
|
|
||||||
self.app: Sanic = app
|
self.app: Sanic = app
|
||||||
self.url = None
|
self.url = None
|
||||||
self.transport: Optional[Transport] = None
|
self.transport: Optional[Transport] = None
|
||||||
|
@ -168,8 +168,8 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
self.state = state if state else {}
|
self.state = state if state else {}
|
||||||
if "requests_count" not in self.state:
|
if "requests_count" not in self.state:
|
||||||
self.state["requests_count"] = 0
|
self.state["requests_count"] = 0
|
||||||
self._data_received = asyncio.Event(loop=deprecated_loop)
|
self._data_received = asyncio.Event()
|
||||||
self._can_write = asyncio.Event(loop=deprecated_loop)
|
self._can_write = asyncio.Event()
|
||||||
self._can_write.set()
|
self._can_write.set()
|
||||||
self._exception = None
|
self._exception = None
|
||||||
self._unix = unix
|
self._unix = unix
|
||||||
|
|
5
setup.py
5
setup.py
|
@ -64,12 +64,11 @@ setup_kwargs = {
|
||||||
"packages": ["sanic"],
|
"packages": ["sanic"],
|
||||||
"package_data": {"sanic": ["py.typed"]},
|
"package_data": {"sanic": ["py.typed"]},
|
||||||
"platforms": "any",
|
"platforms": "any",
|
||||||
"python_requires": ">=3.6",
|
"python_requires": ">=3.7",
|
||||||
"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.6",
|
|
||||||
"Programming Language :: Python :: 3.7",
|
"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",
|
||||||
|
@ -81,7 +80,7 @@ env_dependency = (
|
||||||
'; sys_platform != "win32" ' 'and implementation_name == "cpython"'
|
'; sys_platform != "win32" ' 'and implementation_name == "cpython"'
|
||||||
)
|
)
|
||||||
ujson = "ujson>=1.35" + env_dependency
|
ujson = "ujson>=1.35" + env_dependency
|
||||||
uvloop = "uvloop>=0.5.3,<0.15.0" + env_dependency
|
uvloop = "uvloop>=0.5.3" + env_dependency
|
||||||
|
|
||||||
requirements = [
|
requirements = [
|
||||||
"sanic-routing",
|
"sanic-routing",
|
||||||
|
|
|
@ -32,9 +32,6 @@ def test_app_loop_running(app):
|
||||||
assert response.text == "pass"
|
assert response.text == "pass"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
|
||||||
sys.version_info < (3, 7), reason="requires python3.7 or higher"
|
|
||||||
)
|
|
||||||
def test_create_asyncio_server(app):
|
def test_create_asyncio_server(app):
|
||||||
if not uvloop_installed():
|
if not uvloop_installed():
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
@ -44,9 +41,6 @@ def test_create_asyncio_server(app):
|
||||||
assert srv.is_serving() is True
|
assert srv.is_serving() is True
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
|
||||||
sys.version_info < (3, 7), reason="requires python3.7 or higher"
|
|
||||||
)
|
|
||||||
def test_asyncio_server_no_start_serving(app):
|
def test_asyncio_server_no_start_serving(app):
|
||||||
if not uvloop_installed():
|
if not uvloop_installed():
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
@ -59,9 +53,6 @@ def test_asyncio_server_no_start_serving(app):
|
||||||
assert srv.is_serving() is False
|
assert srv.is_serving() is False
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
|
||||||
sys.version_info < (3, 7), reason="requires python3.7 or higher"
|
|
||||||
)
|
|
||||||
def test_asyncio_server_start_serving(app):
|
def test_asyncio_server_start_serving(app):
|
||||||
if not uvloop_installed():
|
if not uvloop_installed():
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
|
@ -86,11 +86,7 @@ def test_listeners_triggered():
|
||||||
with pytest.warns(UserWarning):
|
with pytest.warns(UserWarning):
|
||||||
server.run()
|
server.run()
|
||||||
|
|
||||||
all_tasks = (
|
all_tasks = asyncio.all_tasks(asyncio.get_event_loop())
|
||||||
asyncio.Task.all_tasks()
|
|
||||||
if sys.version_info < (3, 7)
|
|
||||||
else asyncio.all_tasks(asyncio.get_event_loop())
|
|
||||||
)
|
|
||||||
for task in all_tasks:
|
for task in all_tasks:
|
||||||
task.cancel()
|
task.cancel()
|
||||||
|
|
||||||
|
@ -140,11 +136,7 @@ def test_listeners_triggered_async(app):
|
||||||
with pytest.warns(UserWarning):
|
with pytest.warns(UserWarning):
|
||||||
server.run()
|
server.run()
|
||||||
|
|
||||||
all_tasks = (
|
all_tasks = asyncio.all_tasks(asyncio.get_event_loop())
|
||||||
asyncio.Task.all_tasks()
|
|
||||||
if sys.version_info < (3, 7)
|
|
||||||
else asyncio.all_tasks(asyncio.get_event_loop())
|
|
||||||
)
|
|
||||||
for task in all_tasks:
|
for task in all_tasks:
|
||||||
task.cancel()
|
task.cancel()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user