This is the first beta release of Litestar 2.0!
What does that mean?
In practical terms, it means that all of the major changes are done, and you can start evaluating the 2.0 release. Upcoming beta releases will mostly include bugfixes, and you can expect a generally stable interface.
This release however is not feature complete, and we'll still be adding new features until the first rc
(release candidate) release preceding the 2.0 release.
What's Changed
New features
General
- Expose
ParsedType
as public API by @peterschutt in #1677 - Add
--pdb
flag andLITESTAR_PDB
environment variable by @provinzkraut in #1742 - Improve schema generation for constrained fields (msgspec and pydantic) by @Goldziher in #1751
- Add
operation_class
argument to HTTP route handlers to override OpenAPIOperation
class by @smithk86 in #1732 - Handle nested Literal annotations for OpenApi schema generation by @gsakkis in #1829
- Add
--reload-dir
option to CLIrun
command by @peterschutt in #1689 - Optional
rich-click
integration by @cofin in #1745 - Allow extra attributes on JWTs by @cofin in #1695
- Add default modes for
WebSocket
iter_
methods by @provinzkraut in #1733
SQLAlchemy repository
- Add synchronous SQLAlchemy repository pattern by @cofin in #1683
- Add oracledb support by @cofin in #1694
- Add duckdb and Google spanner support by @cofin in #1744
- Add JSON check constraint for Oracle dialect by @cofin in #1780
- Add timezone aware datetime by @cofin in #1816
- Exclude unloaded columns on
to_dict
by @cofin in #1802 - Enforce UTC timestamps are stored and returned by @cofin in #1816
DTO
- Support nested keyword arguments in
DTOData.create_instance()
by @peterschutt in #1741 - Support hybrid properties and association proxies in
SQLAlchemyDTO
by @peterschutt in #1754 and #1776 - Support transfer to generic collection types by @peterschutt in #1764
- Support data transfer for non-generic builtin collection annotations by @peterschutt in #1799
- Exclude leading underscore fields by default by @peterschutt in #1777
- Msgspec and Pydantic DTO factory implementations by @peterschutt in #1712
- Factory: Support for arbitrary generic wrappers by @peterschutt in #1801
Bugfixes
- Fix #1674: Store and reuse state
deep_copy
directive when copying state by @peterschutt in #1678 - Fix #1652:
ParsedType.is_subclass_of(X)
true for union if all union types are subtypes of X by @peterschutt in #1690 - Fix #1699: Inconsistent template autoescape behavior by @peterschutt in #1718
- Fix #1691: Missing
ChannelsPlugin
in signature namespace population by @peterschutt in #1719 - Fix #1681: Gzip not sending small streaming responses by @peterschutt in #1723
- Fix #1726: Premature transfer to nested models with
DTOData
by @peterschutt in #1731 - Fix #1711: Incorrect
sync_to_thread
warnings for generator dependencies by @peterschutt in #1716 and @provinzkraut in #1740 - Fix #1762: Dependency injection not available for custom dependencies in
WebSocketListener
by @JacobCoffee in #1807 - Fix #1795: OpenAPI schema for
Dict[K, V]
ignores generic by @gsakkis in #1828 - Fix JSON comparisons in SQLAlchemy repositories by @cofin in #1794
- Fix
simple_asdict()
with attribute value having dataclass type by @peterschutt in #1729 - Fix
WebSocketTestSession
not timing out without when connection is not accepted by @smithk86 in #1696 - Fix attrs converter unstructuring behavior for attrs models by @Goldziher in #1682
- Prevent
msgspec.field
from being called with too many arguments by @MatthewNewland in #1686 - Fix alembic migrations generated for models using
GUID
by @cofin in #1676
Other changes
- Update cryptography to >= 41.0 by @peterschutt in #1772
- Change
ExceptionHandlersMap
toMutableMapping
by @peterschutt in #1791 - Upgrade Swagger UI to
5.0.0
with OpenAPI3.1
support by @cofin in #1826
Breaking
- Remove
state
parameter fromAfterExceptionHookHandler
andBeforeMessageSendHookHandler
by @provinzkraut in #1739 - Remove unused
dto/exceptions.py
by @peterschutt in #1773 - Remove generic base from
BaseRouteHandler
by @peterschutt in #1819 - Deprecate
Litestar
parameterpreferred_validation_backend
private by @provinzkraut in #1810 - Move
Response.get_serializer()
toserialization.get_serializer()
. by @peterschutt in #1820 - Remove
ResponseContainer
and introduceASGIResponse
by @peterschutt in #1790
Documentation
- Add DTO factory tutorial by @peterschutt in #1654
- Add #1565 plugin docs by @peterschutt in #1568
- Add debugging guide by @provinzkraut in #1742
- Add SQLAlchemy repository tutorial by @cofin in #1778
- Add v2 migration guide and release documents by @provinzkraut in #1701
- DTO usage docs: Excluding from nested fields. by @peterschutt in #1797
- Consistent usage of Oxford commas by @patrickarmengol in #1766
- Fix a typo in
openapi.rst
by @eldano1995 in #1722 - Fix outdated module imports in Flask migration guide by @01EK98 in #1746
- Fix imports in authentication middleware docs by @ctrl-Felix in #1811
- Fix
Request
andWebSocket
generic args in examples by @ctrl-Felix in #1815
New Contributors
- @MatthewNewland made their first contribution in #1686
- @eldano1995 made their first contribution in #1722
- @01EK98 made their first contribution in #1746
- @sarbor made their first contribution in #1755
- @ctrl-Felix made their first contribution in #1811
Full Changelog: v2.0.0alpha7...v2.0.0beta1