Releases: dymmond/lilya
Version 0.18.2
Added
-
Added support for
Query
parameter markers.- Implemented
alias
support for query parameters to map custom keys. - Introduced
cast
field inQuery
for runtime type coercion with validation. - Improved error handling for missing and invalid query parameter types.
- Implemented
-
Introduced
Header
andCookie
parameter markers withvalue
,required
, andcast
support. -
Expanded documentation into a comprehensive “Request Parameters” guide covering declaration, options, and real-world examples for all three types.
Version 0.18.1
Changed
- Update directives to reflect the new settings.
Fixed
- Cache dependency on
json
native library.
Version 0.18.0
Added
- Support for native cache with default to
InMemory
. - Add support for relative urls from the
URL
datastructure. - Support for OpenAPI on Controllers by applying internal identity descriptors.
Changed
In the past, Lilya was using dataclass
to manage all the settings but we found out that can be a bit combersome for a lot
of people that are more used to slighly cleaner interfaces and therefore, the internal API was updated to stop using @dataclass
and
use directly a typed Settings
object.
- Replace
Settings
to stop using@dataclass
and start using direct objects instead.
Example before
from dataclasses import dataclass, field
from lilya.conf.global_settings import Settings
@dataclass
class MyCustomSettings(Settings):
hosts: list[str] = field(default_factory=lambda: ["example.com"])
Example after
from lilya.conf.global_settings import Settings
class MyCustomSettings(Settings):
hosts: list[str] = ["example.com"]
This makes the code cleaner and readable.
- Apply AnyIO to
DataUpload
instead of using BinaryIO.
Version 0.17.1
Changed
- Dual‑mode support in run_sync: Now accepts either an async function with args or a standalone coroutine object.
- Input normalization: Uses
inspect
to detect and wrap calls into a zero‑argument coroutine factory. - Seamless execution: Drives work on the main thread via
anyio.run
,
with a clean fallback toThreadPoolExecutor
if an event loop is active. - Error clarity: Raises a precise
TypeError
when the argument is neither a coroutine function nor object. - Simplified API: Eliminates nested lambdas by centralizing logic into a single
wrapper_fn
passed toanyio.run
.
Version 0.17.0
Added
- Missing validation that was supposed to go on the version 0.16.10 and it was not pushed.
Changed
- Mark
http_exception
in theException
asasync
to avoid thread creation. - Replace
asyncio.iscoroutinefunction
withinspect.iscoroutinefunction
. - Replace
asyncio
inrun_sync
with anyio. - Refactor
run_sync
fromlilya.compat
.
Version 0.16.10
Fixed
infer_body
with complex dependencies and path params evaluation wheninfer_body=True
Version 0.16.9
Changed
- Unify dependency injection logic for both Controller and handlers.
- Unify logic for body inferring for Controller and handlers.
Version 0.16.8
Added
- Add support for multi-byterange requests and responses.
- Add retro-compatibility for
path_for
with an aliasurl_for
. This allows easier integration with other libraries
that useurl_for
as the method to generate URLs.
Changed
- Add
lru_cache
to some of the methods that are used to generate URLs. This allows for better performance
when generating URLs that are frequently used. - Automatic Generator Unwrapping:
Provide
andasync_resolve_dependencies
now detect both sync and async generator dependencies,
advance them to yield the real return value, and inject that into handlers.
Version 0.16.7
Note
There was a part of the commit that was not properly pushed and this could cause inconsistencies and therefore a quick small release was done.
Changed
- Dependencies with
infer_body
consistency check.
Version 0.16.6
Added
- Lilya
run
directive now injects theg
global context for usage in the directives in offline mode. - Support for http ranges (bytes).
- Support if-range header.
- Added fallback dependency injection: Handlers can now receive dependencies even without explicitly using
Provides()
,
as long as they are defined in the app or route. - Improved optional injection logic: Dependencies declared with
Provides()
are treated as required, while others are injected only if available—ensuring flexibility and safety. - Unified behavior across HTTP and WebSocket handlers: Dependency resolution logic now consistently supports both explicit and fallback injection in all handler types.
Changed
- Don't execute stream or analyze file for options for FileResponse, StreamingResponse. It is certainly unwanted and expensive.
- Don't execute background tasks for options and head. This is certainly unwanted.
- Add
allow_range_requests
parameter toFileResponse
for allowing to disable http range serving. - Deprecate the undocumented
method
parameter. It has no effect anymore. We infer it correctly from scope.
Fixed
- FileResponse and StreamResponse can deduce from scope headers if the request is headless.