When comparing Spark vs FastAPI, the Slant community recommends FastAPI for most people. In the question“What are the best backend web frameworks?” FastAPI is ranked 4th while Spark is ranked 41st. The most important reason people chose FastAPI is:
It has a simple but powerful dependency injection system, it can be used to handle authentication, per-user rate limiting, authorization controls (e.g. with roles), etc.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Custom quick swipe features
Pro Free
Pro Robust customization options
Pro Syncs across devices
Pro Unified inbox
Pro Free snooze options
Pro Dependency injection
It has a simple but powerful dependency injection system, it can be used to handle authentication, per-user rate limiting, authorization controls (e.g. with roles), etc.
Pro Standards
It is based on standards: OpenAPI, JSON Schema and OAuth 2.0.
Pro Data validation
It validates the data using the types you declared. Even in deeply nested JSON requests.
Pro High-performance
It's based on Starlette and Pydantic, so, it's one of the fastest Python frameworks.
Pro Editor completion
It is based on Python type declarations, so, editors and tools can give great support. Including type checks and autocompletion everywhere.
Pro One of the fastest growing communities
Pro Fast is really fast (!)
It's easy to develop API based applications in Python on deadlines for Android and IOS Development.
Pro Automatic docs
It generates interactive API documentation automatically from your code.
Pro Database independent
It's independent of database or ORM, but compatible with all of them. Including relational databases and NoSQL.
Pro Async IO / optional
It's based on Async IO, which gives it high concurrency. But you can use non-async libraries and it runs them appropriately.
Pro World class documentation
It has some of the best documentation of any framework.
Pro WebSockets
Because it's an async framework, it can handle async-native protocols like WebSockets.
Pro OAuth 2.0
It has integrated support for OAuth 2.0. Including declaring required scopes per endpoint. So, you can easily integrate it with external OAuth 2.0 providers or build your own with it.
Pro Background tasks
Included support for background tasks, thanks to being based on Starlette.
Pro Supports GraphQL
Python's graphene library is included as an optional dependency meaning that GraphQL API's are supported out of the box, with no additional tweaking needed.
Cons
Con Horrible privacy policy
- Sends statistical data to several services known for bad privacy policies (Google, Facebook), also there's no way to opt out.
- Automatically creates an acount with the first address entered and subscribes you to their newsletter.
- Stores credentials for your email accounts on their servers.
- Stores your emails on their servers to push them to your devices.
- Server infrastructure seems to be located in the US.
Con Doesn't support many services
Many services such as Spam filters, Pocket, and other apps are not supported.
Con Doesn't show the counts of emails next to the folders
- On the Mac platform will show +999 for the folder that contains more than 1000 emails.
- On the iPhone, the platform will not show the counts next to the folder unless they are new emails.
Con Smaller community
Since FastAPI is relatively new, its community is smaller than Django Rest Framework. But it can grow with time.
