Releases: sanic-org/sanic
Releases · sanic-org/sanic
Version 20.12.7
Resolves #2477 and #2478
See also #2495 and GHSA-8cw9-5hmv-77w6
Full Changelog: v20.12.6...v20.12.7
Version 22.6.0
Features
- #2378 Introduce HTTP/3 and autogeneration of TLS certificates in
DEBUG
mode- 👶 EARLY RELEASE FEATURE: Serving Sanic over HTTP/3 is an early release feature. It does not yet fully cover the HTTP/3 spec, but instead aims for feature parity with Sanic's existing HTTP/1.1 server. Websockets, WebTransport, push responses are examples of some features not yet implemented.
- 📦 EXTRA REQUIREMENT: Not all HTTP clients are capable of interfacing with HTTP/3 servers. You may need to install a HTTP/3 capable client.
- 📦 EXTRA REQUIREMENT: In order to use TLS autogeneration, you must install either mkcert or trustme.
- #2416 Add message to
task.cancel
- #2420 Add exception aliases for more consistent naming with standard HTTP response types (
BadRequest
,MethodNotAllowed
,RangeNotSatisfiable
) - #2432 Expose ASGI
scope
as a property on theRequest
object - #2438 Easier access to websocket class for annotation:
from sanic import Websocket
- #2439 New API for reading form values with options:
Request.get_form
- #2445 Add custom
loads
function - #2447, #2486 Improved API to support setting cache control headers
- #2453 Move verbosity filtering to logger
- #2475 Expose getter for current request using
Request.get_current()
Bugfixes
- #2448 Fix to allow running with
pythonw.exe
or places where there is nosys.stdout
- #2451 Trigger
http.lifecycle.request
signal in ASGI mode - #2455 Resolve typing of stacked route definitions
- #2463 Properly catch websocket CancelledError in websocket handler in Python 3.7
Deprecations and Removals
- #2487 v22.6 deprecations and changes
- Optional application registry
- Execution of custom handlers after some part of response was sent
- Configuring fallback handlers on the
ErrorHandler
- Custom
LOGO
setting sanic.response.stream
AsyncioServer.init
Developer infrastructure
Improved Documentation
- #2461 Update example to match current application naming standards
- #2466 Better type annotation for
Extend
- #2485 Improved help messages in CLI
New Contributors
- @azimovMichael made their first contribution in #2432
- @amitay87 made their first contribution in #2461
- @zozzz made their first contribution in #2451
- @kijk2869 made their first contribution in #2466
- @timmo001 made their first contribution in #2448
Full Changelog: v22.3.1...v22.6.0
Version 22.3.2
Full Changelog: v22.3.1...v22.3.2
- Resolve warning issue with error handler mismatch warning
3a1a9f0
Version 22.3.1
What's Changed
Full Changelog: v22.3.0...v22.3.1
Version 22.3.0
Version 22.3.0
Features
- #2347 API for multi-application server
- 🚨 BREAKING CHANGE: The old
sanic.worker.GunicornWorker
has been removed. To run Sanic withgunicorn
, you should use it thruuvicorn
as described in their docs. - 🧁 SIDE EFFECT: Named background tasks are now supported, even in Python 3.7
- 🚨 BREAKING CHANGE: The old
- #2357 Parse
Authorization
header asRequest.credentials
- #2361 Add config option to skip
Touchup
step in application startup - #2372 Updates to CLI help messaging
- #2382 Downgrade warnings to backwater debug messages
- #2396 Allow for
multidict
v0.6 - #2401 Upgrade CLI catching for alternative application run types
- #2402 Conditionally inject CLI arguments into factory
- #2413 Add new start and stop event listeners to reloader process
- #2414 Remove loop as required listener arg
- #2415 Better exception for bad URL parsing
- sanic-routing#47 Add a new extention parameter type:
<file:ext>
,<file:ext=jpg>
,<file:ext=jpg|png|gif|svg>
,<file=int:ext>
,<file=int:ext=jpg|png|gif|svg>
,<file=float:ext=tar.gz>
- 👶 BETA FEATURE: This feature will not work with
path
type matching, and is being released as a beta feature only.
- 👶 BETA FEATURE: This feature will not work with
- sanic-routing#57 Change
register_pattern
to accept astr
orPattern
- sanic-routing#58 Default matching on non-empty strings only, and new
strorempty
pattern type- 🚨 BREAKING CHANGE: Previously a route with a dynamic string parameter (
/<foo>
or/<foo:str>
) would match on any string, including empty strings. It will now only match a non-empty string. To retain the old behavior, you should use the new parameter type:/<foo:strorempty>
.
- 🚨 BREAKING CHANGE: Previously a route with a dynamic string parameter (
Bugfixes
- #2373 Remove
error_logger
on websockets - #2381 Fix newly assigned
None
in task registry - sanic-routing#52 Add type casting to regex route matching
- sanic-routing#60 Add requirements check on regex routes (this resolves, for example, multiple static directories with differing
host
values)
Deprecations and Removals
- #2362 22.3 Deprecations and changes
debug=True
and--debug
do NOT automatically runauto_reload
- Default error render is with plain text (browsers still get HTML by default because
auto
looks at headers) config
is required forErrorHandler.finalize
ErrorHandler.lookup
requires two positional args- Unused websocket protocol args removed
- #2344 Deprecate loading of lowercase environment variables
Developer infrastructure
- #2363 Revert code coverage back to Codecov
- #2405 Upgrade tests for
sanic-routing
changes - sanic-testing#35 Allow for httpx v0.22
Improved Documentation
- #2350 Fix link in README for ASGI
- #2398 Document middleware on_request and on_response
- #2409 Add missing documentation for
Request.respond
Miscellaneous
Version 20.12.6
What's Changed
Full Changelog: v20.12.5...v20.12.6
Version 20.12.5
#2366 Upgrade websockets
version - SECURITY UPDATE
Version 21.12.1
Version 21.12.0
Features
- #2260 Allow early Blueprint registrations to still apply later added objects
- #2262 Noisy exceptions - force logging of all exceptions
- #2264 Optional
uvloop
by configuration - #2270 Vhost support using multiple TLS certificates
- #2277 Change signal routing for increased consistency
- BREAKING CHANGE: If you were manually routing signals there is a breaking change. The signal router's
get
is no longer 100% determinative. There is now an additional step to loop thru the returned signals for proper matching on the requirements. If signals are being dispatched usingapp.dispatch
orbp.dispatch
, there is no change.
- BREAKING CHANGE: If you were manually routing signals there is a breaking change. The signal router's
- #2290 Add contextual exceptions
- #2291 Increase join concat performance
- #2295, #2316, #2331 Restructure of CLI and application state with new displays and more command parity with
app.run
- #2302 Add route context at definition time
- #2304 Named tasks and new API for managing background tasks
- #2307 On app auto-reload, provide insight of changed files
- #2308 Auto extend application with Sanic Extensions if it is installed, and provide first class support for accessing the extensions
- #2309 Builtin signals changed to
Enum
- #2313 Support additional config implementation use case
- #2321 Refactor environment variable hydration logic
- #2327 Prevent sending multiple or mixed responses on a single request
- #2330 Custom type casting on environment variables
- #2332 Make all deprecation notices consistent
- #2335 Allow underscore to start instance names
Bugfixes
- #2273 Replace assignation by typing for
websocket_handshake
- #2285 Fix IPv6 display in startup logs
- #2299 Dispatch
http.lifecyle.response
from exception handler
Deprecations and Removals
- #2306 Removal of deprecated items
Sanic
andBlueprint
may no longer have arbitrary properties attached to themSanic
andBlueprint
forced to have compliant names- alphanumeric +
_
+-
- must start with letter or
_
- alphanumeric +
load_env
keyword argument ofSanic
sanic.exceptions.abort
sanic.views.CompositionView
sanic.response.StreamingHTTPResponse
- NOTE: the
stream()
response method (where you pass a callable streaming function) has been deprecated and will be removed in v22.6. You should upgrade all streaming responses to the new style: https://sanicframework.org/en/guide/advanced/streaming.html#response-streaming
- NOTE: the
- #2320 Remove app instance from Config for error handler setting
Developer infrastructure
- #2251 Change dev install command
- #2286 Change codeclimate complexity threshold from 5 to 10
- #2287 Update host test function names so they are not overwritten
- #2292 Fail CI on error
- #2311, #2324 Do not run tests for draft PRs
- #2336 Remove paths from coverage checks
- #2338 Cleanup ports on tests
Improved Documentation
Miscellaneous
Version 21.9.3
Rerelease of v21.9.2 with some cleanup