committed by
GitHub
782 changed files with 40643 additions and 29384 deletions
@ -7,7 +7,8 @@ on: |
|||||
- synchronize |
- synchronize |
||||
|
|
||||
env: |
env: |
||||
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }} |
# Forks and Dependabot don't have access to secrets |
||||
|
HAS_SECRETS: ${{ secrets.PRE_COMMIT != '' }} |
||||
|
|
||||
jobs: |
jobs: |
||||
pre-commit: |
pre-commit: |
||||
@ -19,40 +20,41 @@ jobs: |
|||||
run: echo "$GITHUB_CONTEXT" |
run: echo "$GITHUB_CONTEXT" |
||||
- uses: actions/checkout@v5 |
- uses: actions/checkout@v5 |
||||
name: Checkout PR for own repo |
name: Checkout PR for own repo |
||||
if: env.IS_FORK == 'false' |
if: env.HAS_SECRETS == 'true' |
||||
with: |
with: |
||||
# To be able to commit it needs more than the last commit |
# To be able to commit it needs to fetch the head of the branch, not the |
||||
|
# merge commit |
||||
ref: ${{ github.head_ref }} |
ref: ${{ github.head_ref }} |
||||
|
# And it needs the full history to be able to compute diffs |
||||
|
fetch-depth: 0 |
||||
# A token other than the default GITHUB_TOKEN is needed to be able to trigger CI |
# A token other than the default GITHUB_TOKEN is needed to be able to trigger CI |
||||
token: ${{ secrets.PRE_COMMIT }} |
token: ${{ secrets.PRE_COMMIT }} |
||||
# pre-commit lite ci needs the default checkout configs to work |
# pre-commit lite ci needs the default checkout configs to work |
||||
- uses: actions/checkout@v5 |
- uses: actions/checkout@v5 |
||||
name: Checkout PR for fork |
name: Checkout PR for fork |
||||
if: env.IS_FORK == 'true' |
if: env.HAS_SECRETS == 'false' |
||||
|
with: |
||||
|
# To be able to commit it needs the head branch of the PR, the remote one |
||||
|
ref: ${{ github.event.pull_request.head.sha }} |
||||
|
fetch-depth: 0 |
||||
- name: Set up Python |
- name: Set up Python |
||||
uses: actions/setup-python@v6 |
uses: actions/setup-python@v6 |
||||
with: |
with: |
||||
python-version: "3.14" |
python-version-file: ".python-version" |
||||
- name: Setup uv |
- name: Setup uv |
||||
uses: astral-sh/setup-uv@v7 |
uses: astral-sh/setup-uv@v7 |
||||
with: |
with: |
||||
cache-dependency-glob: | |
cache-dependency-glob: | |
||||
requirements**.txt |
|
||||
pyproject.toml |
pyproject.toml |
||||
uv.lock |
uv.lock |
||||
- name: Install Dependencies |
- name: Install Dependencies |
||||
run: | |
run: uv sync --locked --extra all |
||||
uv venv |
- name: Run prek - pre-commit |
||||
uv pip install -r requirements.txt |
|
||||
- name: Run pre-commit |
|
||||
id: precommit |
id: precommit |
||||
run: | |
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure |
||||
# Fetch the base branch for comparison |
|
||||
git fetch origin ${{ github.base_ref }} |
|
||||
uvx pre-commit run --from-ref origin/${{ github.base_ref }} --to-ref HEAD --show-diff-on-failure |
|
||||
continue-on-error: true |
continue-on-error: true |
||||
- name: Commit and push changes |
- name: Commit and push changes |
||||
if: env.IS_FORK == 'false' |
if: env.HAS_SECRETS == 'true' |
||||
run: | |
run: | |
||||
git config user.name "github-actions[bot]" |
git config user.name "github-actions[bot]" |
||||
git config user.email "github-actions[bot]@users.noreply.github.com" |
git config user.email "github-actions[bot]@users.noreply.github.com" |
||||
@ -64,7 +66,7 @@ jobs: |
|||||
git push |
git push |
||||
fi |
fi |
||||
- uses: pre-commit-ci/[email protected] |
- uses: pre-commit-ci/[email protected] |
||||
if: env.IS_FORK == 'true' |
if: env.HAS_SECRETS == 'false' |
||||
with: |
with: |
||||
msg: 🎨 Auto format |
msg: 🎨 Auto format |
||||
- name: Error out on pre-commit errors |
- name: Error out on pre-commit errors |
||||
|
|||||
@ -15,6 +15,7 @@ jobs: |
|||||
- fastapi-slim |
- fastapi-slim |
||||
permissions: |
permissions: |
||||
id-token: write |
id-token: write |
||||
|
contents: read |
||||
steps: |
steps: |
||||
- name: Dump GitHub context |
- name: Dump GitHub context |
||||
env: |
env: |
||||
@ -24,19 +25,15 @@ jobs: |
|||||
- name: Set up Python |
- name: Set up Python |
||||
uses: actions/setup-python@v6 |
uses: actions/setup-python@v6 |
||||
with: |
with: |
||||
python-version: "3.10" |
python-version-file: ".python-version" |
||||
# Issue ref: https://github.com/actions/setup-python/issues/436 |
# Issue ref: https://github.com/actions/setup-python/issues/436 |
||||
# cache: "pip" |
# cache: "pip" |
||||
# cache-dependency-path: pyproject.toml |
# cache-dependency-path: pyproject.toml |
||||
- name: Install build dependencies |
- name: Install uv |
||||
run: pip install build |
uses: astral-sh/setup-uv@v7 |
||||
- name: Build distribution |
- name: Build distribution |
||||
|
run: uv build |
||||
env: |
env: |
||||
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }} |
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }} |
||||
run: python -m build |
|
||||
- name: Publish |
- name: Publish |
||||
uses: pypa/[email protected] |
run: uv publish |
||||
- name: Dump GitHub context |
|
||||
env: |
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }} |
|
||||
run: echo "$GITHUB_CONTEXT" |
|
||||
|
|||||
@ -0,0 +1 @@ |
|||||
|
3.11 |
||||
@ -22,21 +22,13 @@ Hier ist eine allgemeine Idee, wie die Modelle mit ihren Passwortfeldern aussehe |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial001_py310.py hl[7,9,14,20,22,27:28,31:33,38:39] *} |
{* ../../docs_src/extra_models/tutorial001_py310.py hl[7,9,14,20,22,27:28,31:33,38:39] *} |
||||
|
|
||||
/// info | Info |
### Über `**user_in.model_dump()` { #about-user-in-model-dump } |
||||
|
|
||||
In Pydantic v1 hieß die Methode `.dict()`, in Pydantic v2 wurde sie <abbr title="veraltet, obsolet: Es soll nicht mehr verwendet werden">deprecatet</abbr> (aber weiterhin unterstützt) und in `.model_dump()` umbenannt. |
#### Pydantics `.model_dump()` { #pydantics-model-dump } |
||||
|
|
||||
Die Beispiele hier verwenden `.dict()` für die Kompatibilität mit Pydantic v1, aber Sie sollten `.model_dump()` verwenden, wenn Sie Pydantic v2 verwenden können. |
|
||||
|
|
||||
/// |
|
||||
|
|
||||
### Über `**user_in.dict()` { #about-user-in-dict } |
|
||||
|
|
||||
#### Die `.dict()`-Methode von Pydantic { #pydantics-dict } |
|
||||
|
|
||||
`user_in` ist ein Pydantic-Modell der Klasse `UserIn`. |
`user_in` ist ein Pydantic-Modell der Klasse `UserIn`. |
||||
|
|
||||
Pydantic-Modelle haben eine `.dict()`-Methode, die ein <abbr title="Dictionary – Zuordnungstabelle: In anderen Sprachen auch Hash, Map, Objekt, Assoziatives Array genannt">`dict`</abbr> mit den Daten des Modells zurückgibt. |
Pydantic-Modelle haben eine `.model_dump()`-Methode, die ein <abbr title="Dictionary – Zuordnungstabelle: In anderen Sprachen auch Hash, Map, Objekt, Assoziatives Array genannt">`dict`</abbr> mit den Daten des Modells zurückgibt. |
||||
|
|
||||
Wenn wir also ein Pydantic-Objekt `user_in` erstellen, etwa so: |
Wenn wir also ein Pydantic-Objekt `user_in` erstellen, etwa so: |
||||
|
|
||||
@ -47,7 +39,7 @@ user_in = UserIn(username="john", password="secret", email="[email protected] |
|||||
und dann aufrufen: |
und dann aufrufen: |
||||
|
|
||||
```Python |
```Python |
||||
user_dict = user_in.dict() |
user_dict = user_in.model_dump() |
||||
``` |
``` |
||||
|
|
||||
haben wir jetzt ein `dict` mit den Daten in der Variablen `user_dict` (es ist ein `dict` statt eines Pydantic-Modellobjekts). |
haben wir jetzt ein `dict` mit den Daten in der Variablen `user_dict` (es ist ein `dict` statt eines Pydantic-Modellobjekts). |
||||
@ -103,20 +95,20 @@ UserInDB( |
|||||
|
|
||||
#### Ein Pydantic-Modell aus dem Inhalt eines anderen { #a-pydantic-model-from-the-contents-of-another } |
#### Ein Pydantic-Modell aus dem Inhalt eines anderen { #a-pydantic-model-from-the-contents-of-another } |
||||
|
|
||||
Da wir im obigen Beispiel `user_dict` von `user_in.dict()` bekommen haben, wäre dieser Code: |
Da wir im obigen Beispiel `user_dict` von `user_in.model_dump()` bekommen haben, wäre dieser Code: |
||||
|
|
||||
```Python |
```Python |
||||
user_dict = user_in.dict() |
user_dict = user_in.model_dump() |
||||
UserInDB(**user_dict) |
UserInDB(**user_dict) |
||||
``` |
``` |
||||
|
|
||||
gleichwertig zu: |
gleichwertig zu: |
||||
|
|
||||
```Python |
```Python |
||||
UserInDB(**user_in.dict()) |
UserInDB(**user_in.model_dump()) |
||||
``` |
``` |
||||
|
|
||||
... weil `user_in.dict()` ein `dict` ist, und dann lassen wir Python es „entpacken“, indem wir es an `UserInDB` mit vorangestelltem `**` übergeben. |
... weil `user_in.model_dump()` ein `dict` ist, und dann lassen wir Python es „entpacken“, indem wir es an `UserInDB` mit vorangestelltem `**` übergeben. |
||||
|
|
||||
Auf diese Weise erhalten wir ein Pydantic-Modell aus den Daten eines anderen Pydantic-Modells. |
Auf diese Weise erhalten wir ein Pydantic-Modell aus den Daten eines anderen Pydantic-Modells. |
||||
|
|
||||
@ -125,7 +117,7 @@ Auf diese Weise erhalten wir ein Pydantic-Modell aus den Daten eines anderen Pyd |
|||||
Und dann fügen wir das zusätzliche Schlüsselwort-Argument `hashed_password=hashed_password` hinzu, wie in: |
Und dann fügen wir das zusätzliche Schlüsselwort-Argument `hashed_password=hashed_password` hinzu, wie in: |
||||
|
|
||||
```Python |
```Python |
||||
UserInDB(**user_in.dict(), hashed_password=hashed_password) |
UserInDB(**user_in.model_dump(), hashed_password=hashed_password) |
||||
``` |
``` |
||||
|
|
||||
... was so ist wie: |
... was so ist wie: |
||||
@ -180,7 +172,6 @@ Wenn Sie eine <a href="https://docs.pydantic.dev/latest/concepts/types/#unions" |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial003_py310.py hl[1,14:15,18:20,33] *} |
{* ../../docs_src/extra_models/tutorial003_py310.py hl[1,14:15,18:20,33] *} |
||||
|
|
||||
|
|
||||
### `Union` in Python 3.10 { #union-in-python-3-10 } |
### `Union` in Python 3.10 { #union-in-python-3-10 } |
||||
|
|
||||
In diesem Beispiel übergeben wir `Union[PlaneItem, CarItem]` als Wert des Arguments `response_model`. |
In diesem Beispiel übergeben wir `Union[PlaneItem, CarItem]` als Wert des Arguments `response_model`. |
||||
@ -203,7 +194,6 @@ Dafür verwenden Sie Pythons Standard-`typing.List` (oder nur `list` in Python 3 |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial004_py39.py hl[18] *} |
{* ../../docs_src/extra_models/tutorial004_py39.py hl[18] *} |
||||
|
|
||||
|
|
||||
## Response mit beliebigem `dict` { #response-with-arbitrary-dict } |
## Response mit beliebigem `dict` { #response-with-arbitrary-dict } |
||||
|
|
||||
Sie können auch eine Response deklarieren, die ein beliebiges `dict` zurückgibt, indem Sie nur die Typen der Schlüssel und Werte ohne ein Pydantic-Modell deklarieren. |
Sie können auch eine Response deklarieren, die ein beliebiges `dict` zurückgibt, indem Sie nur die Typen der Schlüssel und Werte ohne ein Pydantic-Modell deklarieren. |
||||
@ -214,7 +204,6 @@ In diesem Fall können Sie `typing.Dict` verwenden (oder nur `dict` in Python 3. |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial005_py39.py hl[6] *} |
{* ../../docs_src/extra_models/tutorial005_py39.py hl[6] *} |
||||
|
|
||||
|
|
||||
## Zusammenfassung { #recap } |
## Zusammenfassung { #recap } |
||||
|
|
||||
Verwenden Sie gerne mehrere Pydantic-Modelle und vererben Sie je nach Bedarf. |
Verwenden Sie gerne mehrere Pydantic-Modelle und vererben Sie je nach Bedarf. |
||||
|
|||||
@ -1,495 +1,495 @@ |
|||||
- name: full-stack-fastapi-template |
- name: full-stack-fastapi-template |
||||
html_url: https://github.com/fastapi/full-stack-fastapi-template |
html_url: https://github.com/fastapi/full-stack-fastapi-template |
||||
stars: 39475 |
stars: 41312 |
||||
owner_login: fastapi |
owner_login: fastapi |
||||
owner_html_url: https://github.com/fastapi |
owner_html_url: https://github.com/fastapi |
||||
- name: Hello-Python |
- name: Hello-Python |
||||
html_url: https://github.com/mouredev/Hello-Python |
html_url: https://github.com/mouredev/Hello-Python |
||||
stars: 33090 |
stars: 34206 |
||||
owner_login: mouredev |
owner_login: mouredev |
||||
owner_html_url: https://github.com/mouredev |
owner_html_url: https://github.com/mouredev |
||||
- name: serve |
- name: serve |
||||
html_url: https://github.com/jina-ai/serve |
html_url: https://github.com/jina-ai/serve |
||||
stars: 21798 |
stars: 21832 |
||||
owner_login: jina-ai |
owner_login: jina-ai |
||||
owner_html_url: https://github.com/jina-ai |
owner_html_url: https://github.com/jina-ai |
||||
- name: HivisionIDPhotos |
- name: HivisionIDPhotos |
||||
html_url: https://github.com/Zeyi-Lin/HivisionIDPhotos |
html_url: https://github.com/Zeyi-Lin/HivisionIDPhotos |
||||
stars: 20258 |
stars: 20661 |
||||
owner_login: Zeyi-Lin |
owner_login: Zeyi-Lin |
||||
owner_html_url: https://github.com/Zeyi-Lin |
owner_html_url: https://github.com/Zeyi-Lin |
||||
- name: sqlmodel |
- name: sqlmodel |
||||
html_url: https://github.com/fastapi/sqlmodel |
html_url: https://github.com/fastapi/sqlmodel |
||||
stars: 17212 |
stars: 17567 |
||||
owner_login: fastapi |
owner_login: fastapi |
||||
owner_html_url: https://github.com/fastapi |
owner_html_url: https://github.com/fastapi |
||||
- name: Douyin_TikTok_Download_API |
|
||||
html_url: https://github.com/Evil0ctal/Douyin_TikTok_Download_API |
|
||||
stars: 15145 |
|
||||
owner_login: Evil0ctal |
|
||||
owner_html_url: https://github.com/Evil0ctal |
|
||||
- name: fastapi-best-practices |
- name: fastapi-best-practices |
||||
html_url: https://github.com/zhanymkanov/fastapi-best-practices |
html_url: https://github.com/zhanymkanov/fastapi-best-practices |
||||
stars: 14644 |
stars: 16291 |
||||
owner_login: zhanymkanov |
owner_login: zhanymkanov |
||||
owner_html_url: https://github.com/zhanymkanov |
owner_html_url: https://github.com/zhanymkanov |
||||
|
- name: Douyin_TikTok_Download_API |
||||
|
html_url: https://github.com/Evil0ctal/Douyin_TikTok_Download_API |
||||
|
stars: 16132 |
||||
|
owner_login: Evil0ctal |
||||
|
owner_html_url: https://github.com/Evil0ctal |
||||
|
- name: SurfSense |
||||
|
html_url: https://github.com/MODSetter/SurfSense |
||||
|
stars: 12723 |
||||
|
owner_login: MODSetter |
||||
|
owner_html_url: https://github.com/MODSetter |
||||
- name: machine-learning-zoomcamp |
- name: machine-learning-zoomcamp |
||||
html_url: https://github.com/DataTalksClub/machine-learning-zoomcamp |
html_url: https://github.com/DataTalksClub/machine-learning-zoomcamp |
||||
stars: 12320 |
stars: 12575 |
||||
owner_login: DataTalksClub |
owner_login: DataTalksClub |
||||
owner_html_url: https://github.com/DataTalksClub |
owner_html_url: https://github.com/DataTalksClub |
||||
- name: fastapi_mcp |
- name: fastapi_mcp |
||||
html_url: https://github.com/tadata-org/fastapi_mcp |
html_url: https://github.com/tadata-org/fastapi_mcp |
||||
stars: 11174 |
stars: 11478 |
||||
owner_login: tadata-org |
owner_login: tadata-org |
||||
owner_html_url: https://github.com/tadata-org |
owner_html_url: https://github.com/tadata-org |
||||
- name: SurfSense |
|
||||
html_url: https://github.com/MODSetter/SurfSense |
|
||||
stars: 10858 |
|
||||
owner_login: MODSetter |
|
||||
owner_html_url: https://github.com/MODSetter |
|
||||
- name: awesome-fastapi |
- name: awesome-fastapi |
||||
html_url: https://github.com/mjhea0/awesome-fastapi |
html_url: https://github.com/mjhea0/awesome-fastapi |
||||
stars: 10758 |
stars: 11018 |
||||
owner_login: mjhea0 |
owner_login: mjhea0 |
||||
owner_html_url: https://github.com/mjhea0 |
owner_html_url: https://github.com/mjhea0 |
||||
- name: XHS-Downloader |
- name: XHS-Downloader |
||||
html_url: https://github.com/JoeanAmier/XHS-Downloader |
html_url: https://github.com/JoeanAmier/XHS-Downloader |
||||
stars: 9313 |
stars: 9938 |
||||
owner_login: JoeanAmier |
owner_login: JoeanAmier |
||||
owner_html_url: https://github.com/JoeanAmier |
owner_html_url: https://github.com/JoeanAmier |
||||
- name: FastUI |
|
||||
html_url: https://github.com/pydantic/FastUI |
|
||||
stars: 8915 |
|
||||
owner_login: pydantic |
|
||||
owner_html_url: https://github.com/pydantic |
|
||||
- name: polar |
- name: polar |
||||
html_url: https://github.com/polarsource/polar |
html_url: https://github.com/polarsource/polar |
||||
stars: 8339 |
stars: 9348 |
||||
owner_login: polarsource |
owner_login: polarsource |
||||
owner_html_url: https://github.com/polarsource |
owner_html_url: https://github.com/polarsource |
||||
|
- name: FastUI |
||||
|
html_url: https://github.com/pydantic/FastUI |
||||
|
stars: 8949 |
||||
|
owner_login: pydantic |
||||
|
owner_html_url: https://github.com/pydantic |
||||
- name: FileCodeBox |
- name: FileCodeBox |
||||
html_url: https://github.com/vastsa/FileCodeBox |
html_url: https://github.com/vastsa/FileCodeBox |
||||
stars: 7721 |
stars: 8060 |
||||
owner_login: vastsa |
owner_login: vastsa |
||||
owner_html_url: https://github.com/vastsa |
owner_html_url: https://github.com/vastsa |
||||
- name: nonebot2 |
- name: nonebot2 |
||||
html_url: https://github.com/nonebot/nonebot2 |
html_url: https://github.com/nonebot/nonebot2 |
||||
stars: 7170 |
stars: 7311 |
||||
owner_login: nonebot |
owner_login: nonebot |
||||
owner_html_url: https://github.com/nonebot |
owner_html_url: https://github.com/nonebot |
||||
- name: hatchet |
- name: hatchet |
||||
html_url: https://github.com/hatchet-dev/hatchet |
html_url: https://github.com/hatchet-dev/hatchet |
||||
stars: 6253 |
stars: 6479 |
||||
owner_login: hatchet-dev |
owner_login: hatchet-dev |
||||
owner_html_url: https://github.com/hatchet-dev |
owner_html_url: https://github.com/hatchet-dev |
||||
- name: fastapi-users |
- name: fastapi-users |
||||
html_url: https://github.com/fastapi-users/fastapi-users |
html_url: https://github.com/fastapi-users/fastapi-users |
||||
stars: 5849 |
stars: 5970 |
||||
owner_login: fastapi-users |
owner_login: fastapi-users |
||||
owner_html_url: https://github.com/fastapi-users |
owner_html_url: https://github.com/fastapi-users |
||||
- name: serge |
- name: serge |
||||
html_url: https://github.com/serge-chat/serge |
html_url: https://github.com/serge-chat/serge |
||||
stars: 5756 |
stars: 5751 |
||||
owner_login: serge-chat |
owner_login: serge-chat |
||||
owner_html_url: https://github.com/serge-chat |
owner_html_url: https://github.com/serge-chat |
||||
- name: strawberry |
- name: strawberry |
||||
html_url: https://github.com/strawberry-graphql/strawberry |
html_url: https://github.com/strawberry-graphql/strawberry |
||||
stars: 4569 |
stars: 4598 |
||||
owner_login: strawberry-graphql |
owner_login: strawberry-graphql |
||||
owner_html_url: https://github.com/strawberry-graphql |
owner_html_url: https://github.com/strawberry-graphql |
||||
- name: chatgpt-web-share |
- name: devpush |
||||
html_url: https://github.com/chatpire/chatgpt-web-share |
html_url: https://github.com/hunvreus/devpush |
||||
stars: 4294 |
stars: 4407 |
||||
owner_login: chatpire |
owner_login: hunvreus |
||||
owner_html_url: https://github.com/chatpire |
owner_html_url: https://github.com/hunvreus |
||||
|
- name: Kokoro-FastAPI |
||||
|
html_url: https://github.com/remsky/Kokoro-FastAPI |
||||
|
stars: 4359 |
||||
|
owner_login: remsky |
||||
|
owner_html_url: https://github.com/remsky |
||||
- name: poem |
- name: poem |
||||
html_url: https://github.com/poem-web/poem |
html_url: https://github.com/poem-web/poem |
||||
stars: 4276 |
stars: 4337 |
||||
owner_login: poem-web |
owner_login: poem-web |
||||
owner_html_url: https://github.com/poem-web |
owner_html_url: https://github.com/poem-web |
||||
|
- name: chatgpt-web-share |
||||
|
html_url: https://github.com/chatpire/chatgpt-web-share |
||||
|
stars: 4279 |
||||
|
owner_login: chatpire |
||||
|
owner_html_url: https://github.com/chatpire |
||||
- name: dynaconf |
- name: dynaconf |
||||
html_url: https://github.com/dynaconf/dynaconf |
html_url: https://github.com/dynaconf/dynaconf |
||||
stars: 4202 |
stars: 4244 |
||||
owner_login: dynaconf |
owner_login: dynaconf |
||||
owner_html_url: https://github.com/dynaconf |
owner_html_url: https://github.com/dynaconf |
||||
|
- name: Yuxi-Know |
||||
|
html_url: https://github.com/xerrors/Yuxi-Know |
||||
|
stars: 4154 |
||||
|
owner_login: xerrors |
||||
|
owner_html_url: https://github.com/xerrors |
||||
- name: atrilabs-engine |
- name: atrilabs-engine |
||||
html_url: https://github.com/Atri-Labs/atrilabs-engine |
html_url: https://github.com/Atri-Labs/atrilabs-engine |
||||
stars: 4093 |
stars: 4086 |
||||
owner_login: Atri-Labs |
owner_login: Atri-Labs |
||||
owner_html_url: https://github.com/Atri-Labs |
owner_html_url: https://github.com/Atri-Labs |
||||
- name: Kokoro-FastAPI |
|
||||
html_url: https://github.com/remsky/Kokoro-FastAPI |
|
||||
stars: 4019 |
|
||||
owner_login: remsky |
|
||||
owner_html_url: https://github.com/remsky |
|
||||
- name: logfire |
- name: logfire |
||||
html_url: https://github.com/pydantic/logfire |
html_url: https://github.com/pydantic/logfire |
||||
stars: 3805 |
stars: 3975 |
||||
owner_login: pydantic |
owner_login: pydantic |
||||
owner_html_url: https://github.com/pydantic |
owner_html_url: https://github.com/pydantic |
||||
- name: LitServe |
- name: LitServe |
||||
html_url: https://github.com/Lightning-AI/LitServe |
html_url: https://github.com/Lightning-AI/LitServe |
||||
stars: 3719 |
stars: 3797 |
||||
owner_login: Lightning-AI |
owner_login: Lightning-AI |
||||
owner_html_url: https://github.com/Lightning-AI |
owner_html_url: https://github.com/Lightning-AI |
||||
- name: fastapi-admin |
|
||||
html_url: https://github.com/fastapi-admin/fastapi-admin |
|
||||
stars: 3632 |
|
||||
owner_login: fastapi-admin |
|
||||
owner_html_url: https://github.com/fastapi-admin |
|
||||
- name: datamodel-code-generator |
|
||||
html_url: https://github.com/koxudaxi/datamodel-code-generator |
|
||||
stars: 3609 |
|
||||
owner_login: koxudaxi |
|
||||
owner_html_url: https://github.com/koxudaxi |
|
||||
- name: huma |
- name: huma |
||||
html_url: https://github.com/danielgtaylor/huma |
html_url: https://github.com/danielgtaylor/huma |
||||
stars: 3603 |
stars: 3785 |
||||
owner_login: danielgtaylor |
owner_login: danielgtaylor |
||||
owner_html_url: https://github.com/danielgtaylor |
owner_html_url: https://github.com/danielgtaylor |
||||
|
- name: datamodel-code-generator |
||||
|
html_url: https://github.com/koxudaxi/datamodel-code-generator |
||||
|
stars: 3731 |
||||
|
owner_login: koxudaxi |
||||
|
owner_html_url: https://github.com/koxudaxi |
||||
|
- name: fastapi-admin |
||||
|
html_url: https://github.com/fastapi-admin/fastapi-admin |
||||
|
stars: 3697 |
||||
|
owner_login: fastapi-admin |
||||
|
owner_html_url: https://github.com/fastapi-admin |
||||
- name: farfalle |
- name: farfalle |
||||
html_url: https://github.com/rashadphz/farfalle |
html_url: https://github.com/rashadphz/farfalle |
||||
stars: 3490 |
stars: 3506 |
||||
owner_login: rashadphz |
owner_login: rashadphz |
||||
owner_html_url: https://github.com/rashadphz |
owner_html_url: https://github.com/rashadphz |
||||
- name: tracecat |
- name: tracecat |
||||
html_url: https://github.com/TracecatHQ/tracecat |
html_url: https://github.com/TracecatHQ/tracecat |
||||
stars: 3379 |
stars: 3458 |
||||
owner_login: TracecatHQ |
owner_login: TracecatHQ |
||||
owner_html_url: https://github.com/TracecatHQ |
owner_html_url: https://github.com/TracecatHQ |
||||
|
- name: mcp-context-forge |
||||
|
html_url: https://github.com/IBM/mcp-context-forge |
||||
|
stars: 3216 |
||||
|
owner_login: IBM |
||||
|
owner_html_url: https://github.com/IBM |
||||
- name: opyrator |
- name: opyrator |
||||
html_url: https://github.com/ml-tooling/opyrator |
html_url: https://github.com/ml-tooling/opyrator |
||||
stars: 3135 |
stars: 3134 |
||||
owner_login: ml-tooling |
owner_login: ml-tooling |
||||
owner_html_url: https://github.com/ml-tooling |
owner_html_url: https://github.com/ml-tooling |
||||
- name: docarray |
- name: docarray |
||||
html_url: https://github.com/docarray/docarray |
html_url: https://github.com/docarray/docarray |
||||
stars: 3114 |
stars: 3111 |
||||
owner_login: docarray |
owner_login: docarray |
||||
owner_html_url: https://github.com/docarray |
owner_html_url: https://github.com/docarray |
||||
- name: devpush |
|
||||
html_url: https://github.com/hunvreus/devpush |
|
||||
stars: 3097 |
|
||||
owner_login: hunvreus |
|
||||
owner_html_url: https://github.com/hunvreus |
|
||||
- name: fastapi-realworld-example-app |
- name: fastapi-realworld-example-app |
||||
html_url: https://github.com/nsidnev/fastapi-realworld-example-app |
html_url: https://github.com/nsidnev/fastapi-realworld-example-app |
||||
stars: 3050 |
stars: 3072 |
||||
owner_login: nsidnev |
owner_login: nsidnev |
||||
owner_html_url: https://github.com/nsidnev |
owner_html_url: https://github.com/nsidnev |
||||
- name: uvicorn-gunicorn-fastapi-docker |
- name: uvicorn-gunicorn-fastapi-docker |
||||
html_url: https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker |
html_url: https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker |
||||
stars: 2911 |
stars: 2908 |
||||
owner_login: tiangolo |
owner_login: tiangolo |
||||
owner_html_url: https://github.com/tiangolo |
owner_html_url: https://github.com/tiangolo |
||||
- name: mcp-context-forge |
|
||||
html_url: https://github.com/IBM/mcp-context-forge |
|
||||
stars: 2899 |
|
||||
owner_login: IBM |
|
||||
owner_html_url: https://github.com/IBM |
|
||||
- name: best-of-web-python |
|
||||
html_url: https://github.com/ml-tooling/best-of-web-python |
|
||||
stars: 2648 |
|
||||
owner_login: ml-tooling |
|
||||
owner_html_url: https://github.com/ml-tooling |
|
||||
- name: FastAPI-template |
- name: FastAPI-template |
||||
html_url: https://github.com/s3rius/FastAPI-template |
html_url: https://github.com/s3rius/FastAPI-template |
||||
stars: 2637 |
stars: 2728 |
||||
owner_login: s3rius |
owner_login: s3rius |
||||
owner_html_url: https://github.com/s3rius |
owner_html_url: https://github.com/s3rius |
||||
|
- name: best-of-web-python |
||||
|
html_url: https://github.com/ml-tooling/best-of-web-python |
||||
|
stars: 2686 |
||||
|
owner_login: ml-tooling |
||||
|
owner_html_url: https://github.com/ml-tooling |
||||
- name: YC-Killer |
- name: YC-Killer |
||||
html_url: https://github.com/sahibzada-allahyar/YC-Killer |
html_url: https://github.com/sahibzada-allahyar/YC-Killer |
||||
stars: 2599 |
stars: 2648 |
||||
owner_login: sahibzada-allahyar |
owner_login: sahibzada-allahyar |
||||
owner_html_url: https://github.com/sahibzada-allahyar |
owner_html_url: https://github.com/sahibzada-allahyar |
||||
- name: fastapi-react |
|
||||
html_url: https://github.com/Buuntu/fastapi-react |
|
||||
stars: 2569 |
|
||||
owner_login: Buuntu |
|
||||
owner_html_url: https://github.com/Buuntu |
|
||||
- name: Yuxi-Know |
|
||||
html_url: https://github.com/xerrors/Yuxi-Know |
|
||||
stars: 2563 |
|
||||
owner_login: xerrors |
|
||||
owner_html_url: https://github.com/xerrors |
|
||||
- name: sqladmin |
- name: sqladmin |
||||
html_url: https://github.com/aminalaee/sqladmin |
html_url: https://github.com/aminalaee/sqladmin |
||||
stars: 2558 |
stars: 2637 |
||||
owner_login: aminalaee |
owner_login: aminalaee |
||||
owner_html_url: https://github.com/aminalaee |
owner_html_url: https://github.com/aminalaee |
||||
|
- name: fastapi-react |
||||
|
html_url: https://github.com/Buuntu/fastapi-react |
||||
|
stars: 2573 |
||||
|
owner_login: Buuntu |
||||
|
owner_html_url: https://github.com/Buuntu |
||||
- name: RasaGPT |
- name: RasaGPT |
||||
html_url: https://github.com/paulpierre/RasaGPT |
html_url: https://github.com/paulpierre/RasaGPT |
||||
stars: 2451 |
stars: 2460 |
||||
owner_login: paulpierre |
owner_login: paulpierre |
||||
owner_html_url: https://github.com/paulpierre |
owner_html_url: https://github.com/paulpierre |
||||
- name: supabase-py |
- name: supabase-py |
||||
html_url: https://github.com/supabase/supabase-py |
html_url: https://github.com/supabase/supabase-py |
||||
stars: 2344 |
stars: 2428 |
||||
owner_login: supabase |
owner_login: supabase |
||||
owner_html_url: https://github.com/supabase |
owner_html_url: https://github.com/supabase |
||||
|
- name: 30-Days-of-Python |
||||
|
html_url: https://github.com/codingforentrepreneurs/30-Days-of-Python |
||||
|
stars: 2347 |
||||
|
owner_login: codingforentrepreneurs |
||||
|
owner_html_url: https://github.com/codingforentrepreneurs |
||||
- name: nextpy |
- name: nextpy |
||||
html_url: https://github.com/dot-agent/nextpy |
html_url: https://github.com/dot-agent/nextpy |
||||
stars: 2335 |
stars: 2337 |
||||
owner_login: dot-agent |
owner_login: dot-agent |
||||
owner_html_url: https://github.com/dot-agent |
owner_html_url: https://github.com/dot-agent |
||||
- name: fastapi-utils |
- name: fastapi-utils |
||||
html_url: https://github.com/fastapiutils/fastapi-utils |
html_url: https://github.com/fastapiutils/fastapi-utils |
||||
stars: 2291 |
stars: 2299 |
||||
owner_login: fastapiutils |
owner_login: fastapiutils |
||||
owner_html_url: https://github.com/fastapiutils |
owner_html_url: https://github.com/fastapiutils |
||||
- name: 30-Days-of-Python |
|
||||
html_url: https://github.com/codingforentrepreneurs/30-Days-of-Python |
|
||||
stars: 2220 |
|
||||
owner_login: codingforentrepreneurs |
|
||||
owner_html_url: https://github.com/codingforentrepreneurs |
|
||||
- name: langserve |
- name: langserve |
||||
html_url: https://github.com/langchain-ai/langserve |
html_url: https://github.com/langchain-ai/langserve |
||||
stars: 2215 |
stars: 2255 |
||||
owner_login: langchain-ai |
owner_login: langchain-ai |
||||
owner_html_url: https://github.com/langchain-ai |
owner_html_url: https://github.com/langchain-ai |
||||
|
- name: NoteDiscovery |
||||
|
html_url: https://github.com/gamosoft/NoteDiscovery |
||||
|
stars: 2182 |
||||
|
owner_login: gamosoft |
||||
|
owner_html_url: https://github.com/gamosoft |
||||
- name: solara |
- name: solara |
||||
html_url: https://github.com/widgetti/solara |
html_url: https://github.com/widgetti/solara |
||||
stars: 2122 |
stars: 2154 |
||||
owner_login: widgetti |
owner_login: widgetti |
||||
owner_html_url: https://github.com/widgetti |
owner_html_url: https://github.com/widgetti |
||||
- name: mangum |
- name: mangum |
||||
html_url: https://github.com/Kludex/mangum |
html_url: https://github.com/Kludex/mangum |
||||
stars: 2029 |
stars: 2071 |
||||
owner_login: Kludex |
owner_login: Kludex |
||||
owner_html_url: https://github.com/Kludex |
owner_html_url: https://github.com/Kludex |
||||
|
- name: fastapi_best_architecture |
||||
|
html_url: https://github.com/fastapi-practices/fastapi_best_architecture |
||||
|
stars: 2036 |
||||
|
owner_login: fastapi-practices |
||||
|
owner_html_url: https://github.com/fastapi-practices |
||||
|
- name: vue-fastapi-admin |
||||
|
html_url: https://github.com/mizhexiaoxiao/vue-fastapi-admin |
||||
|
stars: 1983 |
||||
|
owner_login: mizhexiaoxiao |
||||
|
owner_html_url: https://github.com/mizhexiaoxiao |
||||
- name: agentkit |
- name: agentkit |
||||
html_url: https://github.com/BCG-X-Official/agentkit |
html_url: https://github.com/BCG-X-Official/agentkit |
||||
stars: 1912 |
stars: 1941 |
||||
owner_login: BCG-X-Official |
owner_login: BCG-X-Official |
||||
owner_html_url: https://github.com/BCG-X-Official |
owner_html_url: https://github.com/BCG-X-Official |
||||
- name: manage-fastapi |
- name: fastapi-langgraph-agent-production-ready-template |
||||
html_url: https://github.com/ycd/manage-fastapi |
html_url: https://github.com/wassim249/fastapi-langgraph-agent-production-ready-template |
||||
stars: 1885 |
stars: 1920 |
||||
owner_login: ycd |
owner_login: wassim249 |
||||
owner_html_url: https://github.com/ycd |
owner_html_url: https://github.com/wassim249 |
||||
- name: openapi-python-client |
- name: openapi-python-client |
||||
html_url: https://github.com/openapi-generators/openapi-python-client |
html_url: https://github.com/openapi-generators/openapi-python-client |
||||
stars: 1862 |
stars: 1900 |
||||
owner_login: openapi-generators |
owner_login: openapi-generators |
||||
owner_html_url: https://github.com/openapi-generators |
owner_html_url: https://github.com/openapi-generators |
||||
- name: piccolo |
- name: manage-fastapi |
||||
html_url: https://github.com/piccolo-orm/piccolo |
html_url: https://github.com/ycd/manage-fastapi |
||||
stars: 1836 |
stars: 1894 |
||||
owner_login: piccolo-orm |
owner_login: ycd |
||||
owner_html_url: https://github.com/piccolo-orm |
owner_html_url: https://github.com/ycd |
||||
- name: vue-fastapi-admin |
|
||||
html_url: https://github.com/mizhexiaoxiao/vue-fastapi-admin |
|
||||
stars: 1831 |
|
||||
owner_login: mizhexiaoxiao |
|
||||
owner_html_url: https://github.com/mizhexiaoxiao |
|
||||
- name: python-week-2022 |
|
||||
html_url: https://github.com/rochacbruno/python-week-2022 |
|
||||
stars: 1817 |
|
||||
owner_login: rochacbruno |
|
||||
owner_html_url: https://github.com/rochacbruno |
|
||||
- name: slowapi |
- name: slowapi |
||||
html_url: https://github.com/laurentS/slowapi |
html_url: https://github.com/laurentS/slowapi |
||||
stars: 1798 |
stars: 1891 |
||||
owner_login: laurentS |
owner_login: laurentS |
||||
owner_html_url: https://github.com/laurentS |
owner_html_url: https://github.com/laurentS |
||||
|
- name: piccolo |
||||
|
html_url: https://github.com/piccolo-orm/piccolo |
||||
|
stars: 1854 |
||||
|
owner_login: piccolo-orm |
||||
|
owner_html_url: https://github.com/piccolo-orm |
||||
- name: fastapi-cache |
- name: fastapi-cache |
||||
html_url: https://github.com/long2ice/fastapi-cache |
html_url: https://github.com/long2ice/fastapi-cache |
||||
stars: 1789 |
stars: 1816 |
||||
owner_login: long2ice |
owner_login: long2ice |
||||
owner_html_url: https://github.com/long2ice |
owner_html_url: https://github.com/long2ice |
||||
|
- name: python-week-2022 |
||||
|
html_url: https://github.com/rochacbruno/python-week-2022 |
||||
|
stars: 1813 |
||||
|
owner_login: rochacbruno |
||||
|
owner_html_url: https://github.com/rochacbruno |
||||
- name: ormar |
- name: ormar |
||||
html_url: https://github.com/collerek/ormar |
html_url: https://github.com/collerek/ormar |
||||
stars: 1783 |
stars: 1797 |
||||
owner_login: collerek |
owner_login: collerek |
||||
owner_html_url: https://github.com/collerek |
owner_html_url: https://github.com/collerek |
||||
- name: termpair |
|
||||
html_url: https://github.com/cs01/termpair |
|
||||
stars: 1716 |
|
||||
owner_login: cs01 |
|
||||
owner_html_url: https://github.com/cs01 |
|
||||
- name: FastAPI-boilerplate |
- name: FastAPI-boilerplate |
||||
html_url: https://github.com/benavlabs/FastAPI-boilerplate |
html_url: https://github.com/benavlabs/FastAPI-boilerplate |
||||
stars: 1660 |
stars: 1792 |
||||
owner_login: benavlabs |
owner_login: benavlabs |
||||
owner_html_url: https://github.com/benavlabs |
owner_html_url: https://github.com/benavlabs |
||||
- name: fastapi-langgraph-agent-production-ready-template |
- name: termpair |
||||
html_url: https://github.com/wassim249/fastapi-langgraph-agent-production-ready-template |
html_url: https://github.com/cs01/termpair |
||||
stars: 1638 |
stars: 1727 |
||||
owner_login: wassim249 |
owner_login: cs01 |
||||
owner_html_url: https://github.com/wassim249 |
owner_html_url: https://github.com/cs01 |
||||
|
- name: fastapi-crudrouter |
||||
|
html_url: https://github.com/awtkns/fastapi-crudrouter |
||||
|
stars: 1677 |
||||
|
owner_login: awtkns |
||||
|
owner_html_url: https://github.com/awtkns |
||||
- name: langchain-serve |
- name: langchain-serve |
||||
html_url: https://github.com/jina-ai/langchain-serve |
html_url: https://github.com/jina-ai/langchain-serve |
||||
stars: 1635 |
stars: 1634 |
||||
owner_login: jina-ai |
owner_login: jina-ai |
||||
owner_html_url: https://github.com/jina-ai |
owner_html_url: https://github.com/jina-ai |
||||
- name: awesome-fastapi-projects |
|
||||
html_url: https://github.com/Kludex/awesome-fastapi-projects |
|
||||
stars: 1589 |
|
||||
owner_login: Kludex |
|
||||
owner_html_url: https://github.com/Kludex |
|
||||
- name: fastapi-pagination |
- name: fastapi-pagination |
||||
html_url: https://github.com/uriyyo/fastapi-pagination |
html_url: https://github.com/uriyyo/fastapi-pagination |
||||
stars: 1585 |
stars: 1607 |
||||
owner_login: uriyyo |
owner_login: uriyyo |
||||
owner_html_url: https://github.com/uriyyo |
owner_html_url: https://github.com/uriyyo |
||||
- name: coronavirus-tracker-api |
- name: awesome-fastapi-projects |
||||
html_url: https://github.com/ExpDev07/coronavirus-tracker-api |
html_url: https://github.com/Kludex/awesome-fastapi-projects |
||||
stars: 1574 |
stars: 1592 |
||||
owner_login: ExpDev07 |
owner_login: Kludex |
||||
owner_html_url: https://github.com/ExpDev07 |
owner_html_url: https://github.com/Kludex |
||||
- name: fastapi-crudrouter |
|
||||
html_url: https://github.com/awtkns/fastapi-crudrouter |
|
||||
stars: 1559 |
|
||||
owner_login: awtkns |
|
||||
owner_html_url: https://github.com/awtkns |
|
||||
- name: bracket |
- name: bracket |
||||
html_url: https://github.com/evroon/bracket |
html_url: https://github.com/evroon/bracket |
||||
stars: 1489 |
stars: 1580 |
||||
owner_login: evroon |
owner_login: evroon |
||||
owner_html_url: https://github.com/evroon |
owner_html_url: https://github.com/evroon |
||||
|
- name: coronavirus-tracker-api |
||||
|
html_url: https://github.com/ExpDev07/coronavirus-tracker-api |
||||
|
stars: 1570 |
||||
|
owner_login: ExpDev07 |
||||
|
owner_html_url: https://github.com/ExpDev07 |
||||
- name: fastapi-amis-admin |
- name: fastapi-amis-admin |
||||
html_url: https://github.com/amisadmin/fastapi-amis-admin |
html_url: https://github.com/amisadmin/fastapi-amis-admin |
||||
stars: 1475 |
stars: 1512 |
||||
owner_login: amisadmin |
owner_login: amisadmin |
||||
owner_html_url: https://github.com/amisadmin |
owner_html_url: https://github.com/amisadmin |
||||
|
- name: fastcrud |
||||
|
html_url: https://github.com/benavlabs/fastcrud |
||||
|
stars: 1471 |
||||
|
owner_login: benavlabs |
||||
|
owner_html_url: https://github.com/benavlabs |
||||
- name: fastapi-boilerplate |
- name: fastapi-boilerplate |
||||
html_url: https://github.com/teamhide/fastapi-boilerplate |
html_url: https://github.com/teamhide/fastapi-boilerplate |
||||
stars: 1436 |
stars: 1461 |
||||
owner_login: teamhide |
owner_login: teamhide |
||||
owner_html_url: https://github.com/teamhide |
owner_html_url: https://github.com/teamhide |
||||
- name: awesome-python-resources |
- name: awesome-python-resources |
||||
html_url: https://github.com/DjangoEx/awesome-python-resources |
html_url: https://github.com/DjangoEx/awesome-python-resources |
||||
stars: 1426 |
stars: 1435 |
||||
owner_login: DjangoEx |
owner_login: DjangoEx |
||||
owner_html_url: https://github.com/DjangoEx |
owner_html_url: https://github.com/DjangoEx |
||||
- name: fastcrud |
|
||||
html_url: https://github.com/benavlabs/fastcrud |
|
||||
stars: 1414 |
|
||||
owner_login: benavlabs |
|
||||
owner_html_url: https://github.com/benavlabs |
|
||||
- name: prometheus-fastapi-instrumentator |
- name: prometheus-fastapi-instrumentator |
||||
html_url: https://github.com/trallnag/prometheus-fastapi-instrumentator |
html_url: https://github.com/trallnag/prometheus-fastapi-instrumentator |
||||
stars: 1388 |
stars: 1417 |
||||
owner_login: trallnag |
owner_login: trallnag |
||||
owner_html_url: https://github.com/trallnag |
owner_html_url: https://github.com/trallnag |
||||
- name: fastapi_best_architecture |
|
||||
html_url: https://github.com/fastapi-practices/fastapi_best_architecture |
|
||||
stars: 1378 |
|
||||
owner_login: fastapi-practices |
|
||||
owner_html_url: https://github.com/fastapi-practices |
|
||||
- name: fastapi-code-generator |
- name: fastapi-code-generator |
||||
html_url: https://github.com/koxudaxi/fastapi-code-generator |
html_url: https://github.com/koxudaxi/fastapi-code-generator |
||||
stars: 1375 |
stars: 1382 |
||||
owner_login: koxudaxi |
owner_login: koxudaxi |
||||
owner_html_url: https://github.com/koxudaxi |
owner_html_url: https://github.com/koxudaxi |
||||
- name: budgetml |
|
||||
html_url: https://github.com/ebhy/budgetml |
|
||||
stars: 1345 |
|
||||
owner_login: ebhy |
|
||||
owner_html_url: https://github.com/ebhy |
|
||||
- name: fastapi-tutorial |
|
||||
html_url: https://github.com/liaogx/fastapi-tutorial |
|
||||
stars: 1327 |
|
||||
owner_login: liaogx |
|
||||
owner_html_url: https://github.com/liaogx |
|
||||
- name: fastapi-alembic-sqlmodel-async |
|
||||
html_url: https://github.com/jonra1993/fastapi-alembic-sqlmodel-async |
|
||||
stars: 1259 |
|
||||
owner_login: jonra1993 |
|
||||
owner_html_url: https://github.com/jonra1993 |
|
||||
- name: fastapi-scaff |
- name: fastapi-scaff |
||||
html_url: https://github.com/atpuxiner/fastapi-scaff |
html_url: https://github.com/atpuxiner/fastapi-scaff |
||||
stars: 1255 |
stars: 1367 |
||||
owner_login: atpuxiner |
owner_login: atpuxiner |
||||
owner_html_url: https://github.com/atpuxiner |
owner_html_url: https://github.com/atpuxiner |
||||
- name: bedrock-chat |
- name: fastapi-tutorial |
||||
html_url: https://github.com/aws-samples/bedrock-chat |
html_url: https://github.com/liaogx/fastapi-tutorial |
||||
stars: 1254 |
stars: 1360 |
||||
owner_login: aws-samples |
owner_login: liaogx |
||||
owner_html_url: https://github.com/aws-samples |
owner_html_url: https://github.com/liaogx |
||||
|
- name: budgetml |
||||
|
html_url: https://github.com/ebhy/budgetml |
||||
|
stars: 1343 |
||||
|
owner_login: ebhy |
||||
|
owner_html_url: https://github.com/ebhy |
||||
- name: bolt-python |
- name: bolt-python |
||||
html_url: https://github.com/slackapi/bolt-python |
html_url: https://github.com/slackapi/bolt-python |
||||
stars: 1253 |
stars: 1276 |
||||
owner_login: slackapi |
owner_login: slackapi |
||||
owner_html_url: https://github.com/slackapi |
owner_html_url: https://github.com/slackapi |
||||
|
- name: bedrock-chat |
||||
|
html_url: https://github.com/aws-samples/bedrock-chat |
||||
|
stars: 1268 |
||||
|
owner_login: aws-samples |
||||
|
owner_html_url: https://github.com/aws-samples |
||||
|
- name: fastapi-alembic-sqlmodel-async |
||||
|
html_url: https://github.com/vargasjona/fastapi-alembic-sqlmodel-async |
||||
|
stars: 1265 |
||||
|
owner_login: vargasjona |
||||
|
owner_html_url: https://github.com/vargasjona |
||||
- name: fastapi_production_template |
- name: fastapi_production_template |
||||
html_url: https://github.com/zhanymkanov/fastapi_production_template |
html_url: https://github.com/zhanymkanov/fastapi_production_template |
||||
stars: 1217 |
stars: 1227 |
||||
owner_login: zhanymkanov |
owner_login: zhanymkanov |
||||
owner_html_url: https://github.com/zhanymkanov |
owner_html_url: https://github.com/zhanymkanov |
||||
- name: langchain-extract |
|
||||
html_url: https://github.com/langchain-ai/langchain-extract |
|
||||
stars: 1176 |
|
||||
owner_login: langchain-ai |
|
||||
owner_html_url: https://github.com/langchain-ai |
|
||||
- name: restish |
- name: restish |
||||
html_url: https://github.com/rest-sh/restish |
html_url: https://github.com/rest-sh/restish |
||||
stars: 1140 |
stars: 1200 |
||||
owner_login: rest-sh |
owner_login: rest-sh |
||||
owner_html_url: https://github.com/rest-sh |
owner_html_url: https://github.com/rest-sh |
||||
|
- name: langchain-extract |
||||
|
html_url: https://github.com/langchain-ai/langchain-extract |
||||
|
stars: 1183 |
||||
|
owner_login: langchain-ai |
||||
|
owner_html_url: https://github.com/langchain-ai |
||||
- name: odmantic |
- name: odmantic |
||||
html_url: https://github.com/art049/odmantic |
html_url: https://github.com/art049/odmantic |
||||
stars: 1138 |
stars: 1162 |
||||
owner_login: art049 |
owner_login: art049 |
||||
owner_html_url: https://github.com/art049 |
owner_html_url: https://github.com/art049 |
||||
|
- name: aktools |
||||
|
html_url: https://github.com/akfamily/aktools |
||||
|
stars: 1155 |
||||
|
owner_login: akfamily |
||||
|
owner_html_url: https://github.com/akfamily |
||||
|
- name: RuoYi-Vue3-FastAPI |
||||
|
html_url: https://github.com/insistence/RuoYi-Vue3-FastAPI |
||||
|
stars: 1155 |
||||
|
owner_login: insistence |
||||
|
owner_html_url: https://github.com/insistence |
||||
- name: authx |
- name: authx |
||||
html_url: https://github.com/yezz123/authx |
html_url: https://github.com/yezz123/authx |
||||
stars: 1119 |
stars: 1142 |
||||
owner_login: yezz123 |
owner_login: yezz123 |
||||
owner_html_url: https://github.com/yezz123 |
owner_html_url: https://github.com/yezz123 |
||||
- name: NoteDiscovery |
- name: SAG |
||||
html_url: https://github.com/gamosoft/NoteDiscovery |
html_url: https://github.com/Zleap-AI/SAG |
||||
stars: 1107 |
stars: 1110 |
||||
owner_login: gamosoft |
owner_login: Zleap-AI |
||||
owner_html_url: https://github.com/gamosoft |
owner_html_url: https://github.com/Zleap-AI |
||||
- name: flock |
- name: flock |
||||
html_url: https://github.com/Onelevenvy/flock |
html_url: https://github.com/Onelevenvy/flock |
||||
stars: 1055 |
stars: 1069 |
||||
owner_login: Onelevenvy |
owner_login: Onelevenvy |
||||
owner_html_url: https://github.com/Onelevenvy |
owner_html_url: https://github.com/Onelevenvy |
||||
- name: fastapi-observability |
- name: fastapi-observability |
||||
html_url: https://github.com/blueswen/fastapi-observability |
html_url: https://github.com/blueswen/fastapi-observability |
||||
stars: 1038 |
stars: 1063 |
||||
owner_login: blueswen |
owner_login: blueswen |
||||
owner_html_url: https://github.com/blueswen |
owner_html_url: https://github.com/blueswen |
||||
- name: aktools |
- name: enterprise-deep-research |
||||
html_url: https://github.com/akfamily/aktools |
html_url: https://github.com/SalesforceAIResearch/enterprise-deep-research |
||||
stars: 1027 |
stars: 1061 |
||||
owner_login: akfamily |
owner_login: SalesforceAIResearch |
||||
owner_html_url: https://github.com/akfamily |
owner_html_url: https://github.com/SalesforceAIResearch |
||||
- name: RuoYi-Vue3-FastAPI |
|
||||
html_url: https://github.com/insistence/RuoYi-Vue3-FastAPI |
|
||||
stars: 1016 |
|
||||
owner_login: insistence |
|
||||
owner_html_url: https://github.com/insistence |
|
||||
- name: autollm |
|
||||
html_url: https://github.com/viddexa/autollm |
|
||||
stars: 1002 |
|
||||
owner_login: viddexa |
|
||||
owner_html_url: https://github.com/viddexa |
|
||||
- name: titiler |
- name: titiler |
||||
html_url: https://github.com/developmentseed/titiler |
html_url: https://github.com/developmentseed/titiler |
||||
stars: 999 |
stars: 1039 |
||||
owner_login: developmentseed |
owner_login: developmentseed |
||||
owner_html_url: https://github.com/developmentseed |
owner_html_url: https://github.com/developmentseed |
||||
- name: lanarky |
|
||||
html_url: https://github.com/ajndkr/lanarky |
|
||||
stars: 994 |
|
||||
owner_login: ajndkr |
|
||||
owner_html_url: https://github.com/ajndkr |
|
||||
- name: every-pdf |
- name: every-pdf |
||||
html_url: https://github.com/DDULDDUCK/every-pdf |
html_url: https://github.com/DDULDDUCK/every-pdf |
||||
stars: 985 |
stars: 1017 |
||||
owner_login: DDULDDUCK |
owner_login: DDULDDUCK |
||||
owner_html_url: https://github.com/DDULDDUCK |
owner_html_url: https://github.com/DDULDDUCK |
||||
- name: enterprise-deep-research |
- name: autollm |
||||
html_url: https://github.com/SalesforceAIResearch/enterprise-deep-research |
html_url: https://github.com/viddexa/autollm |
||||
stars: 973 |
stars: 1005 |
||||
owner_login: SalesforceAIResearch |
owner_login: viddexa |
||||
owner_html_url: https://github.com/SalesforceAIResearch |
owner_html_url: https://github.com/viddexa |
||||
- name: fastapi-mail |
- name: lanarky |
||||
html_url: https://github.com/sabuhish/fastapi-mail |
html_url: https://github.com/ajndkr/lanarky |
||||
stars: 964 |
stars: 995 |
||||
owner_login: sabuhish |
owner_login: ajndkr |
||||
owner_html_url: https://github.com/sabuhish |
owner_html_url: https://github.com/ajndkr |
||||
|
|||||
|
After Width: | Height: | Size: 187 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
@ -0,0 +1,11 @@ |
|||||
|
/// details | 🌐 Translation by AI and humans |
||||
|
|
||||
|
This translation was made by AI guided by humans. 🤝 |
||||
|
|
||||
|
It could have mistakes of misunderstanding the original meaning, or looking unnatural, etc. 🤖 |
||||
|
|
||||
|
You can improve this translation by [helping us guide the AI LLM better](https://fastapi.tiangolo.com/contributing/#translations). |
||||
|
|
||||
|
[English version](ENGLISH_VERSION_URL) |
||||
|
|
||||
|
/// |
||||
@ -22,22 +22,13 @@ Here's a general idea of how the models could look like with their password fiel |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial001_py310.py hl[7,9,14,20,22,27:28,31:33,38:39] *} |
{* ../../docs_src/extra_models/tutorial001_py310.py hl[7,9,14,20,22,27:28,31:33,38:39] *} |
||||
|
|
||||
|
### About `**user_in.model_dump()` { #about-user-in-model-dump } |
||||
|
|
||||
/// info |
#### Pydantic's `.model_dump()` { #pydantics-model-dump } |
||||
|
|
||||
In Pydantic v1 the method was called `.dict()`, it was deprecated (but still supported) in Pydantic v2, and renamed to `.model_dump()`. |
|
||||
|
|
||||
The examples here use `.dict()` for compatibility with Pydantic v1, but you should use `.model_dump()` instead if you can use Pydantic v2. |
|
||||
|
|
||||
/// |
|
||||
|
|
||||
### About `**user_in.dict()` { #about-user-in-dict } |
|
||||
|
|
||||
#### Pydantic's `.dict()` { #pydantics-dict } |
|
||||
|
|
||||
`user_in` is a Pydantic model of class `UserIn`. |
`user_in` is a Pydantic model of class `UserIn`. |
||||
|
|
||||
Pydantic models have a `.dict()` method that returns a `dict` with the model's data. |
Pydantic models have a `.model_dump()` method that returns a `dict` with the model's data. |
||||
|
|
||||
So, if we create a Pydantic object `user_in` like: |
So, if we create a Pydantic object `user_in` like: |
||||
|
|
||||
@ -48,7 +39,7 @@ user_in = UserIn(username="john", password="secret", email="[email protected] |
|||||
and then we call: |
and then we call: |
||||
|
|
||||
```Python |
```Python |
||||
user_dict = user_in.dict() |
user_dict = user_in.model_dump() |
||||
``` |
``` |
||||
|
|
||||
we now have a `dict` with the data in the variable `user_dict` (it's a `dict` instead of a Pydantic model object). |
we now have a `dict` with the data in the variable `user_dict` (it's a `dict` instead of a Pydantic model object). |
||||
@ -104,20 +95,20 @@ UserInDB( |
|||||
|
|
||||
#### A Pydantic model from the contents of another { #a-pydantic-model-from-the-contents-of-another } |
#### A Pydantic model from the contents of another { #a-pydantic-model-from-the-contents-of-another } |
||||
|
|
||||
As in the example above we got `user_dict` from `user_in.dict()`, this code: |
As in the example above we got `user_dict` from `user_in.model_dump()`, this code: |
||||
|
|
||||
```Python |
```Python |
||||
user_dict = user_in.dict() |
user_dict = user_in.model_dump() |
||||
UserInDB(**user_dict) |
UserInDB(**user_dict) |
||||
``` |
``` |
||||
|
|
||||
would be equivalent to: |
would be equivalent to: |
||||
|
|
||||
```Python |
```Python |
||||
UserInDB(**user_in.dict()) |
UserInDB(**user_in.model_dump()) |
||||
``` |
``` |
||||
|
|
||||
...because `user_in.dict()` is a `dict`, and then we make Python "unpack" it by passing it to `UserInDB` prefixed with `**`. |
...because `user_in.model_dump()` is a `dict`, and then we make Python "unpack" it by passing it to `UserInDB` prefixed with `**`. |
||||
|
|
||||
So, we get a Pydantic model from the data in another Pydantic model. |
So, we get a Pydantic model from the data in another Pydantic model. |
||||
|
|
||||
@ -126,7 +117,7 @@ So, we get a Pydantic model from the data in another Pydantic model. |
|||||
And then adding the extra keyword argument `hashed_password=hashed_password`, like in: |
And then adding the extra keyword argument `hashed_password=hashed_password`, like in: |
||||
|
|
||||
```Python |
```Python |
||||
UserInDB(**user_in.dict(), hashed_password=hashed_password) |
UserInDB(**user_in.model_dump(), hashed_password=hashed_password) |
||||
``` |
``` |
||||
|
|
||||
...ends up being like: |
...ends up being like: |
||||
@ -181,7 +172,6 @@ When defining a <a href="https://docs.pydantic.dev/latest/concepts/types/#unions |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial003_py310.py hl[1,14:15,18:20,33] *} |
{* ../../docs_src/extra_models/tutorial003_py310.py hl[1,14:15,18:20,33] *} |
||||
|
|
||||
|
|
||||
### `Union` in Python 3.10 { #union-in-python-3-10 } |
### `Union` in Python 3.10 { #union-in-python-3-10 } |
||||
|
|
||||
In this example we pass `Union[PlaneItem, CarItem]` as the value of the argument `response_model`. |
In this example we pass `Union[PlaneItem, CarItem]` as the value of the argument `response_model`. |
||||
@ -204,7 +194,6 @@ For that, use the standard Python `typing.List` (or just `list` in Python 3.9 an |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial004_py39.py hl[18] *} |
{* ../../docs_src/extra_models/tutorial004_py39.py hl[18] *} |
||||
|
|
||||
|
|
||||
## Response with arbitrary `dict` { #response-with-arbitrary-dict } |
## Response with arbitrary `dict` { #response-with-arbitrary-dict } |
||||
|
|
||||
You can also declare a response using a plain arbitrary `dict`, declaring just the type of the keys and values, without using a Pydantic model. |
You can also declare a response using a plain arbitrary `dict`, declaring just the type of the keys and values, without using a Pydantic model. |
||||
@ -215,7 +204,6 @@ In this case, you can use `typing.Dict` (or just `dict` in Python 3.9 and above) |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial005_py39.py hl[6] *} |
{* ../../docs_src/extra_models/tutorial005_py39.py hl[6] *} |
||||
|
|
||||
|
|
||||
## Recap { #recap } |
## Recap { #recap } |
||||
|
|
||||
Use multiple Pydantic models and inherit freely for each case. |
Use multiple Pydantic models and inherit freely for each case. |
||||
|
|||||
@ -46,12 +46,6 @@ $ pip install "fastapi[all]" |
|||||
|
|
||||
</div> |
</div> |
||||
|
|
||||
/// info | Información |
|
||||
|
|
||||
En Pydantic v1 venía incluido con el paquete principal. Ahora se distribuye como este paquete independiente para que puedas elegir si instalarlo o no si no necesitas esa funcionalidad. |
|
||||
|
|
||||
/// |
|
||||
|
|
||||
### Crear el objeto `Settings` { #create-the-settings-object } |
### Crear el objeto `Settings` { #create-the-settings-object } |
||||
|
|
||||
Importa `BaseSettings` de Pydantic y crea una sub-clase, muy similar a un modelo de Pydantic. |
Importa `BaseSettings` de Pydantic y crea una sub-clase, muy similar a un modelo de Pydantic. |
||||
@ -60,31 +54,15 @@ De la misma forma que con los modelos de Pydantic, declaras atributos de clase c |
|||||
|
|
||||
Puedes usar todas las mismas funcionalidades de validación y herramientas que usas para los modelos de Pydantic, como diferentes tipos de datos y validaciones adicionales con `Field()`. |
Puedes usar todas las mismas funcionalidades de validación y herramientas que usas para los modelos de Pydantic, como diferentes tipos de datos y validaciones adicionales con `Field()`. |
||||
|
|
||||
//// tab | Pydantic v2 |
|
||||
|
|
||||
{* ../../docs_src/settings/tutorial001_py39.py hl[2,5:8,11] *} |
{* ../../docs_src/settings/tutorial001_py39.py hl[2,5:8,11] *} |
||||
|
|
||||
//// |
|
||||
|
|
||||
//// tab | Pydantic v1 |
|
||||
|
|
||||
/// info | Información |
|
||||
|
|
||||
En Pydantic v1 importarías `BaseSettings` directamente desde `pydantic` en lugar de desde `pydantic_settings`. |
|
||||
|
|
||||
/// |
|
||||
|
|
||||
{* ../../docs_src/settings/tutorial001_pv1_py39.py hl[2,5:8,11] *} |
|
||||
|
|
||||
//// |
|
||||
|
|
||||
/// tip | Consejo |
/// tip | Consejo |
||||
|
|
||||
Si quieres algo rápido para copiar y pegar, no uses este ejemplo, usa el último más abajo. |
Si quieres algo rápido para copiar y pegar, no uses este ejemplo, usa el último más abajo. |
||||
|
|
||||
/// |
/// |
||||
|
|
||||
Luego, cuando creas una instance de esa clase `Settings` (en este caso, en el objeto `settings`), Pydantic leerá las variables de entorno de una manera indiferente a mayúsculas y minúsculas, por lo que una variable en mayúsculas `APP_NAME` aún será leída para el atributo `app_name`. |
Luego, cuando creas un instance de esa clase `Settings` (en este caso, en el objeto `settings`), Pydantic leerá las variables de entorno de una manera indiferente a mayúsculas y minúsculas, por lo que una variable en mayúsculas `APP_NAME` aún será leída para el atributo `app_name`. |
||||
|
|
||||
Luego convertirá y validará los datos. Así que, cuando uses ese objeto `settings`, tendrás datos de los tipos que declaraste (por ejemplo, `items_per_user` será un `int`). |
Luego convertirá y validará los datos. Así que, cuando uses ese objeto `settings`, tendrás datos de los tipos que declaraste (por ejemplo, `items_per_user` será un `int`). |
||||
|
|
||||
@ -110,7 +88,7 @@ $ ADMIN_EMAIL="[email protected]" APP_NAME="ChimichangApp" fastapi run main.p |
|||||
|
|
||||
/// tip | Consejo |
/// tip | Consejo |
||||
|
|
||||
Para establecer múltiples variables de entorno para un solo comando, simplemente sepáralas con un espacio y ponlas todas antes del comando. |
Para establecer múltiples env vars para un solo comando, simplemente sepáralas con un espacio y ponlas todas antes del comando. |
||||
|
|
||||
/// |
/// |
||||
|
|
||||
@ -150,7 +128,7 @@ Proveniente del ejemplo anterior, tu archivo `config.py` podría verse como: |
|||||
|
|
||||
{* ../../docs_src/settings/app02_an_py39/config.py hl[10] *} |
{* ../../docs_src/settings/app02_an_py39/config.py hl[10] *} |
||||
|
|
||||
Nota que ahora no creamos una instance por defecto `settings = Settings()`. |
Nota que ahora no creamos un instance por defecto `settings = Settings()`. |
||||
|
|
||||
### El archivo principal de la app { #the-main-app-file } |
### El archivo principal de la app { #the-main-app-file } |
||||
|
|
||||
@ -172,11 +150,11 @@ Y luego podemos requerirlo desde la *path operation function* como una dependenc |
|||||
|
|
||||
### Configuraciones y pruebas { #settings-and-testing } |
### Configuraciones y pruebas { #settings-and-testing } |
||||
|
|
||||
Luego sería muy fácil proporcionar un objeto de configuraciones diferente durante las pruebas al sobrescribir una dependencia para `get_settings`: |
Luego sería muy fácil proporcionar un objeto de configuraciones diferente durante las pruebas al crear una sobrescritura de dependencia para `get_settings`: |
||||
|
|
||||
{* ../../docs_src/settings/app02_an_py39/test_main.py hl[9:10,13,21] *} |
{* ../../docs_src/settings/app02_an_py39/test_main.py hl[9:10,13,21] *} |
||||
|
|
||||
En la dependencia sobreescrita establecemos un nuevo valor para el `admin_email` al crear el nuevo objeto `Settings`, y luego devolvemos ese nuevo objeto. |
En la sobrescritura de dependencia establecemos un nuevo valor para el `admin_email` al crear el nuevo objeto `Settings`, y luego devolvemos ese nuevo objeto. |
||||
|
|
||||
Luego podemos probar que se está usando. |
Luego podemos probar que se está usando. |
||||
|
|
||||
@ -215,8 +193,6 @@ APP_NAME="ChimichangApp" |
|||||
|
|
||||
Y luego actualizar tu `config.py` con: |
Y luego actualizar tu `config.py` con: |
||||
|
|
||||
//// tab | Pydantic v2 |
|
||||
|
|
||||
{* ../../docs_src/settings/app03_an_py39/config.py hl[9] *} |
{* ../../docs_src/settings/app03_an_py39/config.py hl[9] *} |
||||
|
|
||||
/// tip | Consejo |
/// tip | Consejo |
||||
@ -225,26 +201,6 @@ El atributo `model_config` se usa solo para configuración de Pydantic. Puedes l |
|||||
|
|
||||
/// |
/// |
||||
|
|
||||
//// |
|
||||
|
|
||||
//// tab | Pydantic v1 |
|
||||
|
|
||||
{* ../../docs_src/settings/app03_an_py39/config_pv1.py hl[9:10] *} |
|
||||
|
|
||||
/// tip | Consejo |
|
||||
|
|
||||
La clase `Config` se usa solo para configuración de Pydantic. Puedes leer más en <a href="https://docs.pydantic.dev/1.10/usage/model_config/" class="external-link" target="_blank">Pydantic Model Config</a>. |
|
||||
|
|
||||
/// |
|
||||
|
|
||||
//// |
|
||||
|
|
||||
/// info | Información |
|
||||
|
|
||||
En la versión 1 de Pydantic la configuración se hacía en una clase interna `Config`, en la versión 2 de Pydantic se hace en un atributo `model_config`. Este atributo toma un `dict`, y para obtener autocompletado y errores en línea, puedes importar y usar `SettingsConfigDict` para definir ese `dict`. |
|
||||
|
|
||||
/// |
|
||||
|
|
||||
Aquí definimos la configuración `env_file` dentro de tu clase Pydantic `Settings`, y establecemos el valor en el nombre del archivo con el archivo dotenv que queremos usar. |
Aquí definimos la configuración `env_file` dentro de tu clase Pydantic `Settings`, y establecemos el valor en el nombre del archivo con el archivo dotenv que queremos usar. |
||||
|
|
||||
### Creando el `Settings` solo una vez con `lru_cache` { #creating-the-settings-only-once-with-lru-cache } |
### Creando el `Settings` solo una vez con `lru_cache` { #creating-the-settings-only-once-with-lru-cache } |
||||
@ -331,7 +287,7 @@ participant execute as Ejecutar función |
|||||
end |
end |
||||
``` |
``` |
||||
|
|
||||
En el caso de nuestra dependencia `get_settings()`, la función ni siquiera toma argumentos, por lo que siempre devolverá el mismo valor. |
En el caso de nuestra dependencia `get_settings()`, la función ni siquiera toma argumentos, por lo que siempre devuelve el mismo valor. |
||||
|
|
||||
De esa manera, se comporta casi como si fuera solo una variable global. Pero como usa una función de dependencia, entonces podemos sobrescribirla fácilmente para las pruebas. |
De esa manera, se comporta casi como si fuera solo una variable global. Pero como usa una función de dependencia, entonces podemos sobrescribirla fácilmente para las pruebas. |
||||
|
|
||||
|
|||||
@ -22,21 +22,13 @@ Aquí tienes una idea general de cómo podrían ser los modelos con sus campos d |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial001_py310.py hl[7,9,14,20,22,27:28,31:33,38:39] *} |
{* ../../docs_src/extra_models/tutorial001_py310.py hl[7,9,14,20,22,27:28,31:33,38:39] *} |
||||
|
|
||||
/// info | Información |
### Acerca de `**user_in.model_dump()` { #about-user-in-model-dump } |
||||
|
|
||||
En Pydantic v1 el método se llamaba `.dict()`, fue deprecado (pero aún soportado) en Pydantic v2, y renombrado a `.model_dump()`. |
#### `.model_dump()` de Pydantic { #pydantics-model-dump } |
||||
|
|
||||
Los ejemplos aquí usan `.dict()` para compatibilidad con Pydantic v1, pero deberías usar `.model_dump()` en su lugar si puedes usar Pydantic v2. |
|
||||
|
|
||||
/// |
|
||||
|
|
||||
### Acerca de `**user_in.dict()` { #about-user-in-dict } |
|
||||
|
|
||||
#### `.dict()` de Pydantic { #pydantics-dict } |
|
||||
|
|
||||
`user_in` es un modelo Pydantic de la clase `UserIn`. |
`user_in` es un modelo Pydantic de la clase `UserIn`. |
||||
|
|
||||
Los modelos Pydantic tienen un método `.dict()` que devuelve un `dict` con los datos del modelo. |
Los modelos Pydantic tienen un método `.model_dump()` que devuelve un `dict` con los datos del modelo. |
||||
|
|
||||
Así que, si creamos un objeto Pydantic `user_in` como: |
Así que, si creamos un objeto Pydantic `user_in` como: |
||||
|
|
||||
@ -47,7 +39,7 @@ user_in = UserIn(username="john", password="secret", email="[email protected] |
|||||
y luego llamamos a: |
y luego llamamos a: |
||||
|
|
||||
```Python |
```Python |
||||
user_dict = user_in.dict() |
user_dict = user_in.model_dump() |
||||
``` |
``` |
||||
|
|
||||
ahora tenemos un `dict` con los datos en la variable `user_dict` (es un `dict` en lugar de un objeto modelo Pydantic). |
ahora tenemos un `dict` con los datos en la variable `user_dict` (es un `dict` en lugar de un objeto modelo Pydantic). |
||||
@ -58,7 +50,7 @@ Y si llamamos a: |
|||||
print(user_dict) |
print(user_dict) |
||||
``` |
``` |
||||
|
|
||||
obtendremos un `dict` de Python con: |
obtendríamos un `dict` de Python con: |
||||
|
|
||||
```Python |
```Python |
||||
{ |
{ |
||||
@ -103,20 +95,20 @@ UserInDB( |
|||||
|
|
||||
#### Un modelo Pydantic a partir del contenido de otro { #a-pydantic-model-from-the-contents-of-another } |
#### Un modelo Pydantic a partir del contenido de otro { #a-pydantic-model-from-the-contents-of-another } |
||||
|
|
||||
Como en el ejemplo anterior obtuvimos `user_dict` de `user_in.dict()`, este código: |
Como en el ejemplo anterior obtuvimos `user_dict` de `user_in.model_dump()`, este código: |
||||
|
|
||||
```Python |
```Python |
||||
user_dict = user_in.dict() |
user_dict = user_in.model_dump() |
||||
UserInDB(**user_dict) |
UserInDB(**user_dict) |
||||
``` |
``` |
||||
|
|
||||
sería equivalente a: |
sería equivalente a: |
||||
|
|
||||
```Python |
```Python |
||||
UserInDB(**user_in.dict()) |
UserInDB(**user_in.model_dump()) |
||||
``` |
``` |
||||
|
|
||||
...porque `user_in.dict()` es un `dict`, y luego hacemos que Python lo "desempaquete" al pasarlo a `UserInDB` con el prefijo `**`. |
...porque `user_in.model_dump()` es un `dict`, y luego hacemos que Python lo "desempaquete" al pasarlo a `UserInDB` con el prefijo `**`. |
||||
|
|
||||
Así, obtenemos un modelo Pydantic a partir de los datos en otro modelo Pydantic. |
Así, obtenemos un modelo Pydantic a partir de los datos en otro modelo Pydantic. |
||||
|
|
||||
@ -125,7 +117,7 @@ Así, obtenemos un modelo Pydantic a partir de los datos en otro modelo Pydantic |
|||||
Y luego agregando el argumento de palabra clave adicional `hashed_password=hashed_password`, como en: |
Y luego agregando el argumento de palabra clave adicional `hashed_password=hashed_password`, como en: |
||||
|
|
||||
```Python |
```Python |
||||
UserInDB(**user_in.dict(), hashed_password=hashed_password) |
UserInDB(**user_in.model_dump(), hashed_password=hashed_password) |
||||
``` |
``` |
||||
|
|
||||
...termina siendo como: |
...termina siendo como: |
||||
@ -156,7 +148,7 @@ Y estos modelos están compartiendo muchos de los datos y duplicando nombres y t |
|||||
|
|
||||
Podríamos hacerlo mejor. |
Podríamos hacerlo mejor. |
||||
|
|
||||
Podemos declarar un modelo `UserBase` que sirva como base para nuestros otros modelos. Y luego podemos hacer subclases de ese modelo que heredan sus atributos (anotaciones de tipos, validación, etc). |
Podemos declarar un modelo `UserBase` que sirva como base para nuestros otros modelos. Y luego podemos hacer subclases de ese modelo que heredan sus atributos (declaraciones de tipos, validación, etc). |
||||
|
|
||||
Toda la conversión de datos, validación, documentación, etc. seguirá funcionando normalmente. |
Toda la conversión de datos, validación, documentación, etc. seguirá funcionando normalmente. |
||||
|
|
||||
@ -180,20 +172,19 @@ Al definir una <a href="https://docs.pydantic.dev/latest/concepts/types/#unions" |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial003_py310.py hl[1,14:15,18:20,33] *} |
{* ../../docs_src/extra_models/tutorial003_py310.py hl[1,14:15,18:20,33] *} |
||||
|
|
||||
|
|
||||
### `Union` en Python 3.10 { #union-in-python-3-10 } |
### `Union` en Python 3.10 { #union-in-python-3-10 } |
||||
|
|
||||
En este ejemplo pasamos `Union[PlaneItem, CarItem]` como el valor del argumento `response_model`. |
En este ejemplo pasamos `Union[PlaneItem, CarItem]` como el valor del argumento `response_model`. |
||||
|
|
||||
Porque lo estamos pasando como un **valor a un argumento** en lugar de ponerlo en **anotaciones de tipos**, tenemos que usar `Union` incluso en Python 3.10. |
Porque lo estamos pasando como un **valor a un argumento** en lugar de ponerlo en una **anotación de tipos**, tenemos que usar `Union` incluso en Python 3.10. |
||||
|
|
||||
Si estuviera en anotaciones de tipos podríamos haber usado la barra vertical, como: |
Si estuviera en una anotación de tipos podríamos haber usado la barra vertical, como: |
||||
|
|
||||
```Python |
```Python |
||||
some_variable: PlaneItem | CarItem |
some_variable: PlaneItem | CarItem |
||||
``` |
``` |
||||
|
|
||||
Pero si ponemos eso en la asignación `response_model=PlaneItem | CarItem` obtendríamos un error, porque Python intentaría realizar una **operación inválida** entre `PlaneItem` y `CarItem` en lugar de interpretar eso como anotaciones de tipos. |
Pero si ponemos eso en la asignación `response_model=PlaneItem | CarItem` obtendríamos un error, porque Python intentaría realizar una **operación inválida** entre `PlaneItem` y `CarItem` en lugar de interpretar eso como una anotación de tipos. |
||||
|
|
||||
## Lista de modelos { #list-of-models } |
## Lista de modelos { #list-of-models } |
||||
|
|
||||
@ -203,7 +194,6 @@ Para eso, usa el `typing.List` estándar de Python (o simplemente `list` en Pyth |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial004_py39.py hl[18] *} |
{* ../../docs_src/extra_models/tutorial004_py39.py hl[18] *} |
||||
|
|
||||
|
|
||||
## Response con `dict` arbitrario { #response-with-arbitrary-dict } |
## Response con `dict` arbitrario { #response-with-arbitrary-dict } |
||||
|
|
||||
También puedes declarar un response usando un `dict` arbitrario plano, declarando solo el tipo de las claves y valores, sin usar un modelo Pydantic. |
También puedes declarar un response usando un `dict` arbitrario plano, declarando solo el tipo de las claves y valores, sin usar un modelo Pydantic. |
||||
@ -214,7 +204,6 @@ En este caso, puedes usar `typing.Dict` (o solo `dict` en Python 3.9 y posterior |
|||||
|
|
||||
{* ../../docs_src/extra_models/tutorial005_py39.py hl[6] *} |
{* ../../docs_src/extra_models/tutorial005_py39.py hl[6] *} |
||||
|
|
||||
|
|
||||
## Recapitulación { #recap } |
## Recapitulación { #recap } |
||||
|
|
||||
Usa múltiples modelos Pydantic y hereda libremente para cada caso. |
Usa múltiples modelos Pydantic y hereda libremente para cada caso. |
||||
|
|||||
@ -0,0 +1,47 @@ |
|||||
|
### Target language |
||||
|
|
||||
|
Translate to Japanese (日本語). |
||||
|
|
||||
|
Language code: ja. |
||||
|
|
||||
|
### Grammar and tone |
||||
|
|
||||
|
- Use polite, instructional Japanese (です/ます調). |
||||
|
- Keep the tone concise and technical (match existing Japanese FastAPI docs). |
||||
|
|
||||
|
### Headings |
||||
|
|
||||
|
- Follow the existing Japanese style: short, descriptive headings (often noun phrases), e.g. 「チェック」. |
||||
|
- Do not add a trailing period at the end of headings. |
||||
|
|
||||
|
### Quotes |
||||
|
|
||||
|
- Prefer Japanese corner brackets 「」 in normal prose when quoting a term. |
||||
|
- Do not change quotes inside inline code, code blocks, URLs, or file paths. |
||||
|
|
||||
|
### Ellipsis |
||||
|
|
||||
|
- Keep ellipsis style consistent with existing Japanese docs (commonly `...`). |
||||
|
- Never change `...` in code, URLs, or CLI examples. |
||||
|
|
||||
|
### Preferred translations / glossary |
||||
|
|
||||
|
Use the following preferred translations when they apply in documentation prose: |
||||
|
|
||||
|
- request (HTTP): リクエスト |
||||
|
- response (HTTP): レスポンス |
||||
|
- path operation: パスオペレーション |
||||
|
- path operation function: パスオペレーション関数 |
||||
|
|
||||
|
### `///` admonitions |
||||
|
|
||||
|
1) Keep the admonition keyword in English (do not translate `note`, `tip`, etc.). |
||||
|
2) If a title is present, prefer these canonical titles: |
||||
|
|
||||
|
- `/// note | 備考` |
||||
|
- `/// note | 技術詳細` |
||||
|
- `/// tip | 豆知識` |
||||
|
- `/// warning | 注意` |
||||
|
- `/// info | 情報` |
||||
|
- `/// check | 確認` |
||||
|
- `/// danger | 警告` |
||||
@ -0,0 +1,503 @@ |
|||||
|
# LLM 테스트 파일 { #llm-test-file } |
||||
|
|
||||
|
이 문서는 문서를 번역하는 <abbr title="Large Language Model - 대규모 언어 모델">LLM</abbr>이 `scripts/translate.py`의 `general_prompt`와 `docs/{language code}/llm-prompt.md`의 언어별 프롬프트를 이해하는지 테스트합니다. 언어별 프롬프트는 `general_prompt`에 추가됩니다. |
||||
|
|
||||
|
여기에 추가된 테스트는 언어별 프롬프트를 설계하는 모든 사람이 보게 됩니다. |
||||
|
|
||||
|
사용 방법은 다음과 같습니다: |
||||
|
|
||||
|
* 언어별 프롬프트 `docs/{language code}/llm-prompt.md`를 준비합니다. |
||||
|
* 이 문서를 원하는 대상 언어로 새로 번역합니다(예: `translate.py`의 `translate-page` 명령). 그러면 `docs/{language code}/docs/_llm-test.md` 아래에 번역이 생성됩니다. |
||||
|
* 번역에서 문제가 없는지 확인합니다. |
||||
|
* 필요하다면 언어별 프롬프트, 일반 프롬프트, 또는 영어 문서를 개선합니다. |
||||
|
* 그런 다음 번역에서 남아 있는 문제를 수동으로 수정해 좋은 번역이 되게 합니다. |
||||
|
* 좋은 번역을 둔 상태에서 다시 번역합니다. 이상적인 결과는 LLM이 더 이상 번역에 변경을 만들지 않는 것입니다. 이는 일반 프롬프트와 언어별 프롬프트가 가능한 한 최선이라는 뜻입니다(때때로 몇 가지 seemingly random 변경을 할 수 있는데, 그 이유는 <a href="https://doublespeak.chat/#/handbook#deterministic-output" class="external-link" target="_blank">LLM은 결정론적 알고리즘이 아니기 때문</a>입니다). |
||||
|
|
||||
|
테스트: |
||||
|
|
||||
|
## 코드 스니펫 { #code-snippets } |
||||
|
|
||||
|
//// tab | 테스트 |
||||
|
|
||||
|
다음은 코드 스니펫입니다: `foo`. 그리고 이것은 또 다른 코드 스니펫입니다: `bar`. 그리고 또 하나: `baz quux`. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
//// tab | 정보 |
||||
|
|
||||
|
코드 스니펫의 내용은 그대로 두어야 합니다. |
||||
|
|
||||
|
`scripts/translate.py`의 일반 프롬프트에서 `### Content of code snippets` 섹션을 참고하세요. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
## 따옴표 { #quotes } |
||||
|
|
||||
|
//// tab | 테스트 |
||||
|
|
||||
|
어제 제 친구가 이렇게 썼습니다: "If you spell incorrectly correctly, you have spelled it incorrectly". 이에 저는 이렇게 답했습니다: "Correct, but 'incorrectly' is incorrectly not '"incorrectly"'"". |
||||
|
|
||||
|
/// note | 참고 |
||||
|
|
||||
|
LLM은 아마 이것을 잘못 번역할 것입니다. 흥미로운 점은 재번역할 때 고정된 번역을 유지하는지 여부뿐입니다. |
||||
|
|
||||
|
/// |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
//// tab | 정보 |
||||
|
|
||||
|
프롬프트 설계자는 중립 따옴표를 타이포그래피 따옴표로 변환할지 선택할 수 있습니다. 그대로 두어도 괜찮습니다. |
||||
|
|
||||
|
예를 들어 `docs/de/llm-prompt.md`의 `### Quotes` 섹션을 참고하세요. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
## 코드 스니펫의 따옴표 { #quotes-in-code-snippets } |
||||
|
|
||||
|
//// tab | 테스트 |
||||
|
|
||||
|
`pip install "foo[bar]"` |
||||
|
|
||||
|
코드 스니펫에서 문자열 리터럴의 예: `"this"`, `'that'`. |
||||
|
|
||||
|
코드 스니펫에서 문자열 리터럴의 어려운 예: `f"I like {'oranges' if orange else "apples"}"` |
||||
|
|
||||
|
하드코어: `Yesterday, my friend wrote: "If you spell incorrectly correctly, you have spelled it incorrectly". To which I answered: "Correct, but 'incorrectly' is incorrectly not '"incorrectly"'"` |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
//// tab | 정보 |
||||
|
|
||||
|
... 하지만 코드 스니펫 안의 따옴표는 그대로 유지되어야 합니다. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
## 코드 블록 { #code-blocks } |
||||
|
|
||||
|
//// tab | 테스트 |
||||
|
|
||||
|
Bash 코드 예시... |
||||
|
|
||||
|
```bash |
||||
|
# 우주에 인사말 출력 |
||||
|
echo "Hello universe" |
||||
|
``` |
||||
|
|
||||
|
...그리고 콘솔 코드 예시... |
||||
|
|
||||
|
```console |
||||
|
$ <font color="#4E9A06">fastapi</font> run <u style="text-decoration-style:solid">main.py</u> |
||||
|
<span style="background-color:#009485"><font color="#D3D7CF"> FastAPI </font></span> Starting server |
||||
|
Searching for package file structure |
||||
|
``` |
||||
|
|
||||
|
...그리고 또 다른 콘솔 코드 예시... |
||||
|
|
||||
|
```console |
||||
|
// "Code" 디렉터리 생성 |
||||
|
$ mkdir code |
||||
|
// 해당 디렉터리로 이동 |
||||
|
$ cd code |
||||
|
``` |
||||
|
|
||||
|
...그리고 Python 코드 예시... |
||||
|
|
||||
|
```Python |
||||
|
wont_work() # 이건 동작하지 않습니다 😱 |
||||
|
works(foo="bar") # 이건 동작합니다 🎉 |
||||
|
``` |
||||
|
|
||||
|
...이상입니다. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
//// tab | 정보 |
||||
|
|
||||
|
코드 블록의 코드는(주석을 제외하고) 수정하면 안 됩니다. |
||||
|
|
||||
|
`scripts/translate.py`의 일반 프롬프트에서 `### Content of code blocks` 섹션을 참고하세요. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
## 탭과 색상 박스 { #tabs-and-colored-boxes } |
||||
|
|
||||
|
//// tab | 테스트 |
||||
|
|
||||
|
/// info | 정보 |
||||
|
일부 텍스트 |
||||
|
/// |
||||
|
|
||||
|
/// note | 참고 |
||||
|
일부 텍스트 |
||||
|
/// |
||||
|
|
||||
|
/// note Technical details | 기술 세부사항 |
||||
|
일부 텍스트 |
||||
|
/// |
||||
|
|
||||
|
/// check | 확인 |
||||
|
일부 텍스트 |
||||
|
/// |
||||
|
|
||||
|
/// tip | 팁 |
||||
|
일부 텍스트 |
||||
|
/// |
||||
|
|
||||
|
/// warning | 경고 |
||||
|
일부 텍스트 |
||||
|
/// |
||||
|
|
||||
|
/// danger | 위험 |
||||
|
일부 텍스트 |
||||
|
/// |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
//// tab | 정보 |
||||
|
|
||||
|
탭과 `Info`/`Note`/`Warning`/등의 블록은 제목 번역을 수직 막대(`|`) 뒤에 추가해야 합니다. |
||||
|
|
||||
|
`scripts/translate.py`의 일반 프롬프트에서 `### Special blocks`와 `### Tab blocks` 섹션을 참고하세요. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
## 웹 및 내부 링크 { #web-and-internal-links } |
||||
|
|
||||
|
//// tab | 테스트 |
||||
|
|
||||
|
링크 텍스트는 번역되어야 하고, 링크 주소는 변경되지 않아야 합니다: |
||||
|
|
||||
|
* [위의 제목으로 가는 링크](#code-snippets) |
||||
|
* [내부 링크](index.md#installation){.internal-link target=_blank} |
||||
|
* <a href="https://sqlmodel.tiangolo.com/" class="external-link" target="_blank">외부 링크</a> |
||||
|
* <a href="https://fastapi.tiangolo.com/css/styles.css" class="external-link" target="_blank">스타일로 가는 링크</a> |
||||
|
* <a href="https://fastapi.tiangolo.com/js/logic.js" class="external-link" target="_blank">스크립트로 가는 링크</a> |
||||
|
* <a href="https://fastapi.tiangolo.com/img/foo.jpg" class="external-link" target="_blank">이미지로 가는 링크</a> |
||||
|
|
||||
|
링크 텍스트는 번역되어야 하고, 링크 주소는 번역 페이지를 가리켜야 합니다: |
||||
|
|
||||
|
* <a href="https://fastapi.tiangolo.com/ko/" class="external-link" target="_blank">FastAPI 링크</a> |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
//// tab | 정보 |
||||
|
|
||||
|
링크는 번역되어야 하지만, 주소는 변경되지 않아야 합니다. 예외는 FastAPI 문서 페이지로 향하는 절대 링크이며, 이 경우 번역 페이지로 연결되어야 합니다. |
||||
|
|
||||
|
`scripts/translate.py`의 일반 프롬프트에서 `### Links` 섹션을 참고하세요. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
## HTML "abbr" 요소 { #html-abbr-elements } |
||||
|
|
||||
|
//// tab | 테스트 |
||||
|
|
||||
|
여기 HTML "abbr" 요소로 감싼 몇 가지가 있습니다(일부는 임의로 만든 것입니다): |
||||
|
|
||||
|
### abbr가 전체 문구를 제공 { #the-abbr-gives-a-full-phrase } |
||||
|
|
||||
|
* <abbr title="Getting Things Done - 일을 끝내는 방법론">GTD</abbr> |
||||
|
* <abbr title="less than - 보다 작음"><code>lt</code></abbr> |
||||
|
* <abbr title="XML Web Token - XML 웹 토큰">XWT</abbr> |
||||
|
* <abbr title="Parallel Server Gateway Interface - 병렬 서버 게이트웨이 인터페이스">PSGI</abbr> |
||||
|
|
||||
|
### abbr가 설명을 제공 { #the-abbr-gives-an-explanation } |
||||
|
|
||||
|
* <abbr title="어떤 방식으로든 서로 연결되고 함께 작동하도록 구성된 머신들의 집합입니다.">cluster</abbr> |
||||
|
* <abbr title="입력과 출력 계층 사이에 수많은 은닉 계층을 둔 인공 신경망을 사용하는 머신 러닝 방법으로, 이를 통해 포괄적인 내부 구조를 형성합니다">Deep Learning</abbr> |
||||
|
|
||||
|
### abbr가 전체 문구와 설명을 제공 { #the-abbr-gives-a-full-phrase-and-an-explanation } |
||||
|
|
||||
|
* <abbr title="Mozilla Developer Network - 모질라 개발자 네트워크: Firefox를 만드는 사람들이 작성한 개발자용 문서">MDN</abbr> |
||||
|
* <abbr title="Input/Output - 입력/출력: 디스크 읽기 또는 쓰기, 네트워크 통신.">I/O</abbr>. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
//// tab | 정보 |
||||
|
|
||||
|
"abbr" 요소의 "title" 속성은 몇 가지 구체적인 지침에 따라 번역됩니다. |
||||
|
|
||||
|
번역에서는(영어 단어를 설명하기 위해) 자체 "abbr" 요소를 추가할 수 있으며, LLM은 이를 제거하면 안 됩니다. |
||||
|
|
||||
|
`scripts/translate.py`의 일반 프롬프트에서 `### HTML abbr elements` 섹션을 참고하세요. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
## 제목 { #headings } |
||||
|
|
||||
|
//// tab | 테스트 |
||||
|
|
||||
|
### 웹앱 개발하기 - 튜토리얼 { #develop-a-webapp-a-tutorial } |
||||
|
|
||||
|
안녕하세요. |
||||
|
|
||||
|
### 타입 힌트와 -애너테이션 { #type-hints-and-annotations } |
||||
|
|
||||
|
다시 안녕하세요. |
||||
|
|
||||
|
### super- 및 subclasses { #super-and-subclasses } |
||||
|
|
||||
|
다시 안녕하세요. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
//// tab | 정보 |
||||
|
|
||||
|
제목에 대한 유일한 강한 규칙은, LLM이 중괄호 안의 해시 부분을 변경하지 않아 링크가 깨지지 않게 하는 것입니다. |
||||
|
|
||||
|
`scripts/translate.py`의 일반 프롬프트에서 `### Headings` 섹션을 참고하세요. |
||||
|
|
||||
|
언어별 지침은 예를 들어 `docs/de/llm-prompt.md`의 `### Headings` 섹션을 참고하세요. |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
## 문서에서 사용되는 용어 { #terms-used-in-the-docs } |
||||
|
|
||||
|
//// tab | 테스트 |
||||
|
|
||||
|
* 당신 |
||||
|
* 당신의 |
||||
|
|
||||
|
* 예: (e.g.) |
||||
|
* 등 (etc.) |
||||
|
|
||||
|
* `int`로서의 `foo` |
||||
|
* `str`로서의 `bar` |
||||
|
* `list`로서의 `baz` |
||||
|
|
||||
|
* 튜토리얼 - 사용자 가이드 |
||||
|
* 고급 사용자 가이드 |
||||
|
* SQLModel 문서 |
||||
|
* API 문서 |
||||
|
* 자동 문서 |
||||
|
|
||||
|
* Data Science |
||||
|
* Deep Learning |
||||
|
* Machine Learning |
||||
|
* Dependency Injection |
||||
|
* HTTP Basic authentication |
||||
|
* HTTP Digest |
||||
|
* ISO format |
||||
|
* JSON Schema 표준 |
||||
|
* JSON schema |
||||
|
* schema definition |
||||
|
* Password Flow |
||||
|
* Mobile |
||||
|
|
||||
|
* deprecated |
||||
|
* designed |
||||
|
* invalid |
||||
|
* on the fly |
||||
|
* standard |
||||
|
* default |
||||
|
* case-sensitive |
||||
|
* case-insensitive |
||||
|
|
||||
|
* 애플리케이션을 서빙하다 |
||||
|
* 페이지를 서빙하다 |
||||
|
|
||||
|
* 앱 |
||||
|
* 애플리케이션 |
||||
|
|
||||
|
* 요청 |
||||
|
* 응답 |
||||
|
* 오류 응답 |
||||
|
|
||||
|
* 경로 처리 |
||||
|
* 경로 처리 데코레이터 |
||||
|
* 경로 처리 함수 |
||||
|
|
||||
|
* body |
||||
|
* 요청 body |
||||
|
* 응답 body |
||||
|
* JSON body |
||||
|
* form body |
||||
|
* file body |
||||
|
* 함수 body |
||||
|
|
||||
|
* parameter |
||||
|
* body parameter |
||||
|
* path parameter |
||||
|
* query parameter |
||||
|
* cookie parameter |
||||
|
* header parameter |
||||
|
* form parameter |
||||
|
* function parameter |
||||
|
|
||||
|
* event |
||||
|
* startup event |
||||
|
* 서버 startup |
||||
|
* shutdown event |
||||
|
* lifespan event |
||||
|
|
||||
|
* handler |
||||
|
* event handler |
||||
|
* exception handler |
||||
|
* 처리하다 |
||||
|
|
||||
|
* model |
||||
|
* Pydantic model |
||||
|
* data model |
||||
|
* database model |
||||
|
* form model |
||||
|
* model object |
||||
|
|
||||
|
* class |
||||
|
* base class |
||||
|
* parent class |
||||
|
* subclass |
||||
|
* child class |
||||
|
* sibling class |
||||
|
* class method |
||||
|
|
||||
|
* header |
||||
|
* headers |
||||
|
* authorization header |
||||
|
* `Authorization` header |
||||
|
* forwarded header |
||||
|
|
||||
|
* dependency injection system |
||||
|
* dependency |
||||
|
* dependable |
||||
|
* dependant |
||||
|
|
||||
|
* I/O bound |
||||
|
* CPU bound |
||||
|
* concurrency |
||||
|
* parallelism |
||||
|
* multiprocessing |
||||
|
|
||||
|
* env var |
||||
|
* environment variable |
||||
|
* `PATH` |
||||
|
* `PATH` variable |
||||
|
|
||||
|
* authentication |
||||
|
* authentication provider |
||||
|
* authorization |
||||
|
* authorization form |
||||
|
* authorization provider |
||||
|
* 사용자가 인증한다 |
||||
|
* 시스템이 사용자를 인증한다 |
||||
|
|
||||
|
* CLI |
||||
|
* command line interface |
||||
|
|
||||
|
* server |
||||
|
* client |
||||
|
|
||||
|
* cloud provider |
||||
|
* cloud service |
||||
|
|
||||
|
* development |
||||
|
* development stages |
||||
|
|
||||
|
* dict |
||||
|
* dictionary |
||||
|
* enumeration |
||||
|
* enum |
||||
|
* enum member |
||||
|
|
||||
|
* encoder |
||||
|
* decoder |
||||
|
* encode하다 |
||||
|
* decode하다 |
||||
|
|
||||
|
* exception |
||||
|
* raise하다 |
||||
|
|
||||
|
* expression |
||||
|
* statement |
||||
|
|
||||
|
* frontend |
||||
|
* backend |
||||
|
|
||||
|
* GitHub discussion |
||||
|
* GitHub issue |
||||
|
|
||||
|
* performance |
||||
|
* performance optimization |
||||
|
|
||||
|
* return type |
||||
|
* return value |
||||
|
|
||||
|
* security |
||||
|
* security scheme |
||||
|
|
||||
|
* task |
||||
|
* background task |
||||
|
* task function |
||||
|
|
||||
|
* template |
||||
|
* template engine |
||||
|
|
||||
|
* type annotation |
||||
|
* type hint |
||||
|
|
||||
|
* server worker |
||||
|
* Uvicorn worker |
||||
|
* Gunicorn Worker |
||||
|
* worker process |
||||
|
* worker class |
||||
|
* workload |
||||
|
|
||||
|
* deployment |
||||
|
* deploy하다 |
||||
|
|
||||
|
* SDK |
||||
|
* software development kit |
||||
|
|
||||
|
* `APIRouter` |
||||
|
* `requirements.txt` |
||||
|
* Bearer Token |
||||
|
* breaking change |
||||
|
* bug |
||||
|
* button |
||||
|
* callable |
||||
|
* code |
||||
|
* commit |
||||
|
* context manager |
||||
|
* coroutine |
||||
|
* database session |
||||
|
* disk |
||||
|
* domain |
||||
|
* engine |
||||
|
* fake X |
||||
|
* HTTP GET method |
||||
|
* item |
||||
|
* library |
||||
|
* lifespan |
||||
|
* lock |
||||
|
* middleware |
||||
|
* mobile application |
||||
|
* module |
||||
|
* mounting |
||||
|
* network |
||||
|
* origin |
||||
|
* override |
||||
|
* payload |
||||
|
* processor |
||||
|
* property |
||||
|
* proxy |
||||
|
* pull request |
||||
|
* query |
||||
|
* RAM |
||||
|
* remote machine |
||||
|
* status code |
||||
|
* string |
||||
|
* tag |
||||
|
* web framework |
||||
|
* wildcard |
||||
|
* return하다 |
||||
|
* validate하다 |
||||
|
|
||||
|
//// |
||||
|
|
||||
|
//// tab | 정보 |
||||
|
|
||||
|
이것은 문서에서 보이는 (대부분) 기술 용어의 불완전하고 비규범적인 목록입니다. 프롬프트 설계자가 어떤 용어에 대해 LLM에 추가적인 도움이 필요한지 파악하는 데 유용할 수 있습니다. 예를 들어, 좋은 번역을 계속 덜 좋은 번역으로 되돌릴 때, 또는 언어에서 용어의 활용/변화를 처리하는 데 문제가 있을 때 도움이 됩니다. |
||||
|
|
||||
|
예를 들어 `docs/de/llm-prompt.md`의 `### List of English terms and their preferred German translations` 섹션을 참고하세요. |
||||
|
|
||||
|
//// |
||||
@ -1,3 +1,3 @@ |
|||||
# 소개 |
# 소개 { #about } |
||||
|
|
||||
FastAPI에 대한 디자인, 영감 등에 대해 🤓 |
FastAPI, 그 디자인, 영감 등에 대해 🤓 |
||||
|
|||||
@ -0,0 +1,247 @@ |
|||||
|
# OpenAPI에서 추가 응답 { #additional-responses-in-openapi } |
||||
|
|
||||
|
/// warning | 경고 |
||||
|
|
||||
|
이는 꽤 고급 주제입니다. |
||||
|
|
||||
|
**FastAPI**를 막 시작했다면, 이 내용이 필요 없을 수도 있습니다. |
||||
|
|
||||
|
/// |
||||
|
|
||||
|
추가 상태 코드, 미디어 타입, 설명 등을 포함한 추가 응답을 선언할 수 있습니다. |
||||
|
|
||||
|
이러한 추가 응답은 OpenAPI 스키마에 포함되므로 API 문서에도 표시됩니다. |
||||
|
|
||||
|
하지만 이러한 추가 응답의 경우, 상태 코드와 콘텐츠를 포함하여 `JSONResponse` 같은 `Response`를 직접 반환하도록 반드시 처리해야 합니다. |
||||
|
|
||||
|
## `model`을 사용한 추가 응답 { #additional-response-with-model } |
||||
|
|
||||
|
*경로 처리 데코레이터*에 `responses` 파라미터를 전달할 수 있습니다. |
||||
|
|
||||
|
이는 `dict`를 받습니다. 키는 각 응답의 상태 코드(예: `200`)이고, 값은 각 응답에 대한 정보를 담은 다른 `dict`입니다. |
||||
|
|
||||
|
각 응답 `dict`에는 `response_model`처럼 Pydantic 모델을 담는 `model` 키가 있을 수 있습니다. |
||||
|
|
||||
|
**FastAPI**는 그 모델을 사용해 JSON Schema를 생성하고, OpenAPI의 올바른 위치에 포함합니다. |
||||
|
|
||||
|
예를 들어, 상태 코드 `404`와 Pydantic 모델 `Message`를 사용하는 다른 응답을 선언하려면 다음과 같이 작성할 수 있습니다: |
||||
|
|
||||
|
{* ../../docs_src/additional_responses/tutorial001_py39.py hl[18,22] *} |
||||
|
|
||||
|
/// note | 참고 |
||||
|
|
||||
|
`JSONResponse`를 직접 반환해야 한다는 점을 기억하세요. |
||||
|
|
||||
|
/// |
||||
|
|
||||
|
/// info | 정보 |
||||
|
|
||||
|
`model` 키는 OpenAPI의 일부가 아닙니다. |
||||
|
|
||||
|
**FastAPI**는 여기에서 Pydantic 모델을 가져와 JSON Schema를 생성하고 올바른 위치에 넣습니다. |
||||
|
|
||||
|
올바른 위치는 다음과 같습니다: |
||||
|
|
||||
|
* 값으로 또 다른 JSON 객체(`dict`)를 가지는 `content` 키 안에: |
||||
|
* 미디어 타입(예: `application/json`)을 키로 가지며, 값으로 또 다른 JSON 객체를 포함하고: |
||||
|
* `schema` 키가 있고, 그 값이 모델에서 생성된 JSON Schema입니다. 이것이 올바른 위치입니다. |
||||
|
* **FastAPI**는 이를 직접 포함하는 대신, OpenAPI의 다른 위치에 있는 전역 JSON Schemas를 참조하도록 여기에서 reference를 추가합니다. 이렇게 하면 다른 애플리케이션과 클라이언트가 그 JSON Schema를 직접 사용할 수 있고, 더 나은 코드 생성 도구 등을 제공할 수 있습니다. |
||||
|
|
||||
|
/// |
||||
|
|
||||
|
이 *경로 처리*에 대해 OpenAPI에 생성되는 응답은 다음과 같습니다: |
||||
|
|
||||
|
```JSON hl_lines="3-12" |
||||
|
{ |
||||
|
"responses": { |
||||
|
"404": { |
||||
|
"description": "Additional Response", |
||||
|
"content": { |
||||
|
"application/json": { |
||||
|
"schema": { |
||||
|
"$ref": "#/components/schemas/Message" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"200": { |
||||
|
"description": "Successful Response", |
||||
|
"content": { |
||||
|
"application/json": { |
||||
|
"schema": { |
||||
|
"$ref": "#/components/schemas/Item" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"422": { |
||||
|
"description": "Validation Error", |
||||
|
"content": { |
||||
|
"application/json": { |
||||
|
"schema": { |
||||
|
"$ref": "#/components/schemas/HTTPValidationError" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
스키마는 OpenAPI 스키마 내부의 다른 위치를 참조합니다: |
||||
|
|
||||
|
```JSON hl_lines="4-16" |
||||
|
{ |
||||
|
"components": { |
||||
|
"schemas": { |
||||
|
"Message": { |
||||
|
"title": "Message", |
||||
|
"required": [ |
||||
|
"message" |
||||
|
], |
||||
|
"type": "object", |
||||
|
"properties": { |
||||
|
"message": { |
||||
|
"title": "Message", |
||||
|
"type": "string" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"Item": { |
||||
|
"title": "Item", |
||||
|
"required": [ |
||||
|
"id", |
||||
|
"value" |
||||
|
], |
||||
|
"type": "object", |
||||
|
"properties": { |
||||
|
"id": { |
||||
|
"title": "Id", |
||||
|
"type": "string" |
||||
|
}, |
||||
|
"value": { |
||||
|
"title": "Value", |
||||
|
"type": "string" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"ValidationError": { |
||||
|
"title": "ValidationError", |
||||
|
"required": [ |
||||
|
"loc", |
||||
|
"msg", |
||||
|
"type" |
||||
|
], |
||||
|
"type": "object", |
||||
|
"properties": { |
||||
|
"loc": { |
||||
|
"title": "Location", |
||||
|
"type": "array", |
||||
|
"items": { |
||||
|
"type": "string" |
||||
|
} |
||||
|
}, |
||||
|
"msg": { |
||||
|
"title": "Message", |
||||
|
"type": "string" |
||||
|
}, |
||||
|
"type": { |
||||
|
"title": "Error Type", |
||||
|
"type": "string" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
"HTTPValidationError": { |
||||
|
"title": "HTTPValidationError", |
||||
|
"type": "object", |
||||
|
"properties": { |
||||
|
"detail": { |
||||
|
"title": "Detail", |
||||
|
"type": "array", |
||||
|
"items": { |
||||
|
"$ref": "#/components/schemas/ValidationError" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 주요 응답에 대한 추가 미디어 타입 { #additional-media-types-for-the-main-response } |
||||
|
|
||||
|
같은 `responses` 파라미터를 사용해 동일한 주요 응답에 대해 다른 미디어 타입을 추가할 수도 있습니다. |
||||
|
|
||||
|
예를 들어, *경로 처리*가 JSON 객체(미디어 타입 `application/json`) 또는 PNG 이미지(미디어 타입 `image/png`)를 반환할 수 있다고 선언하기 위해 `image/png`라는 추가 미디어 타입을 추가할 수 있습니다: |
||||
|
|
||||
|
{* ../../docs_src/additional_responses/tutorial002_py310.py hl[17:22,26] *} |
||||
|
|
||||
|
/// note | 참고 |
||||
|
|
||||
|
이미지는 `FileResponse`를 사용해 직접 반환해야 한다는 점에 유의하세요. |
||||
|
|
||||
|
/// |
||||
|
|
||||
|
/// info | 정보 |
||||
|
|
||||
|
`responses` 파라미터에서 다른 미디어 타입을 명시적으로 지정하지 않는 한, FastAPI는 응답이 주요 응답 클래스와 동일한 미디어 타입(기본값 `application/json`)을 가진다고 가정합니다. |
||||
|
|
||||
|
하지만 커스텀 응답 클래스를 지정하면서 미디어 타입을 `None`으로 설정했다면, FastAPI는 연결된 모델이 있는 모든 추가 응답에 대해 `application/json`을 사용합니다. |
||||
|
|
||||
|
/// |
||||
|
|
||||
|
## 정보 결합하기 { #combining-information } |
||||
|
|
||||
|
`response_model`, `status_code`, `responses` 파라미터를 포함해 여러 위치의 응답 정보를 결합할 수도 있습니다. |
||||
|
|
||||
|
기본 상태 코드 `200`(또는 필요하다면 커스텀 코드)을 사용하여 `response_model`을 선언하고, 그와 동일한 응답에 대한 추가 정보를 `responses`에서 OpenAPI 스키마에 직접 선언할 수 있습니다. |
||||
|
|
||||
|
**FastAPI**는 `responses`의 추가 정보를 유지하고, 모델의 JSON Schema와 결합합니다. |
||||
|
|
||||
|
예를 들어, Pydantic 모델을 사용하고 커스텀 `description`을 가진 상태 코드 `404` 응답을 선언할 수 있습니다. |
||||
|
|
||||
|
또한 `response_model`을 사용하는 상태 코드 `200` 응답을 선언하되, 커스텀 `example`을 포함할 수도 있습니다: |
||||
|
|
||||
|
{* ../../docs_src/additional_responses/tutorial003_py39.py hl[20:31] *} |
||||
|
|
||||
|
이 모든 내용은 OpenAPI에 결합되어 포함되고, API 문서에 표시됩니다: |
||||
|
|
||||
|
<img src="/img/tutorial/additional-responses/image01.png"> |
||||
|
|
||||
|
## 미리 정의된 응답과 커스텀 응답 결합하기 { #combine-predefined-responses-and-custom-ones } |
||||
|
|
||||
|
여러 *경로 처리*에 적용되는 미리 정의된 응답이 필요할 수도 있지만, 각 *경로 처리*마다 필요한 커스텀 응답과 결합하고 싶을 수도 있습니다. |
||||
|
|
||||
|
그런 경우 Python의 `dict` “unpacking” 기법인 `**dict_to_unpack`을 사용할 수 있습니다: |
||||
|
|
||||
|
```Python |
||||
|
old_dict = { |
||||
|
"old key": "old value", |
||||
|
"second old key": "second old value", |
||||
|
} |
||||
|
new_dict = {**old_dict, "new key": "new value"} |
||||
|
``` |
||||
|
|
||||
|
여기서 `new_dict`는 `old_dict`의 모든 키-값 쌍에 더해 새 키-값 쌍까지 포함합니다: |
||||
|
|
||||
|
```Python |
||||
|
{ |
||||
|
"old key": "old value", |
||||
|
"second old key": "second old value", |
||||
|
"new key": "new value", |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
이 기법을 사용해 *경로 처리*에서 일부 미리 정의된 응답을 재사용하고, 추가 커스텀 응답과 결합할 수 있습니다. |
||||
|
|
||||
|
예를 들어: |
||||
|
|
||||
|
{* ../../docs_src/additional_responses/tutorial004_py310.py hl[11:15,24] *} |
||||
|
|
||||
|
## OpenAPI 응답에 대한 추가 정보 { #more-information-about-openapi-responses } |
||||
|
|
||||
|
응답에 정확히 무엇을 포함할 수 있는지 보려면, OpenAPI 사양의 다음 섹션을 확인하세요: |
||||
|
|
||||
|
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#responses-object" class="external-link" target="_blank">OpenAPI Responses Object</a>: `Response Object`를 포함합니다. |
||||
|
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#response-object" class="external-link" target="_blank">OpenAPI Response Object</a>: `responses` 파라미터 안의 각 응답에 이것의 어떤 항목이든 직접 포함할 수 있습니다. `description`, `headers`, `content`(여기에서 서로 다른 미디어 타입과 JSON Schema를 선언합니다), `links` 등을 포함할 수 있습니다. |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue