21.6 Changelog, release version, and deprecations (#2172)
* Changelog and version * Rearrange API docs for easier navigation * Version 21.6 docs * Change release workflow * Disable Windows tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from sanic.__version__ import __version__
|
||||
from sanic.app import Sanic
|
||||
from sanic.blueprints import Blueprint
|
||||
from sanic.constants import HTTPMethod
|
||||
from sanic.request import Request
|
||||
from sanic.response import HTTPResponse, html, json, text
|
||||
|
||||
@@ -9,6 +10,7 @@ __all__ = (
|
||||
"__version__",
|
||||
"Sanic",
|
||||
"Blueprint",
|
||||
"HTTPMethod",
|
||||
"HTTPResponse",
|
||||
"Request",
|
||||
"html",
|
||||
|
||||
@@ -1 +1 @@
|
||||
__version__ = "21.3.2"
|
||||
__version__ = "21.6.0"
|
||||
|
||||
@@ -279,8 +279,6 @@ class Blueprint(BaseSanic):
|
||||
app._apply_signal(signal)
|
||||
|
||||
self.routes = [route for route in routes if isinstance(route, Route)]
|
||||
|
||||
# Deprecate these in 21.6
|
||||
self.websocket_routes = [
|
||||
route for route in self.routes if route.ctx.websocket
|
||||
]
|
||||
|
||||
@@ -143,7 +143,7 @@ class StreamingHTTPResponse(BaseHTTPResponse):
|
||||
|
||||
.. warning::
|
||||
|
||||
**Deprecated** and set for removal in v21.6. You can now achieve the
|
||||
**Deprecated** and set for removal in v21.12. You can now achieve the
|
||||
same functionality without a callback.
|
||||
|
||||
.. code-block:: python
|
||||
@@ -174,12 +174,16 @@ class StreamingHTTPResponse(BaseHTTPResponse):
|
||||
status: int = 200,
|
||||
headers: Optional[Union[Header, Dict[str, str]]] = None,
|
||||
content_type: str = "text/plain; charset=utf-8",
|
||||
chunked="deprecated",
|
||||
ignore_deprecation_notice: bool = False,
|
||||
):
|
||||
if chunked != "deprecated":
|
||||
if not ignore_deprecation_notice:
|
||||
warn(
|
||||
"The chunked argument has been deprecated and will be "
|
||||
"removed in v21.6"
|
||||
"Use of the StreamingHTTPResponse is deprecated in v21.6, and "
|
||||
"will be removed in v21.12. Please upgrade your streaming "
|
||||
"response implementation. You can learn more here: "
|
||||
"https://sanicframework.org/en/guide/advanced/streaming.html"
|
||||
"#response-streaming. If you use the builtin stream() or "
|
||||
"file_stream() methods, this upgrade will be be done for you."
|
||||
)
|
||||
|
||||
super().__init__()
|
||||
@@ -241,6 +245,12 @@ class HTTPResponse(BaseHTTPResponse):
|
||||
async def eof(self):
|
||||
await self.send("", True)
|
||||
|
||||
async def __aenter__(self):
|
||||
return self.send
|
||||
|
||||
async def __aexit__(self, *_):
|
||||
await self.eof()
|
||||
|
||||
|
||||
def empty(
|
||||
status=204, headers: Optional[Dict[str, str]] = None
|
||||
@@ -402,7 +412,6 @@ async def file_stream(
|
||||
mime_type: Optional[str] = None,
|
||||
headers: Optional[Dict[str, str]] = None,
|
||||
filename: Optional[str] = None,
|
||||
chunked="deprecated",
|
||||
_range: Optional[Range] = None,
|
||||
) -> StreamingHTTPResponse:
|
||||
"""Return a streaming response object with file data.
|
||||
@@ -415,12 +424,6 @@ async def file_stream(
|
||||
:param chunked: Deprecated
|
||||
:param _range:
|
||||
"""
|
||||
if chunked != "deprecated":
|
||||
warn(
|
||||
"The chunked argument has been deprecated and will be "
|
||||
"removed in v21.6"
|
||||
)
|
||||
|
||||
headers = headers or {}
|
||||
if filename:
|
||||
headers.setdefault(
|
||||
@@ -459,6 +462,7 @@ async def file_stream(
|
||||
status=status,
|
||||
headers=headers,
|
||||
content_type=mime_type,
|
||||
ignore_deprecation_notice=True,
|
||||
)
|
||||
|
||||
|
||||
@@ -467,7 +471,6 @@ def stream(
|
||||
status: int = 200,
|
||||
headers: Optional[Dict[str, str]] = None,
|
||||
content_type: str = "text/plain; charset=utf-8",
|
||||
chunked="deprecated",
|
||||
):
|
||||
"""Accepts an coroutine `streaming_fn` which can be used to
|
||||
write chunks to a streaming response. Returns a `StreamingHTTPResponse`.
|
||||
@@ -488,17 +491,12 @@ def stream(
|
||||
:param headers: Custom Headers.
|
||||
:param chunked: Deprecated
|
||||
"""
|
||||
if chunked != "deprecated":
|
||||
warn(
|
||||
"The chunked argument has been deprecated and will be "
|
||||
"removed in v21.6"
|
||||
)
|
||||
|
||||
return StreamingHTTPResponse(
|
||||
streaming_fn,
|
||||
headers=headers,
|
||||
content_type=content_type,
|
||||
status=status,
|
||||
ignore_deprecation_notice=True,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user