6 ms·
Looks like FastAPI framework with handler type anotations
by hyzyla 7y ago
Looks like FastAPI framework with handler type anotations
- megaman821 7y agoI agree. While reading, I keep thinking of pydantic (https://pydantic-docs.helpmanual.io/ https://pydantic-docs.helpmanual.io/) which FastAPI utilizes.
- Sytten 7y agoYeah I feel FastAPI will become the new Flask in a few years. The growth this year has been amazing. I wish I had started my project with it, but I am still using Flask. I found this nice extension though called Flask-Rebar that does a similar task with Marshmallow.
- Scarbutt 7y agoYeah I feel FastAPI will become the new Flask in a few years. What else does it offers besides performance (switching to async is no free lunch)?
- acemarke 7y agoI ran across FastAPI earlier this year and did a tiny prototype to play with it. Selling points for me: - Integrates nicely with some existing libraries (Starlette, Pydantic) - Well documented - Auto-validation of endpoints from data models - Auto-generation of OpenAPI schemas from those models - Auto-serves live API docs from that schema - Easy definition of sync and async endpoints Again, it was just a tiny proof-of-concept prototype, but I'm sold on using it on future projects.
- ivalm 7y ago> - Auto-generation of OpenAPI schemas from those models Is there a package that can do a reverse? Can I give it an OpenAPI spec and get a code stump going?
- drchaim 7y agohttps://github.com/zalando/connexion/ https://github.com/zalando/connexion/ Solves most of the problems for that.
- BerislavLopac 7y agoOpenAPI-generator [0], written in Java, can produce Python stumps, but I never liked that approach. Connexion [1] is built on top on Flask and does routing and validation based on an OpenAPI spec. I've recently started developing Pyotr [2], which does the same only based on ASGI and Starlette. It also includes a client module. [0] https://openapi-generator.tech/ https://openapi-generator.tech/ [1] https://connexion.readthedocs.io/ https://connexion.readthedocs.io/ [2] https://github.com/berislavlopac/pyotr https://github.com/berislavlopac/pyotr
- hyzyla 7y agoBut I found one drawback of using FastAPI - defining all inputs in handler function signature is looks bit complicated and verbose. I prefer one input with type that are structure of another types. Something like this: class CreatePostInput(InputClass): text: str user_id: str ... @handler.post('/post') def create_post(input: CreatePostInput): ...
- rvdmei 7y agoDepends on where you are coming from and what you need. Developer productivity is really high (real world experience). It has better defaults / builtins compared to flask (much faster to get to production quality). Faster to learn than Django / Django rest framework. My team has been using it for a couple of months now and it’s been really easy and fast to get an API up and running with api docs, data validation, middleware for auth and metrics, persistence, mix of async and sync functions and background jobs.
- sandGorgon 7y agoExactly what I was thinking. Plus the fact it is built on top of Starlette and Uvicorn and is frequently among the top of benchmarks of python based framework performance. Fairly complete starter projects. https://github.com/tiangolo/full-stack-fastapi-postgresql/blob/master/README.md https://github.com/tiangolo/full-stack-fastapi-postgresql/bl...