Size: a a a

PiterPy Conf Сhat

2020 August 05

IS

Irina Saribekova in PiterPy Conf Сhat
Сейчас в эфире @tiangolo
С темой: Intro to FastAPI

Во время доклада отмечайте спикера и задавайте вопросы в этом чате на английском, он вам ответит.

Вопросы на русском также можно писать, их модератор задаст в прямом эфире после доклада.

Если хотите задать вопрос лично в эфире, проверяйте свою камеру и гарнитуру и пишите мне в личку :)
источник

D

Denis Kalanov in PiterPy Conf Сhat
источник

D

Denis Kalanov in PiterPy Conf Сhat
Рамирас создатель мема )
источник

YV

Yuliya Volkova in PiterPy Conf Сhat
"pls, no xml"- 😭 you don't like SOAP?!:)) why?!))
источник

VS

Vladimir Shulyak in PiterPy Conf Сhat
I like this one more
источник

SR

Sebastián Ramírez in PiterPy Conf Сhat
Yuliya Volkova
"pls, no xml"- 😭 you don't like SOAP?!:)) why?!))
😭 I think I don't have good memories with SOAP 🧼 😂
источник

YV

Yuliya Volkova in PiterPy Conf Сhat
Sebastián Ramírez
😭 I think I don't have good memories with SOAP 🧼 😂
)))
источник

VS

Vladimir Shulyak in PiterPy Conf Сhat
I ❤️ WSDL
источник

SR

Sebastián Ramírez in PiterPy Conf Сhat
Vladimir Shulyak
I like this one more
Ah! That's in Spanish, it says more or less "Sebastián Ramírez has a cum laude preschool diploma"

...I'm kidding, it's not cum laude 😔
источник

YV

Yuliya Volkova in PiterPy Conf Сhat
about OpenAPI - FastAPI support it totally or some limitations?
источник

SR

Sebastián Ramírez in PiterPy Conf Сhat
Yuliya Volkova
about OpenAPI - FastAPI support it totally or some limitations?
An application build with FastAPI will be compatible with OpenAPI, yes. And most of the things that can be defined with OpenAPI can be defined in code with FastAPI. OpenAPI has some special cases that are not necessarily easy to generate automatically, but most of it yes.
источник

YV

Yuliya Volkova in PiterPy Conf Сhat
@tiangolo about FastAPI when migrate some project, for example, from Flask, how important to change all sync stuff from sync to async? how it can side project? I mean of course not computations, but some i/o sync operations, for example, if in a lot of places in project used 'requests 'library'?
источник

YV

Yuliya Volkova in PiterPy Conf Сhat
at the end we already will change all sync to async, but can we go to prod with 'partial' migration?
источник

IS

Irina Saribekova in PiterPy Conf Сhat
источник

C

Chatbro in PiterPy Conf Сhat
Doctor Strange
Is it possible to use BaseModel-based classes as return values, i.e. return something like Result(message='...', ...) instead of {'message': ...}?
источник

SR

Sebastián Ramírez in PiterPy Conf Сhat
Also, OpenAPI is based on JSON Schema, the currently published version, 3.0.3 is based on an older version of JSON Schema that has a couple of small differences with the latest versions of JSON Schema. The latest RC version of OpenAPI, 3.1.0, is built on the latest JSON Schema version.

FastAPI is built on Pydantic, that generates JSON Schema with the latest versions. So, the OpenAPI generated by FastAPI has some differences in a couple of corner cases where it is compatible with the latest RC version of OpenAPI. The advantage is that the internal JSON Schema declarations use the latest version, that are compatible with recent tools that use them, e.g. automatic frontend components.
источник

YV

Yuliya Volkova in PiterPy Conf Сhat
Sebastián Ramírez
Also, OpenAPI is based on JSON Schema, the currently published version, 3.0.3 is based on an older version of JSON Schema that has a couple of small differences with the latest versions of JSON Schema. The latest RC version of OpenAPI, 3.1.0, is built on the latest JSON Schema version.

FastAPI is built on Pydantic, that generates JSON Schema with the latest versions. So, the OpenAPI generated by FastAPI has some differences in a couple of corner cases where it is compatible with the latest RC version of OpenAPI. The advantage is that the internal JSON Schema declarations use the latest version, that are compatible with recent tools that use them, e.g. automatic frontend components.
got it
источник

YV

Yuliya Volkova in PiterPy Conf Сhat
and thanks :)
источник

SR

Sebastián Ramírez in PiterPy Conf Сhat
Yuliya Volkova
@tiangolo about FastAPI when migrate some project, for example, from Flask, how important to change all sync stuff from sync to async? how it can side project? I mean of course not computations, but some i/o sync operations, for example, if in a lot of places in project used 'requests 'library'?
Yes, exactly, when you use a normal def function definition, FastAPI will run it on a threadpool to not block the event loop. So, it will do the "sensible" thing. You can easily keep mostly the same code and then optimize only the "routes"/"path operations" that you need to have extra concurrency/performance.
источник

SR

Sebastián Ramírez in PiterPy Conf Сhat
Chatbro
Doctor Strange
Is it possible to use BaseModel-based classes as return values, i.e. return something like Result(message='...', ...) instead of {'message': ...}?
Good question! Yes, you can. In fact, you can also declare the response_model to use for that path operation and it will be documented in the automatic UI. And you can use Pydantic's orm_mode to declare the model to use for the response and even return an arbitrary object, like an ORM object (e.g. SQLAlchemy). But sure, yes, you can return BaseModel responses directly.
источник