Releases: dymmond/lilya
Releases · dymmond/lilya
Release list
Version 0.15.5
Added
- Support for multiplexing a session into multiple session contexts.
- Added support for
redirect_exceptionwhen using WSGIMiddleware. This
flag when passed, you can add aHTTPExceptionexception handler that will make Lilya capture the WSGI exceptions. - Exception handlers on a global level can now be passed via settings
Changed
SessionContexthas now the methodsset_session,get_session. No moreget/set_connectionis used.infer_bodyis more assertive in the error messages.
Fixed
- Raise proper error when hitting the
inferredbody instead of a broad complicated message.
Version 0.15.4
Added
- Support for a second form of declaring directives.
- Support for
@directivedecorator on top of a Sayer command making it a directive as
long as it still follows the directive lookup for files.
Fixed
- Internal definitions and client optimisations.
Version 0.15.3
Added
- Added optional
infer_bodyinto the settings. This will allow you to do something like this:
from msgspec import Struct
from pydantic import BaseModel
class User(BaseModel):
name: str
age: int
class Item(Struct):
sku: str
async def process_body(user: User, item: Item):
return {**user.model_dump(), "sku": item.sku}Where the payload is:
{
"user": {"name": "lilya", "age": 20},
"item": {"sku": "test"}
}Assuming you have the encoders for Pydantic and Struct installed in your application (or any other) you
desire.
Lilya uses the internal Encoders to parse and transform them properly.
!!! Note
infer_body is set to False by default but you can override it in the settings.
Another example can be:
from pydantic import BaseModel
class User(BaseModel):
name: str
age: int
async def process_body(user: User):
return userWhere here the post can be directly sent like:
{
"name": "lilya", "age": 20
}Fixed
- Typing for
settings_modulethat was not parsing properly. requestBodywas not displaying when it was required and enabled.- The parsing of the request body via decorator and BaseHandler if
infer_bodyis on.
Version 0.15.2
Fixed
- Migration to Sayer missed the
rundirective argument required as False. - Missing
appswhen generating a project with structure.
Version 0.15.1
Fixed
- This was supposed to go in the release 0.15.0 but a requirement was missing.
Version 0.15.0
Added
- Support for OpenAPI documentation under the new
@openapi()decorator. This is optional and can be used
to document your API endpoints with OpenAPI specifications without the need of any external library.
Changed
lilya runserveris nor revamped with modern UI and logs.lilya runservernow supportsworkersandproxy-headersparameters.
Version 0.14.2
Changed
- Update internals of cli with the latest Sayer version.
Version 0.14.1
Fixed
observablewas causing AnyIO problems.
Version 0.14.0
Due to type advancements of the ecosystem, it was decided to drop support for Python 3.9 so we can unify syntaxes and tools.
Added
- Integration with Sayer for the Lilya CLI. This is a massive milestone for Lilya as it allows
you to use the Lilya CLI with the Sayer CLI, which is a powerful tool for managing your Lilya applications or any other, really.
Changed
- Typing for
add_routeallowing controllers to be recognised. - Rename
show_urlsdirective toshow-urls. This is a breaking change as the directive name has changed but slightly more
consistent with the rest of the directives. - Drop support for Python 3.9 due technology advancements.
Version 0.13.7
Added
- Add
populate_contextparameter forGlobalContextMiddleware. - Add
populate_global_contextparameter forLilya. - Add
populate_sessionparameter forSessionMiddleware. LifespanGlobalContextMiddlewarewhich is initializinggfor lifespans.
Changed
GlobalContextMiddlewarewas initializinggfor lifespans Now this is moved toLifespanGlobalContextMiddleware.
Fixed
SessionContextwas not working for websockets.- Allow sniffing with
GlobalRequestContext.