Sebastian Ramirez - the creator of FastAPI #
Motives #
This week at work we were planning to create a feature for a Python API for our event ingestions from different micro-service architecture. Given the option there was an idea to develop the back-end in Flask or other frameworks but a new framework was suggested that is called FastAPI. Then for some reason, the lead of the team proposed the migration without considering before the option (that is really bad) and a new member suggested we try out the FastAPI alternative because is more maintained at the moment.
Why would you create a framework #
Sebastian Ramirez always thought that if you were to build a product you should always look out for the right tools, avoid “re-inventing the wheel” as many software engineers say nowadays. After three years of avoiding to build the idea, it seem like the solution was something he wished not to develop but needed it.
Features that inspired FastAPI #
Sebastian Ramirez had a couple of ideas on how the DX (Developer Experience) should feel for the framework based on other Python frameworks he know like DJango. Some of the features he wanted to develop were:
- Automated documentation of the API (DJango)
- Swagger standardized documentation (SwaggerUI)
- Eliminate the code duplication (Decorator Hell)
- Autocomplete and auto-fill spaces (Typescript)
- Inspect type (Python Language)
How Sebastian Ramirez avoided to re-invent the wheel was by basing his wishes of the framework and tools based on already web standards. He grabbed the standards already defined and made it so the developers had a better experience based on his own wishes to build better API frameworks.
“Always focus on solving problems, that will be your guidance” - Sebastian Ramirez
Why do it in Python? #
By utilizing the Python framework you could check the autocomplete with the typing, but furthermore you could use the inspect and typing feature to create the documentation (since you have the out generated typing description) and run type validation of with the same built-in function of the library like “typing” and “inspect”.
Python is also a language for LLMs (Large Language Models) and machine learning. So for the developers that gravitate near those technologies for him didn’t seem too convenient to switch every time between technologies. With FastAPI you will automatically access the constraints of utilizing good types in python, good code practices of typed python and you will have benefits like:
- Type autocomplete
- Input validation
- Output validation
Typed vs Untyped Systems #
Normally in Sebastian’s experience, the plugin composition and the endless ladder of decorators made it impossible for types to be well defined and cleared for the development experience. So Python users often would neglect the typing (micro seconds) it takes in exchange for a much worst without types codebase, but based on Sebastian’s perspective code efficiency and preciseness would be greatly increased if Python developers took the time to focus down in putting typing in specific places that would be require for recreating the good experience (mostly function variable declarations).
“Making the code more intuitive, adds pleasure for the development experience” - Sebastian Ramirez
Focus on a problem mentality #
So the Sebastian’s approach to learning is always focus on a problem. Even though there is a lot of hype going around amazing ML tools and amazing ML software nowadays, there are still problems that are easy to solve waiting to be solved. Many of us focus too much on the big picture and follow trends without realizing that some of the problems you could be helping to solve are the easiest of all.
For Sebastian the path to learning is regardless of the background you can help build solutions. You are free to help others figure out problems and by creating that run way impact will come by itself for him, impact is only the product of a good solution. You shouldn’t focus on the outcome, but in the daily show up of creating a better solution for the problem, tempering the blade over and over until it is refined.
Even the FastAPI framework after being utilized in many places like Meta, Nuclear Reactors and some other really important places… it is still pre version 1.0. His mentality and approach to problems is always find a better way, a smarter solution a new suggestions that even though is easy or hard it will help the solution have that much impact.
Links: [[Coding]] [[python]]
202409020000