Releases: litestar-org/litestar
v2.0.1
💰 Sponsors 💰
GitHub Sponsors: @benjamin-kirkbride @crisog
OpenCollective: Christian Y, GitHub Sponsors, Shubham Prajapati, Snyk
What's Changed
🔧 Fixes
- Fix warnings about deprecated
debug
parameter ofExceptionHandlerMiddleware
by @provinzkraut in #2193
Full Changelog: v2.0.0...v2.0.1
v2.0.0
This marks the first release of the new 2.x
release line. The 1.5x
releases will be supported until the release of 3.0
. Nevertheless, users are encouraged to upgrade to version 2.
What's Changed
Bugfixes
- Fix #2024 -
media_type
missing in error response by @Goldziher in #2131 - Fix #2147 - setting app debug does not propagate to exception handling middleware by @provinzkraut in #2153
- Fix static files not being served if a route handler with the same base path was registered by @Goldziher in #2154
- Fix missing default values for
receive
andsend
parameters ofHTMXRequest
by @tompin82 in #2145 - DTO: Fix #2125 - excluded attributes being accessed during transfer by @provinzkraut in #2127
- DTO: Fix
DTOData.create_instance
ignores renaming by @abdulhaq-e in #2144 - OpenAPI: Fix
application/octet-stream
set ascontentEncoding
instead ofcontentMediaType
@Goldziher in #2130 - OpenAPI: Fix response not preferring aliased fields by @gsakkis in #2150
- OpenAPI: Fix examples not being generated deterministically by @Goldziher in #2161
- OpenAPI: Fix example generation for Pydantic models by @guacs in #2178
- SQLAlchemy repository: Handle dialects that don't support JSON by @thiagozf in #2139
- JWT: Fix
OPTIONS
andHEAD
being authenticated by default by @Goldziher in #2160 - Fix
OPTIONS
andHEAD
being authenticated by default forSessionAuthMiddleware
by @Mattwmaster58 in #2182
New Contributors
- @thiagozf made their first contribution in #2139
- @Mattwmaster58 made their first contribution in #2143
Full Changelog: v2.0.0rc1...v2.0.0
v2.0.0rc1
What's Changed
🎉 New Contributors 🎉
- @mj0nez made their first contribution in #2036
- @therealzanfar made their first contribution in #2058
New features
- Server-sent events by @Goldziher in #2035
- SQLAlchemy repository: allow specifying
id_attribute
per method by @cofin in #2052 - SQLAlchemy repository:
upsert_many
by @cofin in #2056 - SQLAlchemy repository: New filters
OnBeforeAfter
,NotInCollectionFilter
andNotInSearchFilter
by @cofin in #2057 - SQLAlchemy repository: Configurable chunk sizing for
delete_many
by @cofin in #2061 - SQLAlchemy repository: Support
InstrumentedAttribute
for attribute columns by @provinzkraut in #2054 - OpenAPI: support callable
operation_id
on route handlers by @Goldziher in #2078 - Run event listeners concurrently by @provinzkraut in #2083
- Plugin registry by @provinzkraut in #2096
- CLI plugins by @provinzkraut in #2066
Bugfixes
- SQLAlchemy repository:
health_check
generates valid statement for oracle by @cofin in #2060 - Fix serialization of empty strings in multipart form by @Goldziher in #2044
- Fix #2033 - Server-side session middleware overrides CSRF cookies by @provinzkraut in #2069
- Fix base path escaping in channels on Windows by @provinzkraut in #2112
- DTO: Support renamed fields in
DTOData
andcreate_instance
by @abdulhaq-e in #2065
Other changes
- Switch test clients to
debug=True
by default by @Goldziher in #2049 - BREAKING: remove deprecated module
partial.py
by @provinzkraut in #2113 - BREAKING: remove deprecated modules
dto/factory
andcontrib/msgspec
by @provinzkraut in #2114
Changes to DTOs
BREAKING
This release introduces significant changes to the DTOs. This was necessary to address some bugs that came about because of some issues with the previous internal design. Unfortunately, these changes could not be made backwards compatible, but they are mostly superficial changes to the interfaces; Functionally DTOs still work the same.
The following breaking changes were introduced:
DTOInterface
has been removedForType
has been removedAbstractDTOFactory
has been renamed toAbstractDTO
Full Changelog: v2.0.0beta4...v2.0.0rc1
v1.51.14
What's Changed
- fix(v1.51): #1948 passing wrapper class to struct logging config causes pydantic exception by @JacobCoffee in #2105
Full Changelog: v1.51.13...v1.51.14
v2.0.0beta4
What's Changed
Bugfix release containing a workaround for a bug in poetry that caused development / extra dependencies to be installed alongside the package.
This was fixed by @Goldziher in #2029.
Full Changelog: v2.0.0beta3...v2.0.0beta4
v2.0.0beta3
Highlights
As of this release, Pydantic is an optional dependency.
What does that mean?
For you as an end user, not much; It is still supported in the same capacity as before, it's just not required anymore.
We have migrated all of our internals that previously relied on Pydantic (mainly for parsing and validation) to the amazing msgspec library, with Pydantic now being handled by an internal plugin.
The important thing is: Everything that has worked before with Pydantic will continue to work, and if you're not using Pydantic, but instead want to use attrs or pure msgspec, you won't have a required Pydantic dependency anymore.
Pydantic 2 support
Another change related to Pydantic is that this release adds support for Pydantic 2, which offers lots of improvements, new features and performance gains. Pydantic 1 is still fully supported and will be for the foreseeable future.
What's Changed
New features
- DTO: Support piccolo ORM with
PiccoloDTO
by @Goldziher in #1896 - DTO: Add
include
option toDTOConfig
by @Goldziher in #1950 - SQLAlchemyDTO: column/relationship type inference by @peterschutt in #1879
- SQLAlchemy repository: New
auto_commit
,auto_refresh
andauto_expunge
options by @cofin in #1900 - Allow customization of
OpenAPIController.path
fromOpenAPIConfig
by @jaykv in #1886 - Include path name in
ImproperlyConfiguredException
message for missing param type by @euri10 in #1935
Bugfixes
- Breaking SQLAlchemy repository: Fix spanner support by renaming the
_sentinel
column tosa_orm_sentinel
by @cofin in #1933 - SQLAlchemy repository: Fix audit columns
created_at
andupdated_at
defaulting to app startup time by @MatthewNewland in #1894 - SQLAlchemyDTO: Fix handling of
Sequence
with defaults by @peterschutt in #1883 - DTO / OpenAPI: Fix detection of required fields for Pydantic and msgspec by @abdulhaq-e in #1946
- Allow JSON as redirect response by @cofin in #1908
Other changes
- Breaking Pin Redis to
>=4.4.4+
version by @Goldziher in #1903 - Breaking Replace
Header
,CacheControlHeader
andETag
Pydantic models with dataclasses by @Tsdevendra1 in #1917 - Breaking
dto.factory.abc.AbstractDTOFactory
moved todto.factory.base.AbstractDTOFactory
by @Goldziher in #1950 - Breaking Make Pydantic an optional extra by @Goldziher in #1963
- Pydantic 2 support by @Goldziher in #1956
- Deprecation of
partial
module by @Goldziher in #2002
New Contributors
- @jaykv made their first contribution in #1886
- @Tsdevendra1 made their first contribution in #1917
- @euri10 made their first contribution in #1935
- @su-shubham made their first contribution in #1930
- @erik-hasse made their first contribution in #1938
- @sobolevn made their first contribution in #1954
Full Changelog: v2.0.0beta2...v2.0.0beta3
v1.51.13
What's Changed
- Restrict Pydantic to
<2
by @provinzkraut in #1985
Full Changelog: v1.51.12...v1.51.13
v2.0.0beta2
Beta 2 is out now!
What does that mean?
As stated in the Beta 1 release, 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 Contributors 🎉
- @floxay made their first contribution in #1834
- @sfermigier made their first contribution in #1858
- @rseeley made their first contribution in #1774
- @r4gesingh47 made their first contribution in #1872
Enhancements
- 🚀 NEW FEATURE 🚀 : Integration of Prometheus exporter. (#1806) by @r4gesingh47 and @Goldziher in #1872
- Add support for
annotated-types
by @Goldziher in #1847 - Increase verbosity of validation error response keys by @rseeley in #1774
- Simplify SQLAlchemy repo imports by @provinzkraut in #1841
- SQLA DTO: Explicit error message for cases where a column has no type annotation by @provinzkraut in #1852
- Add missing marker to SQLA oracle JSON tests by @provinzkraut in #1855
Fixes
- Fix controller inheritance issues by @Goldziher in #1867
- Fix Internal Server Error detail by @peterschutt in #1857
- Fix path parameter resolution by @Goldziher in #1833
- Fix Pydantic v1 regex validation by @Goldziher in #1865
Docs
- Add missing newline to properly format bullet points. by @sfermigier in #1858
- Fix Cookie.expires field docstring by @floxay in #1834
Other Changes
- Add
TestClient
default timeout by @provinzkraut in #1840
Internal
- Add poetry pre-commit hooks by @JacobCoffee in #1832
- Add fake Redis to publish pipeline by @cofin in #1875
- Refactor 🔧: OpenAPI create_schema by @gsakkis in #1842
- Refactor 🔧: OpenAPI create schema v2 by @gsakkis in #1846
- Refactor 🔧: OpenAPI handler media types by @peterschutt in #1838
- Refactor 🔧: remove set-cookie ops on genric asgi responses. by @peterschutt in #1839
- Use
get_type_hints
by @Goldziher in #1861 - Cleanup types by @Goldziher in #1866
- Replace
msgspec.from_builtins
withmsgspec.convert
by @provinzkraut in #1843 - Refactor tests by @provinzkraut in #1850
- Update Polyfactory to not use the 2.3.0 version by @provinzkraut in #1844
Full Changelog: v2.0.0beta1...v2.0.0beta2
v2.0.0beta1
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
v2.0.0alpha7
What's Changed
New features
- Warn about sync dependencies without an explicit
sync_to_thread
value by @provinzkraut in #1648 - Warn about sync handler functions without an explicit
sync_to_thread
value by @provinzkraut in #1655 - Warn about
sync_to_thread
with async callables by @provinzkraut in #1664 - Support dependencies in WS listener hooks by @provinzkraut in #1647
- Declaring dependencies without Provide by @provinzkraut in #1638
DTOData
datastructure by @peterschutt in #1650- Partial DTOs by @peterschutt in #1651
- SQLA repository:
psycopg
asyncio support by @cofin in #1657 - SQLA repository:
BigInteger
PK option PKs by @cofin in #1657 - SQLA repository: Binary
GUID
PKs by @cofin in #1657 - Application lifespan context managers by @provinzkraut in #1635
- Trio compatible event-emitters by @provinzkraut in #1666
- OpenAPI schema for
msgspec.Meta
annotated types by @Goldziher in #1669 - OpenAPI schema for Pydantic
FieldInfo
by @Goldziher in #1670
Bugfixes
- Fix #1640 - StorageObject doesn't return < 0 when using expiry by @SanderWegter in #1641
- Fix filter
forward-ref
issues by @cofin in #1659 - Fix channels repeated unsubscribe bug by @provinzkraut in #1656
- Fix #1643 - Fully qualified model name + Unique ShortID generation for DTO Model to avoid collision issues by @v3ss0n in #1649
- Fix #1660 - Discrepancy between attrs and Pydantic validation output by @Goldziher in #1668
- Fix #1446 - Add validation to unknown media types by @Goldziher in #1671
Other changes
- [Breaking] Unify lifespan hooks by @provinzkraut in #1663
New Contributors
Full Changelog: v2.0.0alpha6...v2.0.0alpha7