Here you can see the list of changes between each Kyoukai release.
- Add the ability to have multiple error handlers per function.
- Add
Route.add_path()
.- Fix rules being duplicated in the root mapping.
- Add the ability to override the context class created.
- Debug log full tracebacks on HTTPExceptions inside routes.
- Change log message when building route mapping.
- Explicitly handle
werkzeug.exceptions.BadRequestKeyError
in app processing.- Decompress client body data when a Content-Encoding is detected in the httptools backend.
- Add the ability to override endpoint generation for Route objects.
- Change the routing tree to use
werkzeug.routing.Submount
objects instead of prefix combination.- Allow a Route to have multiple
werkzeug.routing.Rule
objects created from it.- Remove
Route.create_rule()
- replaced byRoute.get_rules()
.Blueprint.route()
androutegroup.route()
will now append new routes to the Route object.- Add HTTP OPTIONS support. Kyoukai will automatically intercept any OPTIONS requests, and return the right response without user code needing to handle it.
- Expose the
werkzeug.routing.Map
onBlueprint.map
.
- Add
errorhandler()
to mark a function inside a route group as an error handler.- Add request hook support to route groups.
- Add
as_html()
,as_plaintext()
,as_json()
helper methods.- Add Host Matching support. See Host Matching.
- Add
RouteGroup
.
- Fix request bodies not being read properly.
- Fix loop propagation.
- Fix http2 module for H2 3.0.0.
- Add
Route.hooks
property toRoute
, which allows route-specific hooks.- Add the ability to disable argument conversion on
Route
objects.- Automatically disable argument conversion on error handlers.
- HTTP/2 is now automatically enabled in all requests over TLS, if available.
- HTTPS is now easier to configure (requires one config file change).
- Add
REMOTE_ADDR
andREMOTE_PORT
to WSGI environ in httptools backend.- Add
REMOTE_ADDR
andREMOTE_PORT
to WSGI environ in h2 backend.
- Automatically stringify the response body.
- Fix Content-Type and Content-Length header parsing.
- Add automatic JSON form parsing.
- Log when a HTTPException is raised inside a route function.
- Automatic argument conversion now ignores functions with _empty params.
- Error handlers can now handle errors that happen in other error handlers.
Version 2.0 is a major overhaul of the library, simplifying it massively and removing a lot of redundant or otherwise overly complex code.
- Requests and responses are now based on Werkzeug data structures. Werkzeug is a much more battle tested library than Kyoukai; it ensures that there are less edge cases during HTTP parsing.
- Routing is now handled by Werkzeug and the Rule/Map based router rather than overly complex regex routes.
- The application object is now I/O blind - it will take in a Request object and produce a Response object, instead of writing to the stream directly.
- A new
gunicorn
HTTP backend has been added - using thegaiohttp
worker, gunicorn can now be connected to Kyoukai.- A new
uwsgi
HTTP backend has been added - uWSGI running in asyncio mode can now be connected to Kyoukai.- A new HTTP/2 backend has been added which uses the pure Python
h2
library as a state machine for parsing HTTP frames.- The
httptools
backend has been rewritten - it is now more reliable and supports chunked data streams.
- Add
depth
property which signifies how deep in the tree the Blueprint is.- The routing tree no longer considers matching routes that don’t start with the prefix of the blueprint.
- Add
tree_path
property which shows the full tree path to a Blueprint.- Add the ability to set 405 error handlers on Blueprints. The routing engine will automatically try and match the 405 on the lowest common ancestor of all routes that failed to match in the blueprint tree.
- Add
blueprint
androute
attributes toHTTPRequestContext
.- Add
ip
andport
attributes toRequest
.- Correctly load cookies from the
Cookie
header from client requests.- Converters will now handle
*args
and**kwargs
in functions properly.- HTTPExceptions have been overhauled to allow early exiting with a custom response. Do not abuse as a replacement for the return statement.
- Large amount of code clean up relating to the embedded HTTP server. The HTTP server now uses httptools to create requests which is more reliable than http_parser.
- Add a default static file handler.
- Routing tree has been improved by allowing two routes with the same path but different methods to reside in two different blueprints.
- Error handlers can now error themselves, and this is handled gracefully.
- If a match is invalid, it will raise a 500 error at compile time, which is usually when routes are first matched.
- Converters can now be awaitables.
- JSON forms are now lazy loaded when
.form
is called.
- Fix crashing at startup without a startup function registered.
- Fix routing tree not working with multiple URL prefixes.
- Fix default converters.
- Add the ability to override the Request and Response classes used in views with
app.request_cls
andapp.response_cls
respectively.- Views now have the ability to change which Route class they use in the decorator.
- Implement the Werkzeug Debugger on 500 errors if the app is in debug mode.
- Add the ability to register a callable to run on startup. This callable can be a regular function or a coroutine.
- Form handling is now handled by Werkzeug.
- Add a new attribute,
kyoukai.request.Request.files
which stores uploaded files from the form passed in.- Requests are no longer parsed multiple times.
- Overhaul template renderers. This allows easier creation of a template renderer with a specific engine without having to use engine-specific code in views.
- Add a Jinja2 based renderer. This can be enabled by passing
template_renderer="jinja2"
in your application constructor.
- Add converters. Converters allow annotations to be added to parameters which will automatically convert the argument passed in to that type, if possible.
- Exception handlers now take an
exception
param as the second arg, which is the HTTPException that caused this error handler to happen.
- Large amount of internal codebase re-written.
- The Blueprint system was overhauled into a tree system which handles routes much better than before.