mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-25 23:29:34 -05:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32be95dd86 | ||
|
|
92b67b1b29 | ||
|
|
e0a9692261 | ||
|
|
62f82296f3 | ||
|
|
f49da74200 | ||
|
|
13ce009e9a | ||
|
|
41fcbc7d00 | ||
|
|
bec2ec7e4c | ||
|
|
7b55bf37b5 | ||
|
|
285ac017a9 | ||
|
|
d1293b8786 | ||
|
|
1d41a7d2df | ||
|
|
8045f34c52 | ||
|
|
b254688f37 | ||
|
|
026af6e248 | ||
|
|
38929aae1b | ||
|
|
550092a3bd | ||
|
|
5c054fdd65 | ||
|
|
943159afb0 | ||
|
|
91dad1cb3a | ||
|
|
1551913223 | ||
|
|
e00d29e784 | ||
|
|
ce1fb1a23b | ||
|
|
25c692d77d | ||
|
|
2f686ce1e5 | ||
|
|
14442d356f | ||
|
|
11f95ddef6 | ||
|
|
fb165a55f0 | ||
|
|
1aedc6e29d |
4
.github/dependabot.yml
vendored
4
.github/dependabot.yml
vendored
@@ -12,9 +12,5 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "monthly"
|
||||
groups:
|
||||
python-packages:
|
||||
patterns:
|
||||
- "*"
|
||||
commit-message:
|
||||
prefix: ⬆
|
||||
|
||||
15
.github/workflows/publish.yml
vendored
15
.github/workflows/publish.yml
vendored
@@ -8,6 +8,12 @@ on:
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
package:
|
||||
- fastapi
|
||||
permissions:
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
@@ -21,19 +27,14 @@ jobs:
|
||||
# Issue ref: https://github.com/actions/setup-python/issues/436
|
||||
# cache: "pip"
|
||||
# cache-dependency-path: pyproject.toml
|
||||
- uses: actions/cache@v4
|
||||
id: cache
|
||||
with:
|
||||
path: ${{ env.pythonLocation }}
|
||||
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish
|
||||
- name: Install build dependencies
|
||||
run: pip install build
|
||||
- name: Build distribution
|
||||
env:
|
||||
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
|
||||
run: python -m build
|
||||
- name: Publish
|
||||
uses: pypa/gh-action-pypi-publish@v1.8.14
|
||||
with:
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
---
|
||||
|
||||
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.8+ based on standard Python type hints.
|
||||
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python based on standard Python type hints.
|
||||
|
||||
The key features are:
|
||||
|
||||
@@ -122,8 +122,6 @@ If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be
|
||||
|
||||
## Requirements
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI stands on the shoulders of giants:
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> for the web parts.
|
||||
@@ -338,7 +336,7 @@ You do that with standard modern Python types.
|
||||
|
||||
You don't have to learn a new syntax, the methods or classes of a specific library, etc.
|
||||
|
||||
Just standard **Python 3.8+**.
|
||||
Just standard **Python**.
|
||||
|
||||
For example, for an `int`:
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
---
|
||||
|
||||
FastAPI Python 3.8+ ilə API yaratmaq üçün standart Python <abbr title="Tip Məsləhətləri: Type Hints">tip məsləhətlərinə</abbr> əsaslanan, müasir, sürətli (yüksək performanslı) framework-dür.
|
||||
FastAPI Python ilə API yaratmaq üçün standart Python <abbr title="Tip Məsləhətləri: Type Hints">tip məsləhətlərinə</abbr> əsaslanan, müasir, sürətli (yüksək performanslı) framework-dür.
|
||||
|
||||
Əsas xüsusiyyətləri bunlardır:
|
||||
|
||||
@@ -115,8 +115,6 @@ FastAPI Python 3.8+ ilə API yaratmaq üçün standart Python <abbr title="Tip M
|
||||
|
||||
## Tələblər
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI nəhənglərin çiyinlərində dayanır:
|
||||
|
||||
* Web tərəfi üçün <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a>.
|
||||
@@ -330,7 +328,7 @@ Bunu standart müasir Python tipləri ilə edirsiniz.
|
||||
|
||||
Yeni sintaksis, müəyyən bir kitabxananın metodlarını və ya siniflərini və s. öyrənmək məcburiyyətində deyilsiniz.
|
||||
|
||||
Sadəcə standart **Python 3.8+**.
|
||||
Sadəcə standart **Python**.
|
||||
|
||||
Məsələn, `int` üçün:
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI ist ein modernes, schnelles (hoch performantes) Webframework zur Erstellung von APIs mit Python 3.8+ auf Basis von Standard-Python-Typhinweisen.
|
||||
FastAPI ist ein modernes, schnelles (hoch performantes) Webframework zur Erstellung von APIs mit Python auf Basis von Standard-Python-Typhinweisen.
|
||||
|
||||
Seine Schlüssel-Merkmale sind:
|
||||
|
||||
@@ -125,8 +125,6 @@ Wenn Sie eine <abbr title="Command Line Interface – Kommandozeilen-Schnittstel
|
||||
|
||||
## Anforderungen
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI steht auf den Schultern von Giganten:
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> für die Webanteile.
|
||||
@@ -340,7 +338,7 @@ Das machen Sie mit modernen Standard-Python-Typen.
|
||||
|
||||
Sie müssen keine neue Syntax, Methoden oder Klassen einer bestimmten Bibliothek usw. lernen.
|
||||
|
||||
Nur Standard-**Python 3.8+**.
|
||||
Nur Standard-**Python+**.
|
||||
|
||||
Zum Beispiel für ein `int`:
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.8+ based on standard Python type hints.
|
||||
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python based on standard Python type hints.
|
||||
|
||||
The key features are:
|
||||
|
||||
@@ -124,8 +124,6 @@ If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be
|
||||
|
||||
## Requirements
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI stands on the shoulders of giants:
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> for the web parts.
|
||||
@@ -340,7 +338,7 @@ You do that with standard modern Python types.
|
||||
|
||||
You don't have to learn a new syntax, the methods or classes of a specific library, etc.
|
||||
|
||||
Just standard **Python 3.8+**.
|
||||
Just standard **Python**.
|
||||
|
||||
For example, for an `int`:
|
||||
|
||||
|
||||
@@ -5,8 +5,32 @@ hide:
|
||||
|
||||
# Release Notes
|
||||
|
||||
## 0.110.3
|
||||
|
||||
## Latest Changes
|
||||
|
||||
### Docs
|
||||
|
||||
* 📝 Update references to Python version, FastAPI supports all the current versions, no need to make the version explicit. PR [#11496](https://github.com/tiangolo/fastapi/pull/11496) by [@tiangolo](https://github.com/tiangolo).
|
||||
* ✏️ Fix typo in `fastapi/security/api_key.py`. PR [#11481](https://github.com/tiangolo/fastapi/pull/11481) by [@ch33zer](https://github.com/ch33zer).
|
||||
* ✏️ Fix typo in `security/http.py`. PR [#11455](https://github.com/tiangolo/fastapi/pull/11455) by [@omarmoo5](https://github.com/omarmoo5).
|
||||
|
||||
### Translations
|
||||
|
||||
* 🌐 Add Traditional Chinese translation for `docs/zh-hant/benchmarks.md`. PR [#11484](https://github.com/tiangolo/fastapi/pull/11484) by [@KNChiu](https://github.com/KNChiu).
|
||||
* 🌐 Update Chinese translation for `docs/zh/docs/fastapi-people.md`. PR [#11476](https://github.com/tiangolo/fastapi/pull/11476) by [@billzhong](https://github.com/billzhong).
|
||||
* 🌐 Add Chinese translation for `docs/zh/docs/how-to/index.md` and `docs/zh/docs/how-to/general.md`. PR [#11443](https://github.com/tiangolo/fastapi/pull/11443) by [@billzhong](https://github.com/billzhong).
|
||||
* 🌐 Add Spanish translation for cookie-params `docs/es/docs/tutorial/cookie-params.md`. PR [#11410](https://github.com/tiangolo/fastapi/pull/11410) by [@fabianfalon](https://github.com/fabianfalon).
|
||||
|
||||
### Internal
|
||||
|
||||
* ⬆ Bump mkdocstrings[python] from 0.23.0 to 0.24.3. PR [#11469](https://github.com/tiangolo/fastapi/pull/11469) by [@dependabot[bot]](https://github.com/apps/dependabot).
|
||||
* 🔨 Update internal scripts and remove unused ones. PR [#11499](https://github.com/tiangolo/fastapi/pull/11499) by [@tiangolo](https://github.com/tiangolo).
|
||||
* 🔧 Migrate from Hatch to PDM for the internal build. PR [#11498](https://github.com/tiangolo/fastapi/pull/11498) by [@tiangolo](https://github.com/tiangolo).
|
||||
* ⬆️ Upgrade MkDocs Material and re-enable cards. PR [#11466](https://github.com/tiangolo/fastapi/pull/11466) by [@tiangolo](https://github.com/tiangolo).
|
||||
* ⬆ Bump pillow from 10.2.0 to 10.3.0. PR [#11403](https://github.com/tiangolo/fastapi/pull/11403) by [@dependabot[bot]](https://github.com/apps/dependabot).
|
||||
* 🔧 Ungroup dependabot updates. PR [#11465](https://github.com/tiangolo/fastapi/pull/11465) by [@tiangolo](https://github.com/tiangolo).
|
||||
|
||||
## 0.110.2
|
||||
|
||||
### Fixes
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
plugins:
|
||||
# TODO: Re-enable once this is fixed: https://github.com/squidfunk/mkdocs-material/issues/6983
|
||||
# social:
|
||||
# cards_layout_dir: ../en/layouts
|
||||
# cards_layout: custom
|
||||
# cards_layout_options:
|
||||
# logo: ../en/docs/img/icon-white.svg
|
||||
social:
|
||||
cards_layout_dir: ../en/layouts
|
||||
cards_layout: custom
|
||||
cards_layout_options:
|
||||
logo: ../en/docs/img/icon-white.svg
|
||||
typeset:
|
||||
|
||||
@@ -32,7 +32,7 @@ hide:
|
||||
**Código Fuente**: <a href="https://github.com/tiangolo/fastapi" target="_blank">https://github.com/tiangolo/fastapi</a>
|
||||
|
||||
---
|
||||
FastAPI es un web framework moderno y rápido (de alto rendimiento) para construir APIs con Python 3.8+ basado en las anotaciones de tipos estándar de Python.
|
||||
FastAPI es un web framework moderno y rápido (de alto rendimiento) para construir APIs con Python basado en las anotaciones de tipos estándar de Python.
|
||||
|
||||
Sus características principales son:
|
||||
|
||||
@@ -115,8 +115,6 @@ Si estás construyendo un app de <abbr title="Interfaz de línea de comandos en
|
||||
|
||||
## Requisitos
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI está sobre los hombros de gigantes:
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> para las partes web.
|
||||
@@ -328,7 +326,7 @@ Lo haces con tipos modernos estándar de Python.
|
||||
|
||||
No tienes que aprender una sintaxis nueva, los métodos o clases de una library específica, etc.
|
||||
|
||||
Solo **Python 3.8+** estándar.
|
||||
Solo **Python** estándar.
|
||||
|
||||
Por ejemplo, para un `int`:
|
||||
|
||||
|
||||
97
docs/es/docs/tutorial/cookie-params.md
Normal file
97
docs/es/docs/tutorial/cookie-params.md
Normal file
@@ -0,0 +1,97 @@
|
||||
# Parámetros de Cookie
|
||||
|
||||
Puedes definir parámetros de Cookie de la misma manera que defines parámetros de `Query` y `Path`.
|
||||
|
||||
## Importar `Cookie`
|
||||
|
||||
Primero importa `Cookie`:
|
||||
|
||||
=== "Python 3.10+"
|
||||
|
||||
```Python hl_lines="3"
|
||||
{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
|
||||
```
|
||||
|
||||
=== "Python 3.9+"
|
||||
|
||||
```Python hl_lines="3"
|
||||
{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
|
||||
```
|
||||
|
||||
=== "Python 3.8+"
|
||||
|
||||
```Python hl_lines="3"
|
||||
{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
|
||||
```
|
||||
|
||||
=== "Python 3.10+ non-Annotated"
|
||||
|
||||
!!! tip
|
||||
Prefer to use the `Annotated` version if possible.
|
||||
|
||||
```Python hl_lines="1"
|
||||
{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
|
||||
```
|
||||
|
||||
=== "Python 3.8+ non-Annotated"
|
||||
|
||||
!!! tip
|
||||
Prefer to use the `Annotated` version if possible.
|
||||
|
||||
```Python hl_lines="3"
|
||||
{!> ../../../docs_src/cookie_params/tutorial001.py!}
|
||||
```
|
||||
|
||||
## Declarar parámetros de `Cookie`
|
||||
|
||||
Luego declara los parámetros de cookie usando la misma estructura que con `Path` y `Query`.
|
||||
|
||||
El primer valor es el valor por defecto, puedes pasar todos los parámetros adicionales de validación o anotación:
|
||||
|
||||
=== "Python 3.10+"
|
||||
|
||||
```Python hl_lines="9"
|
||||
{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
|
||||
```
|
||||
|
||||
=== "Python 3.9+"
|
||||
|
||||
```Python hl_lines="9"
|
||||
{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
|
||||
```
|
||||
|
||||
=== "Python 3.8+"
|
||||
|
||||
```Python hl_lines="10"
|
||||
{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
|
||||
```
|
||||
|
||||
=== "Python 3.10+ non-Annotated"
|
||||
|
||||
!!! tip
|
||||
Prefer to use the `Annotated` version if possible.
|
||||
|
||||
```Python hl_lines="7"
|
||||
{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
|
||||
```
|
||||
|
||||
=== "Python 3.8+ non-Annotated"
|
||||
|
||||
!!! tip
|
||||
Prefer to use the `Annotated` version if possible.
|
||||
|
||||
```Python hl_lines="9"
|
||||
{!> ../../../docs_src/cookie_params/tutorial001.py!}
|
||||
```
|
||||
|
||||
!!! note "Detalles Técnicos"
|
||||
`Cookie` es una clase "hermana" de `Path` y `Query`. También hereda de la misma clase común `Param`.
|
||||
|
||||
Pero recuerda que cuando importas `Query`, `Path`, `Cookie` y otros de `fastapi`, en realidad son funciones que devuelven clases especiales.
|
||||
|
||||
!!! info
|
||||
Para declarar cookies, necesitas usar `Cookie`, porque de lo contrario los parámetros serían interpretados como parámetros de query.
|
||||
|
||||
## Resumen
|
||||
|
||||
Declara cookies con `Cookie`, usando el mismo patrón común que `Query` y `Path`.
|
||||
@@ -36,7 +36,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI est un framework web moderne et rapide (haute performance) pour la création d'API avec Python 3.8+, basé sur les annotations de type standard de Python.
|
||||
FastAPI est un framework web moderne et rapide (haute performance) pour la création d'API avec Python, basé sur les annotations de type standard de Python.
|
||||
|
||||
Les principales fonctionnalités sont :
|
||||
|
||||
@@ -124,8 +124,6 @@ Si vous souhaitez construire une application <abbr title="Command Line Interface
|
||||
|
||||
## Prérequis
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI repose sur les épaules de géants :
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> pour les parties web.
|
||||
@@ -340,7 +338,7 @@ Vous faites cela avec les types Python standard modernes.
|
||||
|
||||
Vous n'avez pas à apprendre une nouvelle syntaxe, les méthodes ou les classes d'une bibliothèque spécifique, etc.
|
||||
|
||||
Juste du **Python 3.8+** standard.
|
||||
Juste du **Python** standard.
|
||||
|
||||
Par exemple, pour un `int`:
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
**Forrás kód**: <a href="https://github.com/tiangolo/fastapi" target="_blank">https://github.com/tiangolo/fastapi</a>
|
||||
|
||||
---
|
||||
A FastAPI egy modern, gyors (nagy teljesítményű), webes keretrendszer API-ok építéséhez Python 3.8+-al, a Python szabványos típusjelöléseire építve.
|
||||
A FastAPI egy modern, gyors (nagy teljesítményű), webes keretrendszer API-ok építéséhez Python -al, a Python szabványos típusjelöléseire építve.
|
||||
|
||||
|
||||
Kulcs funkciók:
|
||||
@@ -115,8 +115,6 @@ Ha egy olyan CLI alkalmazást fejlesztesz amit a parancssorban kell használni w
|
||||
|
||||
## Követelmények
|
||||
|
||||
Python 3.8+
|
||||
|
||||
A FastAPI óriások vállán áll:
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> a webes részekhez.
|
||||
@@ -331,7 +329,7 @@ Ezt standard modern Python típusokkal csinálod.
|
||||
|
||||
Nem kell új szintaxist, vagy specifikus könyvtár mert metódósait, stb. megtanulnod.
|
||||
|
||||
Csak standard **Python 3.8+**.
|
||||
Csak standard **Python**.
|
||||
|
||||
Például egy `int`-nek:
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI は、Pythonの標準である型ヒントに基づいてPython 3.8 以降でAPI を構築するための、モダンで、高速(高パフォーマンス)な、Web フレームワークです。
|
||||
FastAPI は、Pythonの標準である型ヒントに基づいてPython 以降でAPI を構築するための、モダンで、高速(高パフォーマンス)な、Web フレームワークです。
|
||||
|
||||
主な特徴:
|
||||
|
||||
@@ -116,8 +116,6 @@ FastAPI は、Pythonの標準である型ヒントに基づいてPython 3.8 以
|
||||
|
||||
## 必要条件
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI は巨人の肩の上に立っています。
|
||||
|
||||
- Web の部分は<a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a>
|
||||
|
||||
@@ -33,7 +33,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI는 현대적이고, 빠르며(고성능), 파이썬 표준 타입 힌트에 기초한 Python3.8+의 API를 빌드하기 위한 웹 프레임워크입니다.
|
||||
FastAPI는 현대적이고, 빠르며(고성능), 파이썬 표준 타입 힌트에 기초한 Python의 API를 빌드하기 위한 웹 프레임워크입니다.
|
||||
|
||||
주요 특징으로:
|
||||
|
||||
@@ -116,8 +116,6 @@ FastAPI는 현대적이고, 빠르며(고성능), 파이썬 표준 타입 힌트
|
||||
|
||||
## 요구사항
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI는 거인들의 어깨 위에 서 있습니다:
|
||||
|
||||
* 웹 부분을 위한 <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a>.
|
||||
@@ -332,7 +330,7 @@ def update_item(item_id: int, item: Item):
|
||||
|
||||
새로운 문법, 특정 라이브러리의 메소드나 클래스 등을 배울 필요가 없습니다.
|
||||
|
||||
그저 표준 **Python 3.8+** 입니다.
|
||||
그저 표준 **Python** 입니다.
|
||||
|
||||
예를 들어, `int`에 대해선:
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI to nowoczesny, wydajny framework webowy do budowania API z użyciem Pythona 3.8+ bazujący na standardowym typowaniu Pythona.
|
||||
FastAPI to nowoczesny, wydajny framework webowy do budowania API z użyciem Pythona bazujący na standardowym typowaniu Pythona.
|
||||
|
||||
Kluczowe cechy:
|
||||
|
||||
@@ -115,8 +115,6 @@ Jeżeli tworzysz aplikacje <abbr title="aplikacja z interfejsem konsolowym">CLI<
|
||||
|
||||
## Wymagania
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI oparty jest na:
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> dla części webowej.
|
||||
@@ -330,7 +328,7 @@ Robisz to tak samo jak ze standardowymi typami w Pythonie.
|
||||
|
||||
Nie musisz sie uczyć żadnej nowej składni, metod lub klas ze specyficznych bibliotek itp.
|
||||
|
||||
Po prostu standardowy **Python 3.8+**.
|
||||
Po prostu standardowy **Python**.
|
||||
|
||||
Na przykład, dla danych typu `int`:
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI é um moderno e rápido (alta performance) _framework web_ para construção de APIs com Python 3.8 ou superior, baseado nos _type hints_ padrões do Python.
|
||||
FastAPI é um moderno e rápido (alta performance) _framework web_ para construção de APIs com Python, baseado nos _type hints_ padrões do Python.
|
||||
|
||||
Os recursos chave são:
|
||||
|
||||
@@ -109,8 +109,6 @@ Se você estiver construindo uma aplicação <abbr title="Command Line Interface
|
||||
|
||||
## Requisitos
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI está nos ombros de gigantes:
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> para as partes web.
|
||||
@@ -325,7 +323,7 @@ Você faz com tipos padrão do Python moderno.
|
||||
|
||||
Você não terá que aprender uma nova sintaxe, métodos ou classes de uma biblioteca específica etc.
|
||||
|
||||
Apenas **Python 3.8+** padrão.
|
||||
Apenas **Python** padrão.
|
||||
|
||||
Por exemplo, para um `int`:
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI — это современный, быстрый (высокопроизводительный) веб-фреймворк для создания API используя Python 3.8+, в основе которого лежит стандартная аннотация типов Python.
|
||||
FastAPI — это современный, быстрый (высокопроизводительный) веб-фреймворк для создания API используя Python, в основе которого лежит стандартная аннотация типов Python.
|
||||
|
||||
Ключевые особенности:
|
||||
|
||||
@@ -118,8 +118,6 @@ FastAPI — это современный, быстрый (высокопрои
|
||||
|
||||
## Зависимости
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI стоит на плечах гигантов:
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> для части связанной с вебом.
|
||||
@@ -334,7 +332,7 @@ def update_item(item_id: int, item: Item):
|
||||
|
||||
Вам не нужно изучать новый синтаксис, методы или классы конкретной библиотеки и т. д.
|
||||
|
||||
Только стандартный **Python 3.8+**.
|
||||
Только стандартный **Python**.
|
||||
|
||||
Например, для `int`:
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI, Python <abbr title="Python 3.8 ve üzeri">3.8+</abbr>'nin standart <abbr title="Tip Belirteçleri: Type Hints">tip belirteçleri</abbr>ne dayalı, modern ve hızlı (yüksek performanslı) API'lar oluşturmak için kullanılabilecek web framework'tür.
|
||||
FastAPI, Python 'nin standart <abbr title="Tip Belirteçleri: Type Hints">tip belirteçleri</abbr>ne dayalı, modern ve hızlı (yüksek performanslı) API'lar oluşturmak için kullanılabilecek web framework'tür.
|
||||
|
||||
Temel özellikleri şunlardır:
|
||||
|
||||
@@ -124,8 +124,6 @@ Eğer API yerine, terminalde kullanılmak üzere bir <abbr title="Komut Satırı
|
||||
|
||||
## Gereksinimler
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI iki devin omuzları üstünde duruyor:
|
||||
|
||||
* Web tarafı için <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a>.
|
||||
@@ -340,7 +338,7 @@ Bu işlemi standart modern Python tipleriyle yapıyoruz.
|
||||
|
||||
Yeni bir sözdizimi yapısını, bir kütüphane özel metod veya sınıfları öğrenmeye gerek yoktur.
|
||||
|
||||
Hepsi sadece **Python 3.8+** standartlarına dayalıdır.
|
||||
Hepsi sadece **Python** standartlarına dayalıdır.
|
||||
|
||||
Örnek olarak, `int` tanımlamak için:
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
---
|
||||
|
||||
FastAPI - це сучасний, швидкий (високопродуктивний), вебфреймворк для створення API за допомогою Python 3.8+,в основі якого лежить стандартна анотація типів Python.
|
||||
FastAPI - це сучасний, швидкий (високопродуктивний), вебфреймворк для створення API за допомогою Python,в основі якого лежить стандартна анотація типів Python.
|
||||
|
||||
Ключові особливості:
|
||||
|
||||
@@ -110,8 +110,6 @@ FastAPI - це сучасний, швидкий (високопродуктив
|
||||
|
||||
## Вимоги
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI стоїть на плечах гігантів:
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> для web частини.
|
||||
@@ -326,7 +324,7 @@ def update_item(item_id: int, item: Item):
|
||||
|
||||
Вам не потрібно вивчати новий синтаксис, методи чи класи конкретної бібліотеки тощо.
|
||||
|
||||
Використовуючи стандартний **Python 3.8+**.
|
||||
Використовуючи стандартний **Python**.
|
||||
|
||||
Наприклад, для `int`:
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI là một web framework hiện đại, hiệu năng cao để xây dựng web APIs với Python 3.8+ dựa trên tiêu chuẩn Python type hints.
|
||||
FastAPI là một web framework hiện đại, hiệu năng cao để xây dựng web APIs với Python dựa trên tiêu chuẩn Python type hints.
|
||||
|
||||
Những tính năng như:
|
||||
|
||||
@@ -125,8 +125,6 @@ Nếu bạn đang xây dựng một <abbr title="Giao diện dòng lệnh">CLI</
|
||||
|
||||
## Yêu cầu
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI đứng trên vai những người khổng lồ:
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> cho phần web.
|
||||
@@ -341,7 +339,7 @@ Bạn định nghĩa bằng cách sử dụng các kiểu dữ liệu chuẩn c
|
||||
|
||||
Bạn không phải học một cú pháp mới, các phương thức và class của một thư viện cụ thể nào.
|
||||
|
||||
Chỉ cần sử dụng các chuẩn của **Python 3.8+**.
|
||||
Chỉ cần sử dụng các chuẩn của **Python**.
|
||||
|
||||
Ví dụ, với một tham số kiểu `int`:
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI jẹ́ ìgbàlódé, tí ó yára (iṣẹ-giga), ìlànà wẹ́ẹ́bù fún kikọ àwọn API pẹ̀lú Python 3.8+ èyí tí ó da lori àwọn ìtọ́kasí àmì irúfẹ́ Python.
|
||||
FastAPI jẹ́ ìgbàlódé, tí ó yára (iṣẹ-giga), ìlànà wẹ́ẹ́bù fún kikọ àwọn API pẹ̀lú Python èyí tí ó da lori àwọn ìtọ́kasí àmì irúfẹ́ Python.
|
||||
|
||||
Àwọn ẹya pàtàkì ni:
|
||||
|
||||
@@ -124,8 +124,6 @@ Ti o ba n kọ ohun èlò <abbr title="Command Line Interface">CLI</abbr> láti
|
||||
|
||||
## Èròjà
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI dúró lórí àwọn èjìká tí àwọn òmíràn:
|
||||
|
||||
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> fún àwọn ẹ̀yà ayélujára.
|
||||
@@ -340,7 +338,7 @@ O ṣe ìyẹn pẹ̀lú irúfẹ́ àmì ìtọ́kasí ìgbàlódé Python.
|
||||
|
||||
O ò nílò láti kọ́ síńtáàsì tuntun, ìlànà tàbí ọ̀wọ́ kíláàsì kan pàtó, abbl (i.e. àti bẹbẹ lọ).
|
||||
|
||||
Ìtọ́kasí **Python 3.8+**
|
||||
Ìtọ́kasí **Python**
|
||||
|
||||
Fún àpẹẹrẹ, fún `int`:
|
||||
|
||||
|
||||
34
docs/zh-hant/docs/benchmarks.md
Normal file
34
docs/zh-hant/docs/benchmarks.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# 基準測試
|
||||
|
||||
由第三方機構 TechEmpower 的基準測試表明在 Uvicorn 下運行的 **FastAPI** 應用程式是 <a href="https://www.techempower.com/benchmarks/#section=test&runid=7464e520-0dc2-473d-bd34-dbdfd7e85911&hw=ph&test=query&l=zijzen-7" class="external-link" target="_blank">最快的 Python 可用框架之一</a>,僅次於 Starlette 和 Uvicorn 本身(於 FastAPI 內部使用)。
|
||||
|
||||
但是在查看基準得分和對比時,請注意以下幾點。
|
||||
|
||||
## 基準測試和速度
|
||||
|
||||
當你查看基準測試時,時常會見到幾個不同類型的工具被同時進行測試。
|
||||
|
||||
具體來說,是將 Uvicorn、Starlette 和 FastAPI 同時進行比較(以及許多其他工具)。
|
||||
|
||||
該工具解決的問題越簡單,其效能就越好。而且大多數基準測試不會測試該工具提供的附加功能。
|
||||
|
||||
層次結構如下:
|
||||
|
||||
* **Uvicorn**:ASGI 伺服器
|
||||
* **Starlette**:(使用 Uvicorn)一個網頁微框架
|
||||
* **FastAPI**:(使用 Starlette)一個 API 微框架,具有用於建立 API 的多個附加功能、資料驗證等。
|
||||
|
||||
* **Uvicorn**:
|
||||
* 具有最佳效能,因為除了伺服器本身之外,它沒有太多額外的程式碼。
|
||||
* 你不會直接在 Uvicorn 中編寫應用程式。這意味著你的程式碼必須或多或少地包含 Starlette(或 **FastAPI**)提供的所有程式碼。如果你這樣做,你的最終應用程式將具有與使用框架相同的開銷並最大限度地減少應用程式程式碼和錯誤。
|
||||
* 如果你要比較 Uvicorn,請將其與 Daphne、Hypercorn、uWSGI 等應用程式伺服器進行比較。
|
||||
* **Starlette**:
|
||||
* 繼 Uvicorn 之後的次佳表現。事實上,Starlette 使用 Uvicorn 來運行。因此它將可能只透過執行更多程式碼而變得比 Uvicorn「慢」。
|
||||
* 但它為你提供了建立簡單網頁應用程式的工具,以及基於路徑的路由等。
|
||||
* 如果你要比較 Starlette,請將其與 Sanic、Flask、Django 等網頁框架(或微框架)進行比較。
|
||||
* **FastAPI**:
|
||||
* 就像 Starlette 使用 Uvicorn 並不能比它更快一樣, **FastAPI** 使用 Starlette,所以它不能比它更快。
|
||||
* FastAPI 在 Starlette 基礎之上提供了更多功能。包含建構 API 時所需要的功能,例如資料驗證和序列化。FastAPI 可以幫助你自動產生 API 文件,(應用程式啟動時將會自動生成文件,所以不會增加應用程式運行時的開銷)。
|
||||
* 如果你沒有使用 FastAPI 而是直接使用 Starlette(或其他工具,如 Sanic、Flask、Responder 等),你將必須自行實現所有資料驗證和序列化。因此,你的最終應用程式仍然具有與使用 FastAPI 建置相同的開銷。在許多情況下,這種資料驗證和序列化是應用程式中編寫最大量的程式碼。
|
||||
* 因此透過使用 FastAPI,你可以節省開發時間、錯誤與程式碼數量,並且相比不使用 FastAPI 你很大可能會獲得相同或更好的效能(因為那樣你必須在程式碼中實現所有相同的功能)。
|
||||
* 如果你要與 FastAPI 比較,請將其與能夠提供資料驗證、序列化和文件的網頁應用程式框架(或工具集)進行比較,例如 Flask-apispec、NestJS、Molten 等框架。
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
---
|
||||
|
||||
FastAPI 是一個現代、快速(高效能)的 web 框架,用於 Python 3.8+ 並採用標準 Python 型別提示。
|
||||
FastAPI 是一個現代、快速(高效能)的 web 框架,用於 Python 並採用標準 Python 型別提示。
|
||||
|
||||
主要特點包含:
|
||||
|
||||
@@ -115,8 +115,6 @@ FastAPI 是一個現代、快速(高效能)的 web 框架,用於 Python 3.
|
||||
|
||||
## 安裝需求
|
||||
|
||||
Python 3.8+
|
||||
|
||||
FastAPI 是站在以下巨人的肩膀上:
|
||||
|
||||
- <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> 負責網頁的部分
|
||||
@@ -331,7 +329,7 @@ def update_item(item_id: int, item: Item):
|
||||
|
||||
你不需要學習新的語法、類別、方法或函式庫等等。
|
||||
|
||||
只需要使用 **Python 3.8 以上的版本**。
|
||||
只需要使用 **Python 以上的版本**。
|
||||
|
||||
舉個範例,比如宣告 int 的型別:
|
||||
|
||||
|
||||
@@ -33,39 +33,98 @@ FastAPI 有一个非常棒的社区,它欢迎来自各个领域和背景的朋
|
||||
|
||||
这些人:
|
||||
|
||||
* [帮助他人解决 GitHub 的 issues](help-fastapi.md#github_1){.internal-link target=_blank}。
|
||||
* [帮助他人解决 GitHub 上的问题](help-fastapi.md#github_1){.internal-link target=_blank}。
|
||||
* [创建 Pull Requests](help-fastapi.md#pr){.internal-link target=_blank}。
|
||||
* 审核 Pull Requests, 对于 [翻译](contributing.md#_8){.internal-link target=_blank} 尤为重要。
|
||||
|
||||
向他们致以掌声。 👏 🙇
|
||||
|
||||
## 上个月最活跃的用户
|
||||
## FastAPI 专家
|
||||
|
||||
上个月这些用户致力于 [帮助他人解决 GitHub 的 issues](help-fastapi.md#github_1){.internal-link target=_blank}。
|
||||
这些用户一直以来致力于 [帮助他人解决 GitHub 上的问题](help-fastapi.md#github_1){.internal-link target=_blank}。 🙇
|
||||
|
||||
他们通过帮助许多人而被证明是 **FastAPI 专家**。 ✨
|
||||
|
||||
!!! 小提示
|
||||
你也可以成为认可的 FastAPI 专家!
|
||||
|
||||
只需要 [帮助他人解决 GitHub 上的问题](help-fastapi.md#github_1){.internal-link target=_blank}。 🤓
|
||||
|
||||
你可以查看不同时期的 **FastAPI 专家**:
|
||||
|
||||
* [上个月](#fastapi-experts-last-month) 🤓
|
||||
* [三个月](#fastapi-experts-3-months) 😎
|
||||
* [六个月](#fastapi-experts-6-months) 🧐
|
||||
* [一年](#fastapi-experts-1-year) 🧑🔬
|
||||
* [**全部时间**](#fastapi-experts-all-time) 🧙
|
||||
|
||||
## FastAPI 专家 - 上个月
|
||||
|
||||
这些是在过去一个月中 [在 GitHub 上帮助他人解答最多问题](help-fastapi.md#github_1){.internal-link target=_blank} 的用户。 🤓
|
||||
|
||||
{% if people %}
|
||||
<div class="user-list user-list-center">
|
||||
{% for user in people.last_month_experts[:10] %}
|
||||
|
||||
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Issues replied: {{ user.count }}</div></div>
|
||||
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">回答问题数: {{ user.count }}</div></div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
## 专家组
|
||||
### FastAPI 专家 - 三个月
|
||||
|
||||
以下是 **FastAPI 专家**。 🤓
|
||||
这些是在过去三个月中 [在 GitHub 上帮助他人解答最多问题](help-fastapi.md#github_1){.internal-link target=_blank} 的用户。 😎
|
||||
|
||||
这些用户一直以来致力于 [帮助他人解决 GitHub 的 issues](help-fastapi.md#github_1){.internal-link target=_blank}。
|
||||
{% if people %}
|
||||
<div class="user-list user-list-center">
|
||||
{% for user in people.three_months_experts[:10] %}
|
||||
|
||||
他们通过帮助许多人而被证明是专家。✨
|
||||
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">回答问题数: {{ user.count }}</div></div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
### FastAPI 专家 - 六个月
|
||||
|
||||
这些是在过去六个月中 [在 GitHub 上帮助他人解答最多问题](help-fastapi.md#github_1){.internal-link target=_blank} 的用户。 🧐
|
||||
|
||||
{% if people %}
|
||||
<div class="user-list user-list-center">
|
||||
{% for user in people.six_months_experts[:10] %}
|
||||
|
||||
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">回答问题数: {{ user.count }}</div></div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
### FastAPI 专家 - 一年
|
||||
|
||||
这些是在过去一年中 [在 GitHub 上帮助他人解答最多问题](help-fastapi.md#github_1){.internal-link target=_blank} 的用户。 🧑🔬
|
||||
|
||||
{% if people %}
|
||||
<div class="user-list user-list-center">
|
||||
{% for user in people.one_year_experts[:20] %}
|
||||
|
||||
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">回答问题数: {{ user.count }}</div></div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
## FastAPI 专家 - 全部时间
|
||||
|
||||
以下是全部时间的 **FastAPI 专家**。 🤓🤯
|
||||
|
||||
这些用户一直以来致力于 [帮助他人解决 GitHub 的 上的问题](help-fastapi.md#github_1){.internal-link target=_blank}。 🧙
|
||||
|
||||
{% if people %}
|
||||
<div class="user-list user-list-center">
|
||||
{% for user in people.experts[:50] %}
|
||||
|
||||
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Issues replied: {{ user.count }}</div></div>
|
||||
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">回答问题数: {{ user.count }}</div></div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
@@ -89,25 +148,19 @@ FastAPI 有一个非常棒的社区,它欢迎来自各个领域和背景的朋
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
还有很多其他贡献者(超过100个),你可以在 <a href="https://github.com/tiangolo/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub 贡献者页面</a> 中看到他们。👷
|
||||
还有很多别的贡献者(超过100个),你可以在 <a href="https://github.com/tiangolo/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub 贡献者页面</a> 中看到他们。👷
|
||||
|
||||
## 杰出审核者
|
||||
## 杰出翻译审核者
|
||||
|
||||
以下用户是「杰出的评审者」。 🕵️
|
||||
以下用户是 **杰出的评审者**。 🕵️
|
||||
|
||||
### 翻译审核
|
||||
|
||||
我只会说少数几种语言(而且还不是很流利 😅)。所以,具备[能力去批准文档翻译](contributing.md#_8){.internal-link target=_blank} 是这些评审者们。如果没有它们,就不会有多语言文档。
|
||||
|
||||
---
|
||||
|
||||
**杰出的评审者** 🕵️ 评审了最多来自他人的 Pull Requests,他们保证了代码、文档尤其是 **翻译** 的质量。
|
||||
我只会说少数几种语言(而且还不是很流利 😅)。所以这些评审者们具备[能力去批准文档翻译](contributing.md#_8){.internal-link target=_blank}。如果没有他们,就不会有多语言文档。
|
||||
|
||||
{% if people %}
|
||||
<div class="user-list user-list-center">
|
||||
{% for user in people.top_translations_reviewers[:50] %}
|
||||
|
||||
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Reviews: {{ user.count }}</div></div>
|
||||
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">审核数: {{ user.count }}</div></div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
|
||||
39
docs/zh/docs/how-to/general.md
Normal file
39
docs/zh/docs/how-to/general.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# 通用 - 如何操作 - 诀窍
|
||||
|
||||
这里是一些指向文档中其他部分的链接,用于解答一般性或常见问题。
|
||||
|
||||
## 数据过滤 - 安全性
|
||||
|
||||
为确保不返回超过需要的数据,请阅读 [教程 - 响应模型 - 返回类型](../tutorial/response-model.md){.internal-link target=_blank} 文档。
|
||||
|
||||
## 文档的标签 - OpenAPI
|
||||
|
||||
在文档界面中添加**路径操作**的标签和进行分组,请阅读 [教程 - 路径操作配置 - Tags 参数](../tutorial/path-operation-configuration.md#tags){.internal-link target=_blank} 文档。
|
||||
|
||||
## 文档的概要和描述 - OpenAPI
|
||||
|
||||
在文档界面中添加**路径操作**的概要和描述,请阅读 [教程 - 路径操作配置 - Summary 和 Description 参数](../tutorial/path-operation-configuration.md#summary-description){.internal-link target=_blank} 文档。
|
||||
|
||||
## 文档的响应描述 - OpenAPI
|
||||
|
||||
在文档界面中定义并显示响应描述,请阅读 [教程 - 路径操作配置 - 响应描述](../tutorial/path-operation-configuration.md#response-description){.internal-link target=_blank} 文档。
|
||||
|
||||
## 文档弃用**路径操作** - OpenAPI
|
||||
|
||||
在文档界面中显示弃用的**路径操作**,请阅读 [教程 - 路径操作配置 - 弃用](../tutorial/path-operation-configuration.md#deprecate-a-path-operation){.internal-link target=_blank} 文档。
|
||||
|
||||
## 将任何数据转换为 JSON 兼容格式
|
||||
|
||||
要将任何数据转换为 JSON 兼容格式,请阅读 [教程 - JSON 兼容编码器](../tutorial/encoder.md){.internal-link target=_blank} 文档。
|
||||
|
||||
## OpenAPI 元数据 - 文档
|
||||
|
||||
要添加 OpenAPI 的元数据,包括许可证、版本、联系方式等,请阅读 [教程 - 元数据和文档 URL](../tutorial/metadata.md){.internal-link target=_blank} 文档。
|
||||
|
||||
## OpenAPI 自定义 URL
|
||||
|
||||
要自定义 OpenAPI 的 URL(或删除它),请阅读 [教程 - 元数据和文档 URL](../tutorial/metadata.md#openapi-url){.internal-link target=_blank} 文档。
|
||||
|
||||
## OpenAPI 文档 URL
|
||||
|
||||
要更改用于自动生成文档的 URL,请阅读 [教程 - 元数据和文档 URL](../tutorial/metadata.md#docs-urls){.internal-link target=_blank}.
|
||||
11
docs/zh/docs/how-to/index.md
Normal file
11
docs/zh/docs/how-to/index.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 如何操作 - 诀窍
|
||||
|
||||
在这里,你将看到关于**多个主题**的不同诀窍或“如何操作”指南。
|
||||
|
||||
这些方法多数是**相互独立**的,在大多数情况下,你只需在这些内容适用于**你的项目**时才需要学习它们。
|
||||
|
||||
如果某些内容看起来对你的项目有用,请继续查阅,否则请直接跳过它们。
|
||||
|
||||
!!! 小技巧
|
||||
|
||||
如果你想以系统的方式**学习 FastAPI**(推荐),请阅读 [教程 - 用户指南](../tutorial/index.md){.internal-link target=_blank} 的每一章节。
|
||||
@@ -36,7 +36,7 @@ hide:
|
||||
|
||||
---
|
||||
|
||||
FastAPI 是一个用于构建 API 的现代、快速(高性能)的 web 框架,使用 Python 3.8+ 并基于标准的 Python 类型提示。
|
||||
FastAPI 是一个用于构建 API 的现代、快速(高性能)的 web 框架,使用 Python 并基于标准的 Python 类型提示。
|
||||
|
||||
关键特性:
|
||||
|
||||
@@ -119,7 +119,7 @@ FastAPI 是一个用于构建 API 的现代、快速(高性能)的 web 框
|
||||
|
||||
## 依赖
|
||||
|
||||
Python 3.8 及更高版本
|
||||
Python 及更高版本
|
||||
|
||||
FastAPI 站在以下巨人的肩膀之上:
|
||||
|
||||
@@ -335,7 +335,7 @@ def update_item(item_id: int, item: Item):
|
||||
|
||||
你不需要去学习新的语法、了解特定库的方法或类,等等。
|
||||
|
||||
只需要使用标准的 **Python 3.8 及更高版本**。
|
||||
只需要使用标准的 **Python 及更高版本**。
|
||||
|
||||
举个例子,比如声明 `int` 类型:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
|
||||
|
||||
__version__ = "0.110.2"
|
||||
__version__ = "0.110.3"
|
||||
|
||||
from starlette import status as status
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class APIKeyQuery(APIKeyBase):
|
||||
Doc(
|
||||
"""
|
||||
By default, if the query parameter is not provided, `APIKeyQuery` will
|
||||
automatically cancel the request and sebd the client an error.
|
||||
automatically cancel the request and send the client an error.
|
||||
|
||||
If `auto_error` is set to `False`, when the query parameter is not
|
||||
available, instead of erroring out, the dependency result will be
|
||||
|
||||
@@ -15,7 +15,7 @@ from typing_extensions import Annotated, Doc
|
||||
|
||||
class HTTPBasicCredentials(BaseModel):
|
||||
"""
|
||||
The HTTP Basic credendials given as the result of using `HTTPBasic` in a
|
||||
The HTTP Basic credentials given as the result of using `HTTPBasic` in a
|
||||
dependency.
|
||||
|
||||
Read more about it in the
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
[build-system]
|
||||
requires = ["hatchling >= 1.13.0"]
|
||||
build-backend = "hatchling.build"
|
||||
requires = ["pdm-backend"]
|
||||
build-backend = "pdm.backend"
|
||||
|
||||
[project]
|
||||
name = "fastapi"
|
||||
dynamic = ["version"]
|
||||
description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.8"
|
||||
license = "MIT"
|
||||
authors = [
|
||||
{ name = "Sebastián Ramírez", email = "tiangolo@gmail.com" },
|
||||
]
|
||||
@@ -45,7 +45,6 @@ dependencies = [
|
||||
"pydantic>=1.7.4,!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0",
|
||||
"typing-extensions>=4.8.0",
|
||||
]
|
||||
dynamic = ["version"]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/tiangolo/fastapi"
|
||||
@@ -53,22 +52,67 @@ Documentation = "https://fastapi.tiangolo.com/"
|
||||
Repository = "https://github.com/tiangolo/fastapi"
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
||||
# standard = [
|
||||
# # For the test client
|
||||
# "httpx >=0.23.0",
|
||||
# # For templates
|
||||
# "jinja2 >=2.11.2",
|
||||
# # For forms and file uploads
|
||||
# "python-multipart >=0.0.7",
|
||||
# # For UJSONResponse
|
||||
# "ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0",
|
||||
# # For ORJSONResponse
|
||||
# "orjson >=3.2.1",
|
||||
# # To validate email fields
|
||||
# "email_validator >=2.0.0",
|
||||
# # Uvicorn with uvloop
|
||||
# "uvicorn[standard] >=0.12.0",
|
||||
# # Settings management
|
||||
# "pydantic-settings >=2.0.0",
|
||||
# # Extra Pydantic data types
|
||||
# "pydantic-extra-types >=2.0.0",
|
||||
# ]
|
||||
|
||||
all = [
|
||||
# # For the test client
|
||||
"httpx >=0.23.0",
|
||||
# For templates
|
||||
"jinja2 >=2.11.2",
|
||||
# For forms and file uploads
|
||||
"python-multipart >=0.0.7",
|
||||
# For Starlette's SessionMiddleware, not commonly used with FastAPI
|
||||
"itsdangerous >=1.1.0",
|
||||
# For Starlette's schema generation, would not be used with FastAPI
|
||||
"pyyaml >=5.3.1",
|
||||
# For UJSONResponse
|
||||
"ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0",
|
||||
# For ORJSONResponse
|
||||
"orjson >=3.2.1",
|
||||
# To validate email fields
|
||||
"email_validator >=2.0.0",
|
||||
# Uvicorn with uvloop
|
||||
"uvicorn[standard] >=0.12.0",
|
||||
# Settings management
|
||||
"pydantic-settings >=2.0.0",
|
||||
# Extra Pydantic data types
|
||||
"pydantic-extra-types >=2.0.0",
|
||||
]
|
||||
|
||||
[tool.hatch.version]
|
||||
path = "fastapi/__init__.py"
|
||||
[tool.pdm]
|
||||
version = { source = "file", path = "fastapi/__init__.py" }
|
||||
distribution = true
|
||||
|
||||
[tool.pdm.build]
|
||||
source-includes = [
|
||||
"tests/",
|
||||
"docs_src/",
|
||||
"requirements*.txt",
|
||||
"scripts/",
|
||||
# For a test
|
||||
"docs/en/docs/img/favicon.png",
|
||||
]
|
||||
|
||||
|
||||
[tool.mypy]
|
||||
strict = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-e .
|
||||
-r requirements-docs-tests.txt
|
||||
mkdocs-material==9.4.7
|
||||
mkdocs-material==9.5.18
|
||||
mdx-include >=1.4.1,<2.0.0
|
||||
mkdocs-redirects>=1.2.1,<1.3.0
|
||||
typer >=0.12.0
|
||||
@@ -8,10 +8,10 @@ pyyaml >=5.3.1,<7.0.0
|
||||
# For Material for MkDocs, Chinese search
|
||||
jieba==0.42.1
|
||||
# For image processing by Material for MkDocs
|
||||
pillow==10.2.0
|
||||
pillow==10.3.0
|
||||
# For image processing by Material for MkDocs
|
||||
cairosvg==2.7.0
|
||||
mkdocstrings[python]==0.23.0
|
||||
mkdocstrings[python]==0.24.3
|
||||
griffe-typingdoc==0.2.2
|
||||
# For griffe, it formats with black
|
||||
black==24.3.0
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
-e .
|
||||
-e .[all]
|
||||
-r requirements-docs-tests.txt
|
||||
pydantic-settings >=2.0.0
|
||||
pytest >=7.1.3,<8.0.0
|
||||
coverage[toml] >= 6.5.0,< 8.0
|
||||
mypy ==1.8.0
|
||||
ruff ==0.2.0
|
||||
email_validator >=1.1.1,<3.0.0
|
||||
dirty-equals ==0.6.0
|
||||
# TODO: once removing databases from tutorial, upgrade SQLAlchemy
|
||||
# probably when including SQLModel
|
||||
sqlalchemy >=1.3.18,<1.4.43
|
||||
databases[sqlite] >=0.3.2,<0.7.0
|
||||
orjson >=3.2.1,<4.0.0
|
||||
ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0
|
||||
python-multipart >=0.0.7,<0.1.0
|
||||
flask >=1.1.2,<3.0.0
|
||||
anyio[trio] >=3.2.1,<4.0.0
|
||||
python-jose[cryptography] >=3.3.0,<4.0.0
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
-e .[all]
|
||||
-r requirements-tests.txt
|
||||
-r requirements-docs.txt
|
||||
uvicorn[standard] >=0.12.0,<0.23.0
|
||||
pre-commit >=2.17.0,<4.0.0
|
||||
# For generating screenshots
|
||||
playwright
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Check README.md is up to date
|
||||
python ./scripts/docs.py verify-docs
|
||||
python ./scripts/docs.py build-all
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if [ -d 'dist' ] ; then
|
||||
rm -r dist
|
||||
fi
|
||||
if [ -d 'site' ] ; then
|
||||
rm -r site
|
||||
fi
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
mkdocs serve --dev-addr 0.0.0.0:8008
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh -e
|
||||
set -x
|
||||
|
||||
ruff fastapi tests docs_src scripts --fix
|
||||
ruff check fastapi tests docs_src scripts --fix
|
||||
ruff format fastapi tests docs_src scripts
|
||||
|
||||
@@ -4,5 +4,5 @@ set -e
|
||||
set -x
|
||||
|
||||
mypy fastapi
|
||||
ruff fastapi tests docs_src scripts
|
||||
ruff check fastapi tests docs_src scripts
|
||||
ruff format fastapi tests --check
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
set -e
|
||||
# Install pip
|
||||
cd /tmp
|
||||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
||||
python3.6 get-pip.py --user
|
||||
cd -
|
||||
# Install Flit to be able to install all
|
||||
python3.6 -m pip install --user flit
|
||||
# Install with Flit
|
||||
python3.6 -m flit install --user --extras doc
|
||||
# Finally, run mkdocs
|
||||
python3.6 -m mkdocs build
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
flit publish
|
||||
Reference in New Issue
Block a user