Releases: sanic-org/sanic
Releases · sanic-org/sanic
Version 21.6.0
Features
- #2094 Add
response.eof()
method for closing a stream in a handler - #2097 Allow case-insensitive HTTP Upgrade header
- #2104 Explicit usage of
CIMultiDict
getters - #2109 Consistent use of error loggers
- #2114 New
client_ip
access of connection info instance - #2119 Alternatate classes on instantiation for
Config
andSanic.ctx
- #2133 Implement new version of AST router
- Proper differentiation between
alpha
andstring
param types - Adds a
slug
param type, example:<foo:slug>
- Deprecates
<foo:string>
in favor of<foo:str>
- Deprecates
<foo:number>
in favor of<foo:float>
- Adds a
route.uri
accessor
- Proper differentiation between
- #2136 CLI improvements with new optional params
- #2137 Add version_prefix to URL builders
- #2140 Event autoregistration with
EVENT_AUTOREGISTER
- #2146, #2147 Require stricter names on
Sanic()
andBlueprint()
- #2150 Infinitely reusable and nestable
Blueprint
andBlueprintGroup
- #2154 Upgrade websockets dependency to min version
- #2155 Allow for maximum header sizes to be increased:
REQUEST_MAX_HEADER_SIZE
- #2157 Allow app factory pattern in CLI
- #2165 Change HTTP methods to enums
- #2167 Allow auto-reloading on additional directories
- #2168 Add simple HTTP server to CLI
- #2170 Additional methods for attaching
HTTPMethodView
Bugfixes
- #2091 Fix UserWarning in ASGI mode for missing
__slots__
- #2099 Fix static request handler logging exception on 404
- #2110 Fix
request.args.pop
removes parameters inconsistently - #2107 Fix type hinting for
load_env
- #2127 Make sure ASGI ws subprotocols is a list
- #2128 Fix issue where Blueprint exception handlers do not consistently route to proper handler
Deprecations and Removals
- #2156 Remove config value
REQUEST_BUFFER_QUEUE_SIZE
- #2170
CompositionView
deprecated and marked for removal in 21.12 - #2172 Deprecate
StreamingHTTPResponse
Developer infrastructure
- #2149 Remove Travis CI in favor of GitHub Actions
Improved Documentation
Version 21.3.4
Version 21.3.3
NO RELEASE
Version 21.3.2
Version 21.3.1
Bugfixes
- #2076 Static files inside subfolders are not accessible (404)
Version 21.3.0
Features
- #1876 Unified streaming server
- #2005 New
Request.id
property - #2008 Allow Pathlib Path objects to be passed to
app.static()
helper - #2010 #2031 New startup-optimized router
- #2018 #2064 Listeners for main server process
- #2032 Add raw header info to request object
- #2042 #2060 #2061 Introduce Signals API
- #2043 Add
__str__
and__repr__
to Sanic and Blueprint - #2047 Enable versioning and strict slash on BlueprintGroup
- #2053 Make
get_app
name argument optional - #2055 JSON encoder change via app
- #2063 App and connection level context objects
Bugfixes and issues resolved
- Resolve #1420
url_for
wherestrict_slashes
are on for a path ending in/
- Resolve #1525 Routing is incorrect with some special characters
- Resolve #1653 ASGI headers in body
- Resolve #1722 Using curl in chunk mode
- Resolve #1730 Extra content in ASGI streaming response
- Resolve #1749 Restore broken middleware edge cases
- Resolve #1785 #1804 Synchronous error handlers
- Resolve #1790 Protocol errors did not support async error handlers #1790
- Resolve #1824 Timeout on specific methods
- Resolve #1875 Response timeout error from all routes after returning several timeouts from a specific route
- Resolve #1988 Handling of safe methods with body
- #2001 Raise ValueError when cookie max-age is not an integer
Deprecations and Removals
- #2007
- Config using
from_envvar
- Config using
from_pyfile
- Config using
from_object
- Config using
- #2009 Remove Sanic test client to its own package
- #2036 #2037 Drop Python 3.6 support
Request.endpoint
deprecated in favor ofRequest.name
- handler type name prefixes removed (static, websocket, etc)
Developer infrastructure
- #1995 Create FUNDING.yml
- #2013 Add codeql to CI pipeline
- #2038 Codecov configuration updates
- #2049 Updated setup.py to use
find_packages
Improved Documentation
- #1218 Documentation for sanic.log.* is missing
- #1608 Add documentation on calver and LTS
- #1731 Support mounting application elsewhere than at root path
- #2006 Upgraded type annotations and improved docstrings and API documentation
- #2052 Fix some examples and docs
Miscellaneous
Request.route
property- Better websocket subprotocols support
- Resolve bug with middleware in Blueprint Group when passed callable
- Moves common logic between Blueprint and Sanic into mixins
- Route naming changed to be more consistent
- request endpoint is the route name
- route names are fully namespaced
- Some new convenience decorators:
@app.main_process_start
@app.main_process_stop
@app.before_server_start
@app.after_server_start
@app.before_server_stop
@app.after_server_stop
@app.on_request
@app.on_response
- Fixes
Allow
header that did not includeHEAD
- Using "name" keyword in
url_for
for a "static" route where name does not exist - Cannot have multiple
app.static()
without using the named param - Using "filename" keyword in
url_for
on a file route unquote
in route def (not automatic)routes_all
is tuples- Handler arguments are kwarg only
request.match_info
is now a cached (and not computed) property- Unknown static file mimetype is sent as
application/octet-stream
_host
keyword inurl_for
- Add charset default to
utf-8
for text and js content types if not specified - Version for a route can be str, float, or int
- Route has ctx property
- App has
routes_static
,routes_dynamic
,routes_regex
- #2044 Code cleanup and refactoring
- #2072 Remove
BaseSanic
metaclass - #2074 Performance adjustments in
handle_request_
Version 20.12.3
Version 20.12.2
Version 19.12.5
Version 20.12.1
Features
- #1993 Add disable app registry