3 ms·
To use Python type hints, and get automatic data validation, serialization, and documentation for your API (including interactive UI docs for your API). All tha
by tiangolo 8y ago
To use Python type hints, and get automatic data validation, serialization, and documentation for your API (including interactive UI docs for your API). All that, even for deeply nested JSON bodies. And by using type hints, you get autocomplete everywhere, type error checks, etc.
Your API gets documented with standards: OpenAPI and JSON Schema.
Or to be able to have WebSockets.
Or for its dependency injection system, that saves you a lot of code and plugins.
You can check the features here: https://fastapi.tiangolo.com/features/ https://fastapi.tiangolo.com/features/
And you can see alternatives and comparisons here: https://fastapi.tiangolo.com/alternatives/ https://fastapi.tiangolo.com/alternatives/
- timothycrosley 8y agoNote that if you are currently using Falcon, another route to get many of these features is to use hug (https://github.com/timothycrosley/hug https://github.com/timothycrosley/hug) which inspired many of API Star features back in the day - and is part of the Falcon ecosystem. But there's also a lot of really amazing work done in this ecosystem that hug doesn't currently support - I may have a busy couple of months ahead :). (DISCLAIMER: I am the creator of hug)
- tiangolo 8y agoYep, and Hug was one of the first tools I saw with this style of declaring parameters with types in the functions, along with APIStar. Great job! And thanks. It helped inspiring the creation of FastAPI. Apart from other of your tools that I use all the time, like isort. An advantage I see of Hug: the same Hug application can be a CLI app. A couple advantages I would see of FastAPI (disclaimer, I'm the creator :) ): * The API schema uses the standards OpenAPI and JSON Schema * It includes a couple of interactive API documentation web user interfaces (Swagger UI, and ReDoc). Thanks to being OpenAPI. * It uses standard Python type hints, not custom types included as part of the library. * The dependency injection system. * Websockets.
- timothycrosley 8y agoGlad to hear that :)! Honestly, what you've built looks super solid and polished. In many ways, it's what I wanted hug to be - it's really inspiring to see someone build that.
- tiangolo 8y agoWow, thanks! I take it as a high compliment. :D Thanks for paving the way with Hug. And thanks for helping make the Python ecosystem a friendly, and welcoming community.
- tomchristie 8y agoJust wanted to second @tiangolo's "Thanks for paving the way with Hug" - Absolutely yup! It's a lovely bit of interface design - definitely had a really positive impact on the space.