diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4e140cc265..a31ed24ad2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -313,8 +313,8 @@ Version 21.3.0 `#2074 `_ Performance adjustments in ``handle_request_`` -Version 20.12.3 🔷 ------------------- +Version 20.12.3 +--------------- `Current LTS version` @@ -350,8 +350,8 @@ Version 19.12.5 `#2027 `_ Remove old chardet requirement, add in hard multidict requirement -Version 20.12.0 🔹 ------------------ +Version 20.12.0 +--------------- **Features** diff --git a/SECURITY.md b/SECURITY.md index 8f3aaefb9b..6b74709c3e 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -7,14 +7,15 @@ Sanic releases long term support release once a year in December. LTS releases r | Version | LTS | Supported | | ------- | ------------- | ----------------------- | -| 22.9 | | :white_check_mark: | +| 22.12 | until 2024-12 | :white_check_mark: | +| 22.9 | | :x: | | 22.6 | | :x: | | 22.3 | | :x: | -| 21.12 | until 2023-12 | :white_check_mark: | +| 21.12 | until 2023-12 | :ballot_box_with_check: | | 21.9 | | :x: | | 21.6 | | :x: | | 21.3 | | :x: | -| 20.12 | until 2022-12 | :ballot_box_with_check: | +| 20.12 | | :x: | | 20.9 | | :x: | | 20.6 | | :x: | | 20.3 | | :x: | diff --git a/docs/sanic/changelog.rst b/docs/sanic/changelog.rst index 1f4283dec1..88ae10aaec 100644 --- a/docs/sanic/changelog.rst +++ b/docs/sanic/changelog.rst @@ -1,6 +1,7 @@ 📜 Changelog ============ +.. mdinclude:: ./releases/22/22.12.md .. mdinclude:: ./releases/22/22.9.md .. mdinclude:: ./releases/22/22.6.md .. mdinclude:: ./releases/22/22.3.md diff --git a/docs/sanic/releases/22/22.12.md b/docs/sanic/releases/22/22.12.md new file mode 100644 index 0000000000..8a3bd3900d --- /dev/null +++ b/docs/sanic/releases/22/22.12.md @@ -0,0 +1,55 @@ +## Version 22.12.0 🔶 + +_Current version_ + +### Features + +- [#2569](https://github.com/sanic-org/sanic/pull/2569) Add `JSONResponse` class with some convenient methods when updating a response object +- [#2598](https://github.com/sanic-org/sanic/pull/2598) Change `uvloop` requirement to `>=0.15.0` +- [#2609](https://github.com/sanic-org/sanic/pull/2609) Add compatibility with `websockets` v11.0 +- [#2610](https://github.com/sanic-org/sanic/pull/2610) Kill server early on worker error + - Raise deadlock timeout to 30s +- [#2617](https://github.com/sanic-org/sanic/pull/2617) Scale number of running server workers +- [#2621](https://github.com/sanic-org/sanic/pull/2621) [#2634](https://github.com/sanic-org/sanic/pull/2634) Send `SIGKILL` on subsequent `ctrl+c` to force worker exit +- [#2622](https://github.com/sanic-org/sanic/pull/2622) Add API to restart all workers from the multiplexer +- [#2624](https://github.com/sanic-org/sanic/pull/2624) Default to `spawn` for all subprocesses unless specifically set: + ```python + from sanic import Sanic + + Sanic.start_method = "fork" + ``` +- [#2625](https://github.com/sanic-org/sanic/pull/2625) Filename normalisation of form-data/multipart file uploads +- [#2626](https://github.com/sanic-org/sanic/pull/2626) Move to HTTP Inspector: + - Remote access to inspect running Sanic instances + - TLS support for encrypted calls to Inspector + - Authentication to Inspector with API key + - Ability to extend Inspector with custom commands +- [#2632](https://github.com/sanic-org/sanic/pull/2632) Control order of restart operations +- [#2633](https://github.com/sanic-org/sanic/pull/2633) Move reload interval to class variable +- [#2636](https://github.com/sanic-org/sanic/pull/2636) Add `priority` to `register_middleware` method +- [#2639](https://github.com/sanic-org/sanic/pull/2639) Add `unquote` to `add_route` method +- [#2640](https://github.com/sanic-org/sanic/pull/2640) ASGI websockets to receive `text` or `bytes` + + +### Bugfixes + +- [#2607](https://github.com/sanic-org/sanic/pull/2607) Force socket shutdown before close to allow rebinding +- [#2590](https://github.com/sanic-org/sanic/pull/2590) Use actual `StrEnum` in Python 3.11+ +- [#2615](https://github.com/sanic-org/sanic/pull/2615) Ensure middleware executes only once per request timeout +- [#2627](https://github.com/sanic-org/sanic/pull/2627) Crash ASGI application on lifespan failure +- [#2635](https://github.com/sanic-org/sanic/pull/2635) Resolve error with low-level server creation on Windows + + +### Deprecations and Removals + +- [#2608](https://github.com/sanic-org/sanic/pull/2608) [#2630](https://github.com/sanic-org/sanic/pull/2630) Signal conditions and triggers saved on `signal.extra` +- [#2626](https://github.com/sanic-org/sanic/pull/2626) Move to HTTP Inspector + - 🚨 *BREAKING CHANGE*: Moves the Inspector to a Sanic app from a simple TCP socket with a custom protocol + - *DEPRECATE*: The `--inspect*` commands have been deprecated in favor of `inspect ...` commands +- [#2628](https://github.com/sanic-org/sanic/pull/2628) Replace deprecated `distutils.strtobool` + + +### Developer infrastructure + +- [#2612](https://github.com/sanic-org/sanic/pull/2612) Add CI testing for Python 3.11 + diff --git a/docs/sanic/releases/22/22.9.md b/docs/sanic/releases/22/22.9.md index 42d3925376..dbebff25b4 100644 --- a/docs/sanic/releases/22/22.9.md +++ b/docs/sanic/releases/22/22.9.md @@ -1,6 +1,33 @@ -## Version 22.9.0 🔶 +## Version 22.9.1 -_Current version_ +### Features + +- [#2585](https://github.com/sanic-org/sanic/pull/2585) Improved error message when no applications have been registered + + +### Bugfixes + +- [#2578](https://github.com/sanic-org/sanic/pull/2578) Add certificate loader for in process certificate creation +- [#2591](https://github.com/sanic-org/sanic/pull/2591) Do not use sentinel identity for `spawn` compatibility +- [#2592](https://github.com/sanic-org/sanic/pull/2592) Fix properties in nested blueprint groups +- [#2595](https://github.com/sanic-org/sanic/pull/2595) Introduce sleep interval on new worker reloader + + +### Deprecations and Removals + + +### Developer infrastructure + +- [#2588](https://github.com/sanic-org/sanic/pull/2588) Markdown templates on issue forms + + +### Improved Documentation + +- [#2556](https://github.com/sanic-org/sanic/pull/2556) v22.9 documentation +- [#2582](https://github.com/sanic-org/sanic/pull/2582) Cleanup documentation on Windows support + + +## Version 22.9.0 ### Features diff --git a/sanic/__version__.py b/sanic/__version__.py index 5b00c1e128..ea30ce64c4 100644 --- a/sanic/__version__.py +++ b/sanic/__version__.py @@ -1 +1 @@ -__version__ = "22.12.0a0" +__version__ = "22.12.0" diff --git a/sanic/app.py b/sanic/app.py index cbefcc4d9d..0d232d6e4c 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -164,7 +164,7 @@ class Sanic(BaseSanic, StartupMixin, metaclass=TouchUpMeta): def __init__( self, - name: str = None, + name: Optional[str] = None, config: Optional[Config] = None, ctx: Optional[Any] = None, router: Optional[Router] = None, diff --git a/sanic/base/root.py b/sanic/base/root.py index 7fe769882b..b98b341906 100644 --- a/sanic/base/root.py +++ b/sanic/base/root.py @@ -1,6 +1,6 @@ import re -from typing import Any +from typing import Any, Optional from sanic.base.meta import SanicMeta from sanic.exceptions import SanicException @@ -24,7 +24,9 @@ class BaseSanic( ): __slots__ = ("name",) - def __init__(self, name: str = None, *args: Any, **kwargs: Any) -> None: + def __init__( + self, name: Optional[str] = None, *args: Any, **kwargs: Any + ) -> None: class_name = self.__class__.__name__ if name is None: diff --git a/sanic/cli/app.py b/sanic/cli/app.py index 3884a15d49..30d6abe8c5 100644 --- a/sanic/cli/app.py +++ b/sanic/cli/app.py @@ -61,7 +61,7 @@ def __init__(self) -> None: self.inspecting = False def attach(self): - if sys.argv[1] == "inspect": + if len(sys.argv) > 1 and sys.argv[1] == "inspect": self.inspecting = True self.parser.description = get_logo(True) make_inspector_parser(self.parser) @@ -137,7 +137,9 @@ def _inspector_legacy(self, app_loader: AppLoader): sys.stdout.write( f"\n{Colors.BOLD}{Colors.YELLOW}WARNING:{Colors.END} " "You are using the legacy CLI command that will be removed in " - f"{Colors.RED}v23.3{Colors.END}. See ___ or checkout the new " + f"{Colors.RED}v23.3{Colors.END}. See " + "https://sanic.dev/en/guide/release-notes/v22.12.html" + "#deprecations-and-removals or checkout the new " "style commands:\n\n\t" f"{Colors.YELLOW}sanic inspect --help{Colors.END}\n" ) diff --git a/sanic/cli/inspector.py b/sanic/cli/inspector.py index 31aaee0948..84c8a4e7a3 100644 --- a/sanic/cli/inspector.py +++ b/sanic/cli/inspector.py @@ -53,7 +53,7 @@ def make_inspector_parser(parser: ArgumentParser) -> None: "Or, you can optionally follow inspect with a subcommand. " "If you have created a custom " "Inspector instance, then you can run custom commands. See " - "https://sanic.dev/en/guide/deployment/inspector.html" + "https://sanic.dev/en/guide/deployment/inspector.html " "for more details." ), title=" Subcommands", diff --git a/sanic/config.py b/sanic/config.py index 2b279482e1..4316773d5e 100644 --- a/sanic/config.py +++ b/sanic/config.py @@ -2,6 +2,7 @@ import sys +from abc import ABCMeta from inspect import getmembers, isclass, isdatadescriptor from os import environ from pathlib import Path @@ -75,7 +76,7 @@ } -class DescriptorMeta(type): +class DescriptorMeta(ABCMeta): def __init__(cls, *_): cls.__setters__ = {name for name, _ in getmembers(cls, cls._is_setter)} diff --git a/sanic/handlers.py b/sanic/handlers.py index d77b183eb7..e3aa8646f8 100644 --- a/sanic/handlers.py +++ b/sanic/handlers.py @@ -36,14 +36,6 @@ def __init__( self.debug = False self.base = base - @classmethod - def finalize(cls, *args, **kwargs): - deprecation( - "ErrorHandler.finalize is deprecated and no longer needed. " - "Please remove update your code to remove it. ", - 22.12, - ) - def _full_lookup(self, exception, route_name: Optional[str] = None): return self.lookup(exception, route_name) diff --git a/sanic/http/http1.py b/sanic/http/http1.py index 0cf2fd1177..304e5e5e04 100644 --- a/sanic/http/http1.py +++ b/sanic/http/http1.py @@ -71,7 +71,6 @@ class Http(Stream, metaclass=TouchUpMeta): "request_body", "request_bytes", "request_bytes_left", - "request_max_size", "response", "response_func", "response_size", diff --git a/sanic/http/stream.py b/sanic/http/stream.py index 9b413195bd..f6436916cd 100644 --- a/sanic/http/stream.py +++ b/sanic/http/stream.py @@ -19,7 +19,7 @@ class Stream: request_max_size: Union[int, float] __touchup__: Tuple[str, ...] = tuple() - __slots__ = () + __slots__ = ("request_max_size",) def respond( self, response: BaseHTTPResponse diff --git a/sanic/worker/manager.py b/sanic/worker/manager.py index b2be031843..297c5a0e81 100644 --- a/sanic/worker/manager.py +++ b/sanic/worker/manager.py @@ -207,7 +207,7 @@ def wait_for_ack(self): # no cov "online in the allowed time. Sanic is shutting down to avoid a " f"deadlock. The current threshold is {self.THRESHOLD / 10}s. " "If this problem persists, please check out the documentation " - "___." + "https://sanic.dev/en/guide/deployment/manager.html#worker-ack." ) while not self._all_workers_ack(): if self.monitor_subscriber.poll(0.1):