Live data from Hacker News

Types for Python HTTP APIs

instagram-engineering.com

11–20 of 55 posts

Re: Types for Python HTTP APIs

#11
post #2

Looks like FastAPI framework with handler type anotations

Yeah 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.

Re: Types for Python HTTP APIs

#12
I'd love to see some more details on the tooling they created to generate OpenAPI schemas by extracting types from their code.

Related: are there any good Python libs for doing request/response validation based on OpenAPI v3 schemas?

Re: Types for Python HTTP APIs

#13
I find it really impressive that such a large organization runs anything on Python. Isn't the speed optimization potential immense? Does the amount of Python involved just not matter compared to image data?

Secondly I find it really impressive that such a large company with so many smart people can produce an application so mediocre and make the experience extra terrible and me wonder what the absolute fuck is up with that company by trying to block desktop browsers from the perfectly useable on desktop web app (the one in which you can upload things).

Especially for a photo centric application (that has since begun to be used for original video production, of course hampered by the insane lack of any options, starting with the aspect ratio) one could expect a normal work flow to include transferring photos from a camera to a desktop computer. Making your browser pretend to be a mobile phone seems like a step that could maybe, if you really tried (to take out the arbitrary restriction that you must have explicitly added in the first place), be made unnecessary.

So that's my (condensed) rant about Instagram as a whole.

Re: Types for Python HTTP APIs

#14

I'd love to see some more details on the tooling they created to generate OpenAPI schemas by extracting types from their code. Related: are there any good Python libs for doing request/response validation based on OpenAPI v3 schemas?

I have used Connexion (https://github.com/zalando/connexion) in the past. The only thing I didn't really like is that the OpenAPI file grows rather unmaintainable after some time if you have a big service.

Re: Types for Python HTTP APIs

#15

I find it really impressive that such a large organization runs anything on Python. Isn't the speed optimization potential immense? Does the amount of Python involved just not matter compared to image data? Secondly I find it really impressive that such a large company with so many smart people can produce an application so mediocre and make the experience extra terrible and me wonder what the absolute fuck is up wit…

Who cares if it's 10% slower running on Python if the whole thing is going to be distributed across 1000s of containers that are behind layers of caching. At that point developer productivity is more important than runtime performance.

Re: Types for Python HTTP APIs

#16

The whole Type thing in Python and all the workarounds to make Python type-safish looks and feels absolutely pathetic. I have no idea why a company like Facebook takes so much time to apologize for the inadequacy of Python as a programming language in the broader sense. Especially since they are utilizing a service based architecture they easily could make the switch to a language that actually supports types. Also t…

Python does support types though. It's type system is, imo more pleasant and powerful than Javas.

Re: Types for Python HTTP APIs

#17
post #11
post #2

Looks like FastAPI framework with handler type anotations

Yeah 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.

Yeah 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)?

Re: Types for Python HTTP APIs

#18
post #11

Earlier quoted context omitted.

Yeah 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.

Yeah 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)?

I 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.

Re: Types for Python HTTP APIs

#19

The whole Type thing in Python and all the workarounds to make Python type-safish looks and feels absolutely pathetic. I have no idea why a company like Facebook takes so much time to apologize for the inadequacy of Python as a programming language in the broader sense. Especially since they are utilizing a service based architecture they easily could make the switch to a language that actually supports types. Also t…

Hey look, it's a time traveler from the year 2004! Everybody wave, and try not to let him know our cell phones have the Internet now.
Post reply on HN