litestar-org / litestar

Production-ready, Light, Flexible and Extensible ASGI API framework | Effortlessly Build Performant APIs
https://litestar.dev/
MIT License
5.38k stars 364 forks source link

Enhancement: Slim down minimum required dependencies #2397

Open provinzkraut opened 11 months ago

provinzkraut commented 11 months ago

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:

Additional features:

Libraries required for Litestar to work

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

Fund with Polar

hyperknot commented 11 months ago

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
JacobCoffee commented 9 months ago

Some more data in https://github.com/litestar-org/litestar/issues/2844

rafalkrupinski commented 4 months ago

mashumaro supports both yaml and messagepack, not sure about yaml version or efficiency tho

FHU-yezi commented 4 months ago

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.

rafalkrupinski commented 4 months ago

In that case is pyYAML still necessary?

peterschutt commented 4 months ago

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.

rafalkrupinski commented 4 months ago

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.