DEV Community

Cover image for Starlite December '22 Updates
Na'aman Hirschfeld
Na'aman Hirschfeld

Posted on

Starlite December '22 Updates

Starlite December '22 Updates

Hi Pythonistas!

This post is an update on the development status of Starlite. Let me start, as usual, with a short intro about what is Starlite - for those of you unfamiliar with it.

Starlite is a Python ASGI API framework. ASGI is an async python API specification, originally from the good folk over at the Django project, and an ASGI API framework is a framework that follows this specification. You might be familiar with other ASGI frameworks, with the most famous one these days being FastAPI.

Starlite began as an alternative to FastAPI - it was originally built on the same foundation- Starlette, which offers a ready to use ASGI "tool-kit". The name of the framework - Starlite, was meant to highlight this relationship. Yet, over time Starlite grew in sophistication and complextiy, and we made the decision to drop Starlette as a dependency because this no longer made any sense.

Dropping Starlette and Benchmarks

Since version v1.39.0 Starlite (released on the 12.11.22) no longer has any dependency on Starlette. Between this version and v1.45.0 that was released today (11.12.22), we have invested significant effort into benchmarking and optimizing code. One of our maintainers, @provinzkraut (Janek Nouvertné), has done amazing work rewriting our benchmarking framework. You can read more about this in here and run the benchmarks on your own by cloning the benchmark repository. The results are pretty impressive if I may say so myself:

Response Cookies and Headers

File Download

JSON Response

Query and Path Parameters

Plaintext Response

URLEncoded and Multipart

JSON Post Data

Pydantic and Dataclass Serialization

Other Important Changes

Contrib and Security Backends

Another important development is the inclusion of a starlite.contrib namespace, which we will be expanding on in the future.

This namespace includes an optional OpenTelemetry Integration, which was a long awaited feature.

We also added Security Backend support, which was discussed in some length here. The new security backend supports all of the different session backends Starlite supports, and there is also an optional JWT Security Backend as part of contrib.

Yield Based Dependencies

We made some updates to dependencies following a request on reddit - we now support yield based dependencies in the Starlite Dependency Injection framework. Additionally we made some optimizations to dependency injection which allows us to resolve dependencies in parallel and do some caching, the result is a significant boost in speed.

Dependency Injection Performance

Call for Contributiors and Maintainers

The original imperative for creating Starlite was to create a community driven alternative to FastAPI. This was and remains a core pillar of Starlite- to have multiple maintainers and be as open, inviting and accessible for contributions as feasible. The project follows the all-contributors specification and we attribute all types of contribution - code, testing, refactoring, code reviews, documentation, design of the docs, writing and evangelizing etc.

We are a growing group of contributors and maintainers (5 maintainers at present), and we are always looking for more people to be involved. You're invited to join us on our discord server, or checkout our GitHub repository where you are welcome to write in both discussions and issues.

Top comments (0)