From 0c2c0561f354744cd7350f202fbd054ec8f7317d Mon Sep 17 00:00:00 2001
From: Malak khoder
- FastAPI framework, high performance, easy to learn, fast to code, ready for production + FastAPI framework: high performance, easy to learn, fast to code, and ready for production
@@ -123,7 +123,9 @@ The key features are:
If you are building a CLI app to be used in the terminal instead of a web API, check out **Typer**.
-**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀
+**Typer** is FastAPI's little sibling, intended to be the **FastAPI of CLIs**.
+
+🚀
## Requirements { #requirements }
@@ -175,7 +177,8 @@ def read_item(item_id: int, q: Union[str, None] = None):
Or use
-If your code uses `async` / `await`, use `async def`:
+> **Tip:** Use `async def` when performing I/O-bound operations to fully benefit from FastAPI's asynchronous performance.
+
```Python hl_lines="9 14"
from typing import Union
From 5a57c67b8e56790e342b29bb1c9c1f2d2681b409 Mon Sep 17 00:00:00 2001
From: Malak khoder async def...Or use
> **Tip:** Use `async def` when performing I/O-bound operations to fully benefit from FastAPI's asynchronous performance.
+**Tip**: Use `async def` only when your code performs non-blocking I/O
+(e.g. database calls, external APIs). For CPU-bound or blocking code,
+prefer `def` to avoid performance issues.
```Python hl_lines="9 14"
From 762326eb96497f1a529ad0a8804ae055d1c5932b Mon Sep 17 00:00:00 2001
From: Malak khoder async def...Or use
-> **Tip:** Use `async def` when performing I/O-bound operations to fully benefit from FastAPI's asynchronous performance.
-**Tip**: Use `async def` only when your code performs non-blocking I/O
-(e.g. database calls, external APIs). For CPU-bound or blocking code,
-prefer `def` to avoid performance issues.
+!!! tip
+ Use `async def` only when your code performs non-blocking I/O,
+ such as database queries or external API calls.
+
```Python hl_lines="9 14"
From 1e09ed662d0679ee812ac4d3245b62c049ea21ba Mon Sep 17 00:00:00 2001
From: Malak khoder async def...
- FastAPI framework, high performance, easy to learn, fast to code, ready for production + FastAPI framework: high performance, easy to learn, fast to code, and ready for production
@@ -126,7 +126,9 @@ The key features are:
If you are building a CLI app to be used in the terminal instead of a web API, check out **Typer**.
-**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀
+**Typer** is FastAPI's little sibling, intended to be the **FastAPI of CLIs**.
+
+🚀
## Requirements
@@ -178,7 +180,11 @@ def read_item(item_id: int, q: Union[str, None] = None):
Or use
-If your code uses `async` / `await`, use `async def`:
+!!! tip
+ Use `async def` only when your code performs non-blocking I/O,
+ such as database queries or external API calls.
+
+
```Python hl_lines="9 14"
from typing import Union
From fcb87729c9b403e4498979f8331f7284f2229c56 Mon Sep 17 00:00:00 2001
From: Malak khoder async def...Or use
!!! tip
- Use `async def` only when your code performs non-blocking I/O,
- such as database queries or external API calls.
+ To learn more about when to use `async def`, check the Async and await documentation.
async def...