Litestar 2.0 | On the horizon
litestar-org
This post is meant for the r/Python community, and has been cross-posted here.
Greetings my friendly neighborhood Pythonistas, Pythonians, Pythoons, future Rustaceans! I am excited to bring you another update on our project after quite a long r/Python break due to Reddit meta-issues and internal hunkering down to churn out new features, bug fixes, and more.
NOTE: This is quite a lengthy post, as the last time we posted we were on Alpha 1 and we have since went through Alpha 7 and now are on Beta 4! TL;DR at the bottom.
Previous Posts:
TL;DR:
- msgspec is supported everywhere.
- Channels & Websockets added
- Pydantic v2 support
- Pydantic is now fully optional, as we replaced the internals to use msgspec.
- DTO Overhaul Done
- HTMX support
- Prometheus support
- Server-Sent Events support
- Org Updates (see below, sorry)
Recap
What’s Litestar?
Litestar is a versatile and incredibly efficient ASGI framework that emphasizes building APIs. Our aim is to deliver an excellent developer experience by offering ready-built solutions for everyday tasks such as ORM integration, caching, session management, key/value stores, OpenAPI-schema generation, interactive API docs, type safety, and much more.
Check out our documentation to learn more about Litestar’s features!
Whats New
- 2.0.0b3 Changelog
- Changes from the last Reddit update (2.0.0a1) until now (2.0.0b3)
- Latest 2.0 Changelog
Stable Release Imminent
We announced Litestar v2 at the beginning of this year, and we are wrapping up a few last many fixes and features before 2.0 stable is released. We will not be rushed into this however, so anything is possible! We want a great tool for developers to build great… well… tools, apps, and whatever other creative things you can imagine.
Pydantic recently launched v2!
pydantic = { version = “*”, optional = true }
Pydantic has now been made a completely optional dependency.
What???
This doesn’t change much for you as an end user. It is still 100% supported, but all internals relying on Pydantic have been moved to the incredible msgspec library.
If you are using Pydantic now, you can continue! However, if you want to try out attrs or msgspec you can do that too!
We love all of these packages, but as a framework we want to be as flexible as possible for our end users — offering up as many choices as we can while not greatly increasing our upkeep burden.
Also, in our testing, even with the incredible Rust-powered updates by the Pydantic team, msgspec is still faster in ser/de and validation.
Pydantic v2
We have upgraded to Pydantic v2
> TL;DR: More Choices. More Speed. No Losses. Pydantic v2!
New Features
msgspec is now supported everywhere!
Channels & Websockets
DTOs
- The new DTO implementation is complete, giving you even more powerful tools to transform, parse and validate your data on the fly, without having to define separate models
SQLAlchemy
- Built in CRUD repository
- Custom datatypes for JSON and UUID that are compatible across db-engines
- Integrated tests for Postgres, SQLlite, MySQL, Oracle, DuckDB, and Spanner
- Repository & SQLAlchemy Contrib in 2.0a2
- SQLAlchemy Contrib
HTMX
And More:
- Native Prometheus Exporter in 2.0b2
- Support for Server-Sent Events
- Upgraded to Swagger v5 that adheres to the OpenAPI 3.1 Spec
- Support for the annotated-typed library in 2.0b2
- Support for Piccolo ORM in 2.0b3
- Added attrs support from v1
- …and even more! Since we last updated you we have went through 7 Alpha and 4 Beta versions. You can look to our documentation changelog or the massive changelist between the various pre-release versions.
Documentation
Our documentation continues to receives updates including some exciting new content:
- A growing Tutorials section
- As a side note, if you are interested in developing more tutorials via our documentation, YouTube videos, or other mediums please reach out!
- A new Topics section to discuss non-framework specific things
What’s Next?
As stated above, we hope this will be the last beta release before the official 2.0 stable release.
- Writing a migration guide for 1.x > 2.0
- SAQ Contrib (Possibly post-2.0 launch)
Org Updates
Now, for something new!
We have enjoyed having many contributors join us on our journey so far, with 2.0b3 having 11 contributors (6 of which are new!) alone.
If you have hung around our Discord you might already now this, but we have some changes in our core maintainers
- Jacob Coffee joined the maintainer team right after PyCon 2023 (Hey, that’s me!)
- Peter Schutt is taking a break, and while he is still around, we hope to see him return soon.
- After the launch of 2.0 stable, Na’man Hirschfeld is going to be stepping back as lead maintainer of the projects under the Litestar Organization to work on his startup full-time. If you join our Discord, you can read the full post
- Janek Nouvertné will be stepping up to lead our projects going forward.
Sponsorships
We have enabled sponsorships for GitHub, OpenCollective, and the incredible polar.sh platform.
polar.sh allows us to tag issues with a badge, and if that particular issue is something you would like to see prioritized or done, you can pledge money towards it. It helps us gauge desire for certain features and prioritize work. Read more about polar.sh
New Members
We are also excited to announce the we have added three new members to the org!
As always, if you want to get involved or in touch, check out Litestar on GitHub or join our Discord! Keep your toes crossed for 2.0 to release soon.
Links