Enhancement: Slim down minimum required dependencies
Summary
Ideally we want the base litestar package to have as few dependencies as possible. Right now we install a lot of extra packages that aren't actually needed for the core functionality.
These fall roughly into two groups: Speedups and additional features.
Speedups include:
fast-query-parsers(#2394)multidict
Additional features:
pyyamlto support exporting the OpenAPI schema as YAMLhttpxfor theTestClientpolyfactoryto generate OpenAPI examples (#2390)
Libraries required for Litestar to work
anyiomsgspec
The goal would be to exclude everything that's not strictly necessary from the base install and make it available through package extras, which could be included in the standard extra as well. This is a common practice and is used by packages like uvicorn, starlette and fastapi.
The plan is to work on these without breaking anything, and removing the packages as required dependencies once we hit 3.0.
Basic Example
No response
Drawbacks and Impact
No response
Unresolved questions
No response
Funding
- If you would like to see an issue prioritized, make a pledge towards it!
- We receive the pledge once the issue is completed & verified
I find it a bit strange that fast-query-parsers is included only with [standard], but standard also includes jinja2.
But jinja2 is quite bloated and makes no sense for a JSON API (the typical use case of litestar I guess), so installing standard is not a good idea if you only need a JSON API. But then fast-query-parsers has to be installed manually.
Currently, I'm installing it via:
litestar[sqlalchemy,cli]
fast-query-parsers
Some more data in https://github.com/litestar-org/litestar/issues/2844
mashumaro supports both yaml and messagepack, not sure about yaml version or efficiency tho
mashumaro supports both yaml and messagepack, not sure about yaml version or efficiency tho
Nsgspec also support both JSON, YAML and MessagePack, as we already using it, and it is performant.
In that case is pyYAML still necessary?
msgspec supports yaml via pyYAML.
Is this conversation really relevant to this issue? If you want to suggest changing the serialization library we support that should be in its own ticket.
Relevant but invalid. I thought Mashumaro supported YAML natively, in which case it would allow you to get rid of one dependency, but it doesn't.