Summary
Python has an embarrasment of riches when it comes to web frameworks, each with their own particular strengths. FastAPI is a new entrant that has been quickly gaining popularity as a performant and easy to use toolchain for building RESTful web services. In this episode Sebastián Ramirez shares the story of the frustrations that led him to create a new framework, how he put in the extra effort to make the developer experience as smooth and painless as possible, and how he embraces extensability with lightweight dependency injection and a straightforward plugin interface. If you are starting a new web application today then FastAPI should be at the top of your list.
Announcements
Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.
When you’re ready to launch your next app or want to try a project you hear about on the show, you’ll need somewhere to deploy it, so take a look at our friends over at Linode. With 200 Gbit/s private networking, node balancers, a 40 Gbit/s public network, fast object storage, and a brand new managed Kubernetes platform, all controlled by a convenient API you’ve got everything you need to scale up. And for your tasks that need fast computation, such as training machine learning models, they’ve got dedicated CPU and GPU instances. Go to pythonpodcast.com/linode to get a $20 credit and launch a new server in under a minute. And don’t forget to thank them for their continued support of this show!
Your host as usual is Tobias Macey and today I’m interviewing Sebastián Ramirez about FastAPI, a framework for building production ready APIs in Python 3
Interview
Introductions
How did you get introduced to Python?
Can you start by describing what FastAPI is?
What are the main frustrations that you ran into with other frameworks that motivated you to create an entirely new one?
What are some of the main use cases that FastAPI is designed for?
Many web frameworks focus on managing the end-to-end functionality of a website, including the UI. Why did you focus on just API capabilities?
What are the benefits of building an API only framework?
If you wanted to integrate a presentation layer, what would be involved in that effort?
What API formats does FastAPI support?
What would be involved in adding support for additional specifications such as GraphQL or JSON-LD?
There are a huge number of web frameworks available just in the Python ecosystem. How does FastAPI fit into that landscape and why might someone choose it over the other options?
Can you share your design philosophy for the project?
What are your main sources of inspiration for the framework?
You have also built the Typer CLI library which you refer to as the little sibling of FastAPI. How have your experiences building these two projects influenced their counterpart’s evolution?
What are the benefits of incorporating type annotations into a web framework and in what ways do they manifest in its functionality?
What is the workflow for a developer building a complex application in FastAPI?
Can you describe how FastAPI itself is architected and how its design has evolved since you first began working on it?
What are the extension points that are available for someone to build plugins for FastAPI?
What are some of the challenges that you have faced in building an async framework that is leveraging the new ASGI specification?
What are some sharp edges that users should keep an eye out for?
What are some unique or underutilized features of FastAPI that users might not be aware of?
What are some of the most interesting, unexpected, or innovative ways that you have seen FastAPI used?
When is FastAPI the wrong choice?
What are some of the most interesting, unexpected, or challenging lessons that you have learned in the process of building and maintaining FastAPI?
What do you have planned for the future of the project?
Keep In Touch
@tiangolo on Twitter.
@tiangolo on GitHub.
Picks
Tobias
Once Upon A Time TV Show
Sebastián
Cloud Atlas Movie
Isaac Asimov’s robot short stories
Python devtools debug function
async compatible requests with HTTPX
RescueTime for automatic time tracking
Joplin for Notes
Closing Announcements
Thank you for listening! Don’t forget to check out our other show, the Data Engineering Podcast for the latest on modern data management.
Visit the site to subscribe to the show, sign up for the mailing list, and read the show notes.
If you’ve learned something or tried out a project from the show then tell us about it! Email hosts@podcastinit.com) with your story.
To help other people find the show please leave a review on iTunes and tell your friends and co-workers
Join the community in the new Zulip chat workspace at pythonpodcast.com/chat
Links
FastAPI
Typer
Typer CLI
FastAPI Alternatives, Inspiration and Comparisons
Explosion’s spaCy
Explosion’s Prodigy
Starlette
Pydantic
Uvicorn
Hypercorn
fastapi-utils
Class Based Views
GrahQL Ariadne
Coronavirus Tracker API
Terminals from browser: termpair
XPublish
Uber’s Ludwig
Netflix Dispatch
Colombia
Berlin Germany
Explosion AI
Python Type Annotations
Django Rest Framework
Flask
Swagger/OpenAPI
Sanic
NodeJS
JSON Schema
OAuth2
Swagger UI
ReDoc
React
VueJS
Angular
REST == REpresentational State Transfer
JSON-LD
Go Language
Hug API framework
Click CLI Framework
Flask Blueprints
Tom Christie
Podcast Interview
Dependency Injection
ASGI
Podcast Episode
WSGI
Thread Local Variables
Context Vars
OAUTH2 Scopes
PipX
XArray
JAM Stack
NextJS
Hugo
GatsbyJS
FastAPI Project Templates
The intro and outro music is from Requiem for a Fish The Freak Fandango Orchestra / CC BY-SA