From 5369291c2732f8fe12d16bc804c9e31e97ab87fc Mon Sep 17 00:00:00 2001 From: Adam Hopkins Date: Mon, 31 Oct 2022 11:47:23 +0200 Subject: [PATCH] 22.9 Docs (#2556) --- docs/_static/custom.css | 9 +++++++ docs/sanic/changelog.rst | 1 + docs/sanic/releases/22/22.6.md | 15 +++++++++-- docs/sanic/releases/22/22.9.md | 47 ++++++++++++++++++++++++++++++++++ sanic/http/tls/creators.py | 12 ++++++--- sanic/mixins/startup.py | 3 +-- sanic/server/socket.py | 13 ++++++---- sanic/types/shared_ctx.py | 4 ++- setup.py | 2 +- 9 files changed, 91 insertions(+), 15 deletions(-) create mode 100644 docs/sanic/releases/22/22.9.md diff --git a/docs/_static/custom.css b/docs/_static/custom.css index 0ad06631..135ea8d0 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -2,3 +2,12 @@ .wy-nav-top { background: #444444; } + +#changelog section { + padding-left: 3rem; +} + +#changelog section h2, +#changelog section h3 { + margin-left: -3rem; +} diff --git a/docs/sanic/changelog.rst b/docs/sanic/changelog.rst index 4e8b363c..1f4283de 100644 --- a/docs/sanic/changelog.rst +++ b/docs/sanic/changelog.rst @@ -1,6 +1,7 @@ 📜 Changelog ============ +.. mdinclude:: ./releases/22/22.9.md .. mdinclude:: ./releases/22/22.6.md .. mdinclude:: ./releases/22/22.3.md .. mdinclude:: ./releases/21/21.12.md diff --git a/docs/sanic/releases/22/22.6.md b/docs/sanic/releases/22/22.6.md index 883f044a..d03a6aa7 100644 --- a/docs/sanic/releases/22/22.6.md +++ b/docs/sanic/releases/22/22.6.md @@ -1,6 +1,17 @@ -## Version 22.6.0 🔶 +## Version 22.6.2 -_Current version_ +### Bugfixes + +- [#2522](https://github.com/sanic-org/sanic/pull/2522) Always show server location in ASGI + +## Version 22.6.1 + +### Bugfixes + +- [#2477](https://github.com/sanic-org/sanic/pull/2477) Sanic static directory fails when folder name ends with ".." + + +## Version 22.6.0 ### Features - [#2378](https://github.com/sanic-org/sanic/pull/2378) Introduce HTTP/3 and autogeneration of TLS certificates in `DEBUG` mode diff --git a/docs/sanic/releases/22/22.9.md b/docs/sanic/releases/22/22.9.md new file mode 100644 index 00000000..42d39253 --- /dev/null +++ b/docs/sanic/releases/22/22.9.md @@ -0,0 +1,47 @@ +## Version 22.9.0 🔶 + +_Current version_ + +### Features + +- [#2445](https://github.com/sanic-org/sanic/pull/2445) Add custom loads function +- [#2490](https://github.com/sanic-org/sanic/pull/2490) Make `WebsocketImplProtocol` async iterable +- [#2499](https://github.com/sanic-org/sanic/pull/2499) Sanic Server WorkerManager refactor +- [#2506](https://github.com/sanic-org/sanic/pull/2506) Use `pathlib` for path resolution (for static file serving) +- [#2508](https://github.com/sanic-org/sanic/pull/2508) Use `path.parts` instead of `match` (for static file serving) +- [#2513](https://github.com/sanic-org/sanic/pull/2513) Better request cancel handling +- [#2516](https://github.com/sanic-org/sanic/pull/2516) Add request properties for HTTP method info: + - `request.is_safe` + - `request.is_idempotent` + - `request.is_cacheable` + - *See* [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) *for more information about when these apply* +- [#2522](https://github.com/sanic-org/sanic/pull/2522) Always show server location in ASGI +- [#2526](https://github.com/sanic-org/sanic/pull/2526) Cache control support for static files for returning 304 when appropriate +- [#2533](https://github.com/sanic-org/sanic/pull/2533) Refactor `_static_request_handler` +- [#2540](https://github.com/sanic-org/sanic/pull/2540) Add signals before and after handler execution + - `http.handler.before` + - `http.handler.after` +- [#2542](https://github.com/sanic-org/sanic/pull/2542) Add *[redacted]* to CLI :) +- [#2546](https://github.com/sanic-org/sanic/pull/2546) Add deprecation warning filter +- [#2550](https://github.com/sanic-org/sanic/pull/2550) Middleware priority and performance enhancements + +### Bugfixes + +- [#2495](https://github.com/sanic-org/sanic/pull/2495) Prevent directory traversion with static files +- [#2515](https://github.com/sanic-org/sanic/pull/2515) Do not apply double slash to paths in certain static dirs in Blueprints + +### Deprecations and Removals + +- [#2525](https://github.com/sanic-org/sanic/pull/2525) Warn on duplicate route names, will be prevented outright in v23.3 +- [#2537](https://github.com/sanic-org/sanic/pull/2537) Raise warning and deprecation notice on duplicate exceptions, will be prevented outright in v23.3 + +### Developer infrastructure + +- [#2504](https://github.com/sanic-org/sanic/pull/2504) Cleanup test suite +- [#2505](https://github.com/sanic-org/sanic/pull/2505) Replace Unsupported Python Version Number from the Contributing Doc +- [#2530](https://github.com/sanic-org/sanic/pull/2530) Do not include tests folder in installed package resolver + +### Improved Documentation + +- [#2502](https://github.com/sanic-org/sanic/pull/2502) Fix a few typos +- [#2517](https://github.com/sanic-org/sanic/pull/2517) [#2536](https://github.com/sanic-org/sanic/pull/2536) Add some type hints diff --git a/sanic/http/tls/creators.py b/sanic/http/tls/creators.py index d6a03612..8ffc8650 100644 --- a/sanic/http/tls/creators.py +++ b/sanic/http/tls/creators.py @@ -72,7 +72,8 @@ def get_ssl_context( "without passing a TLS certificate. If you are developing " "locally, please enable DEVELOPMENT mode and Sanic will " "generate a localhost TLS certificate. For more information " - "please see: ___." + "please see: https://sanic.dev/en/guide/deployment/development." + "html#automatic-tls-certificate." ) creator = CertCreator.select( @@ -151,7 +152,8 @@ class CertCreator(ABC): raise SanicException( "Sanic could not find package to create a TLS certificate. " "You must have either mkcert or trustme installed. See " - "_____ for more details." + "https://sanic.dev/en/guide/deployment/development.html" + "#automatic-tls-certificate for more details." ) return creator @@ -203,7 +205,8 @@ class MkcertCreator(CertCreator): "to proceed. Installation instructions can be found here: " "https://github.com/FiloSottile/mkcert.\n" "Find out more information about your options here: " - "_____" + "https://sanic.dev/en/guide/deployment/development.html#" + "automatic-tls-certificate" ) from e def generate_cert(self, localhost: str) -> ssl.SSLContext: @@ -260,7 +263,8 @@ class TrustmeCreator(CertCreator): "to proceed. Installation instructions can be found here: " "https://github.com/python-trio/trustme.\n" "Find out more information about your options here: " - "_____" + "https://sanic.dev/en/guide/deployment/development.html#" + "automatic-tls-certificate" ) def generate_cert(self, localhost: str) -> ssl.SSLContext: diff --git a/sanic/mixins/startup.py b/sanic/mixins/startup.py index 88071221..7dc21f6a 100644 --- a/sanic/mixins/startup.py +++ b/sanic/mixins/startup.py @@ -734,8 +734,7 @@ class StartupMixin(metaclass=SanicMeta): except IndexError: raise RuntimeError( f"No server information found for {primary.name}. Perhaps you " - "need to run app.prepare(...)?\n" - "See ____ for more information." + "need to run app.prepare(...)?" ) from None socks = [] diff --git a/sanic/server/socket.py b/sanic/server/socket.py index 3340756b..a77e80a0 100644 --- a/sanic/server/socket.py +++ b/sanic/server/socket.py @@ -113,13 +113,16 @@ def configure_socket( backlog=backlog, ) except OSError as e: # no cov - raise ServerError( - f"Sanic server could not start: {e}.\n" + error = ServerError( + f"Sanic server could not start: {e}.\n\n" "This may have happened if you are running Sanic in the " "global scope and not inside of a " - '`if __name__ == "__main__"` block. See more information: ' - "____." - ) from e + '`if __name__ == "__main__"` block.\n\nSee more information: ' + "https://sanic.dev/en/guide/deployment/manager.html#" + "how-sanic-server-starts-processes\n" + ) + error.quiet = True + raise error sock.set_inheritable(True) server_settings["sock"] = sock server_settings["host"] = None diff --git a/sanic/types/shared_ctx.py b/sanic/types/shared_ctx.py index dbe9ba42..e0c069b2 100644 --- a/sanic/types/shared_ctx.py +++ b/sanic/types/shared_ctx.py @@ -44,7 +44,9 @@ class SharedContext(SimpleNamespace): f"{Colors.YELLOW}with type {Colors.PURPLE}{type(value)} " f"{Colors.YELLOW}was added to shared_ctx. It may not " "not function as intended. Consider using the regular " - f"ctx. For more information, please see ____.{Colors.END}" + f"ctx.\nFor more information, please see https://sanic.dev/en" + "/guide/deployment/manager.html#using-shared-context-between-" + f"worker-processes.{Colors.END}" ) @property diff --git a/setup.py b/setup.py index 69adc63d..40a6e60e 100644 --- a/setup.py +++ b/setup.py @@ -94,7 +94,7 @@ requirements = [ ] tests_require = [ - "sanic-testing>=22.9.0b2", + "sanic-testing>=22.9.0", "pytest==7.1.*", "coverage", "beautifulsoup4",