docs/ja/docs/index.md MARKDOWN 586 lines View on github.com → Search inside
1---2include_yaml:3  sponsors: data/sponsors.yml4---56# FastAPI { #fastapi }78<style>9.md-content .md-typeset h1 { display: none; }10</style>1112<p align="center">13  <a href="https://fastapi.tiangolo.com/ja"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" alt="FastAPI"></a>14</p>15<p align="center">16    <em>FastAPI フレームワーク高パフォーマンス学びやすい素早くコーディングできる本番運用に対応</em>17</p>18<p align="center">19<a href="https://github.com/fastapi/fastapi/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster">20    <img src="https://github.com/fastapi/fastapi/actions/workflows/test.yml/badge.svg?event=push&branch=master" alt="Test">21</a>22<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi">23    <img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi.svg" alt="Coverage">24</a>25<a href="https://pypi.org/project/fastapi">26    <img src="https://img.shields.io/pypi/v/fastapi?color=%2334D058&label=pypi%20package" alt="Package version">27</a>28<a href="https://pypi.org/project/fastapi">29    <img src="https://img.shields.io/pypi/pyversions/fastapi.svg?color=%2334D058" alt="Supported Python versions">30</a>31</p>3233---3435**ドキュメント**: [https://fastapi.tiangolo.com/ja](https://fastapi.tiangolo.com/ja)3637**ソースコード**: [https://github.com/fastapi/fastapi](https://github.com/fastapi/fastapi)3839---4041FastAPIPython の標準である型ヒントに基づいて PythonAPI を構築するためのモダンで高速高パフォーマンスWeb フレームワークです4243主な特徴:4445* **高速**: **NodeJS****Go** 並みのとても高いパフォーマンスStarlettePydantic のおかげです)。 [利用可能な最も高速な Python フレームワークの一つです](#performance)。46* **高速なコーディング**: 開発速度を約 200%〜300% 向上させます。*47* **少ないバグ**: 開発者起因のヒューマンエラーを約 40% 削減します。*48* **直感的**: 素晴らしいエディタサポート。<dfn title="別名: auto-complete、autocompletion、IntelliSense">補完</dfn> があらゆる場所で使えますデバッグ時間を削減します49* **簡単**: 簡単に利用習得できるようにデザインされていますドキュメントを読む時間を削減します50* **短い**: コードの重複を最小限にします各パラメータ宣言から複数の機能を得られますバグも減ります51* **堅牢性**: 自動対話型ドキュメントにより本番環境向けのコードが得られます52* **Standards-based**: API のオープンスタンダードに基づいておりそして完全に互換性があります)、[OpenAPI](https://github.com/OAI/OpenAPI-Specification)(以前は Swagger として知られていました)や [JSON Schema](https://json-schema.org/) をサポートします。5354<small>* 本番アプリケーションを構築している社内開発チームのテストに基づく見積もりです。</small>5556## Sponsors { #sponsors }5758<!-- sponsors -->5960### Keystone Sponsor { #keystone-sponsor }6162<div class="fastapi-sponsors fastapi-sponsors--keystone">63{% for sponsor in sponsors.keystone -%}64<a class="fastapi-sponsors__card fastapi-sponsors__card--keystone" href="{{ sponsor.url }}" title="{{ sponsor.title }}"><img class="fastapi-sponsors__banner" src="{{ sponsor.img }}" alt="{{ sponsor.title }}"></a>65{% endfor -%}66</div>6768### Gold Sponsors { #gold-sponsors }6970<div class="fastapi-sponsors fastapi-sponsors--gold">71{% for sponsor in sponsors.gold -%}72<a class="fastapi-sponsors__card fastapi-sponsors__card--gold" href="{{ sponsor.url }}" title="{{ sponsor.title }}"><img class="fastapi-sponsors__banner" src="{{ sponsor.img }}" alt="{{ sponsor.title }}" loading="lazy"></a>73{% endfor -%}74</div>7576### Silver Sponsors { #silver-sponsors }7778<div class="fastapi-sponsors fastapi-sponsors--silver">79{% for sponsor in sponsors.silver -%}80<a class="fastapi-sponsors__card fastapi-sponsors__card--silver" href="{{ sponsor.url }}" title="{{ sponsor.title }}"><img class="fastapi-sponsors__banner" src="{{ sponsor.img }}" alt="{{ sponsor.title }}" loading="lazy"></a>81{% endfor %}82</div>8384<!-- /sponsors -->8586[その他のスポンサー](https://fastapi.tiangolo.com/ja/fastapi-people/#sponsors)8788## 評価 { #opinions }8990<!-- only-mkdocs -->91<div class="fastapi-opinions" data-fastapi-opinions>92  <div class="fastapi-opinions__tabs" role="tablist" aria-label="Companies using FastAPI">93    <button class="fastapi-opinions__tab" role="tab" type="button" id="fo-tab-microsoft" aria-controls="fo-panel-microsoft" aria-selected="true" tabindex="0">94      <span class="fastapi-opinions__mark"><img src="/img/logos/microsoft.svg" alt="Microsoft" loading="lazy"></span>95    </button>96    <button class="fastapi-opinions__tab" role="tab" type="button" id="fo-tab-uber" aria-controls="fo-panel-uber" aria-selected="false" tabindex="-1">97      <span class="fastapi-opinions__mark"><img src="/img/logos/uber.svg" alt="Uber" loading="lazy"></span>98    </button>99    <button class="fastapi-opinions__tab" role="tab" type="button" id="fo-tab-netflix" aria-controls="fo-panel-netflix" aria-selected="false" tabindex="-1">100      <span class="fastapi-opinions__mark"><img src="/img/logos/netflix.svg" alt="Netflix" loading="lazy"></span>101    </button>102    <button class="fastapi-opinions__tab" role="tab" type="button" id="fo-tab-cisco" aria-controls="fo-panel-cisco" aria-selected="false" tabindex="-1">103      <span class="fastapi-opinions__mark"><img src="/img/logos/cisco.svg" alt="Cisco" loading="lazy"></span>104    </button>105  </div>106107  <div class="fastapi-opinions__panel" id="fo-panel-microsoft" role="tabpanel" aria-labelledby="fo-tab-microsoft" tabindex="0">108    <blockquote class="fastapi-opinions__quote">「最近は **FastAPI** をたくさん使っています実際私のチームの **MicrosoftML サービス** 全てで使用する予定ですそのいくつかはコアな **Windows** 製品や **Office** 製品に統合されつつあります。」</blockquote>109    <div class="fastapi-opinions__attr">— Kabir Khan, <strong>Microsoft</strong> <a href="https://github.com/fastapi/fastapi/pull/26">(ref)</a></div>110  </div>111  <div class="fastapi-opinions__panel" id="fo-panel-uber" role="tabpanel" aria-labelledby="fo-tab-uber" tabindex="0" hidden>112    <blockquote class="fastapi-opinions__quote">「**FastAPI** ライブラリを採用しクエリで **予測値** を取得できる **REST** サーバを構築しました。」<em>[for Ludwig]</em></blockquote>113    <div class="fastapi-opinions__attr">— Piero Molino, Yaroslav Dudin, Sai Sumanth Miryala, <strong>Uber</strong> <a href="https://eng.uber.com/ludwig-v0-2/">(ref)</a></div>114  </div>115  <div class="fastapi-opinions__panel" id="fo-panel-netflix" role="tabpanel" aria-labelledby="fo-tab-netflix" tabindex="0" hidden>116    <blockquote class="fastapi-opinions__quote">「<strong>Netflix</strong>私たちの <strong>危機管理</strong> オーケストレーションフレームワーク、<strong>Dispatch</strong> のオープンソースリリースを発表できることをうれしく思います!」<em>[built with FastAPI]</em></blockquote>117    <div class="fastapi-opinions__attr">— Kevin Glisson, Marc Vilanova, Forest Monsen, <strong>Netflix</strong> <a href="https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072">(ref)</a></div>118  </div>119  <div class="fastapi-opinions__panel" id="fo-panel-cisco" role="tabpanel" aria-labelledby="fo-tab-cisco" tabindex="0" hidden>120    <blockquote class="fastapi-opinions__quote">「本番の Python API を構築したい方には、**FastAPI** を強くおすすめします。**美しく設計**され、**使いやすく**、**高いスケーラビリティ**があります私たちの API ファースト開発戦略の **主要コンポーネント** となりました。」</blockquote>121    <div class="fastapi-opinions__attr">— Deon Pillsbury, <strong>Cisco</strong> <a href="https://www.linkedin.com/posts/deonpillsbury_cisco-cx-python-activity-6963242628536487936-trAp/">(ref)</a></div>122  </div>123</div>124<!-- /only-mkdocs -->125126<div class="only-github" markdown="1">127128"_[...] 最近 **FastAPI** を使っています。 [...] 実際に私のチームの全ての **Microsoft の機械学習サービス** で使用する予定です。 そのうちのいくつかのコアな **Windows** 製品と **Office** 製品に統合されつつあります。_"129130<div style="text-align: right; margin-right: 10%;">Kabir Khan - <strong>Microsoft</strong> <a href="https://github.com/fastapi/fastapi/pull/26"><small>(ref)</small></a></div>131132---133134"_FastAPIライブラリを採用し、クエリで **予測値** を取得できる **REST** サーバを構築しました。 [for Ludwig]_"135136<div style="text-align: right; margin-right: 10%;">Piero Molino, Yaroslav Dudin, and Sai Sumanth Miryala - <strong>Uber</strong> <a href="https://eng.uber.com/ludwig-v0-2/"><small>(ref)</small></a></div>137138---139140"_**Netflix** は、**危機管理**オーケストレーションフレームワーク、**Dispatch** のオープンソースリリースを発表できることをうれしく思います。 [built with **FastAPI**]_"141142<div style="text-align: right; margin-right: 10%;">Kevin Glisson, Marc Vilanova, Forest Monsen - <strong>Netflix</strong> <a href="https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072"><small>(ref)</small></a></div>143144---145146"_本番運用の Python API を構築したい方には、**FastAPI** を強くおすすめします。**美しく設計**されており、**使いやすく**、**高いスケーラビリティ**があります。私たちの API ファースト開発戦略の **主要コンポーネント** となり、Virtual TAC Engineer などの多くの自動化やサービスを推進しています。_"147148<div style="text-align: right; margin-right: 10%;">Deon Pillsbury - <strong>Cisco</strong> <a href="https://www.linkedin.com/posts/deonpillsbury_cisco-cx-python-activity-6963242628536487936-trAp/"><small>(ref)</small></a></div>149150---151152</div>153154## FastAPI Conf { #fastapi-conf }155156[**FastAPI Conf '26**](https://fastapiconf.com) は **2026 年 10 月 28 日** に **オランダ・アムステルダム** で開催されます。FastAPI のすべてを、ソースから直接。🎤157158<a class="fastapi-feature-banner" href="https://fastapiconf.com"><img src="https://fastapi.tiangolo.com/img/fastapi-conf.jpeg" alt="FastAPI Conf '26 - 2026年10月28日 - オランダ・アムステルダム"></a>159160## FastAPI ミニドキュメンタリー { #fastapi-mini-documentary }1611622025 年末に公開された [FastAPI ミニドキュメンタリー](https://www.youtube.com/watch?v=mpR8ngthqiE)があります。オンラインで視聴できます:163164<a class="fastapi-feature-banner" href="https://www.youtube.com/watch?v=mpR8ngthqiE"><img src="https://fastapi.tiangolo.com/img/fastapi-documentary.jpg" alt="FastAPI Mini Documentary"></a>165166## **Typer**、CLIFastAPI { #typer-the-fastapi-of-clis }167168<a href="https://typer.tiangolo.com"><img src="https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg" style="width: 20%;"></a>169170Web API の代わりにターミナルで使用する <abbr title="Command Line Interface - コマンドラインインターフェイス">CLI</abbr> アプリを構築する場合は、[**Typer**](https://typer.tiangolo.com/) を確認してください。171172**Typer**FastAPI の弟分ですそして、**CLIFastAPI** を意図しています ⌨️ 🚀173174## 必要条件 { #requirements }175176FastAPI は巨人の肩の上に立っています177178* [Starlette](https://www.starlette.dev/)(Web 部分)179* [Pydantic](https://docs.pydantic.dev/)(データ部分)180181## インストール { #installation }182183[仮想環境](https://fastapi.tiangolo.com/ja/virtual-environments/) を作成して有効化し、それから FastAPI をインストールします。184185<div class="termy">186187```console188$ pip install "fastapi[standard]"189190---> 100%191```192193</div>194195****: すべてのターミナルで動作するように`"fastapi[standard]"` は必ずクォートで囲んでください196197## アプリケーション例 { #example }198199### 作成 { #create-it }200201`main.py` ファイルを作成し以下のコードを入力します202203```Python204from fastapi import FastAPI205206app = FastAPI()207208209@app.get("/")210def read_root():211    return {"Hello": "World"}212213214@app.get("/items/{item_id}")215def read_item(item_id: int, q: str | None = None):216    return {"item_id": item_id, "q": q}217```218219<details markdown="1">220<summary>または <code>async def</code> を使います...</summary>221222コードで `async` / `await` を使用する場合は`async def` を使います223224```Python hl_lines="7  12"225from fastapi import FastAPI226227app = FastAPI()228229230@app.get("/")231async def read_root():232    return {"Hello": "World"}233234235@app.get("/items/{item_id}")236async def read_item(item_id: int, q: str | None = None):237    return {"item_id": item_id, "q": q}238```239240****:241242わからない場合は_In a hurry?」_ セクションの [ドキュメントの `async``await`](https://fastapi.tiangolo.com/ja/async/#in-a-hurry) を確認してください。243244</details>245246### 実行 { #run-it }247248以下のコマンドでサーバーを起動します249250<div class="termy">251252```console253$ fastapi dev254255 ╭────────── FastAPI CLI - Development mode ───────────╮256                                                      257   Serving at: http://127.0.0.1:8000                  │258                                                      259   API docs: http://127.0.0.1:8000/docs               │260                                                      261   Running in development mode, for production use:   262                                                      263   fastapi run                                        264                                                      265 ╰─────────────────────────────────────────────────────╯266267INFO:     Will watch for changes in these directories: ['/home/user/code/awesomeapp']268INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)269INFO:     Started reloader process [2248755] using WatchFiles270INFO:     Started server process [2248757]271INFO:     Waiting for application startup.272INFO:     Application startup complete.273```274275</div>276277<details markdown="1">278<summary><code>fastapi dev</code> コマンドについて</summary>279280`fastapi dev` コマンドは `main.py` ファイルを自動的に読み取りその中の **FastAPI** アプリを検出し、[Uvicorn](https://www.uvicorn.dev) を使用してサーバーを起動します。281282デフォルトでは`fastapi dev` はローカル開発向けに自動リロードを有効にして起動します283284詳しくは [FastAPI CLI docs](https://fastapi.tiangolo.com/ja/fastapi-cli/) を参照してください。285286</details>287288### 動作確認 { #check-it }289290ブラウザで [http://127.0.0.1:8000/items/5?q=somequery](http://127.0.0.1:8000/items/5?q=somequery) を開きます。291292以下の JSON のレスポンスが確認できます293294```JSON295{"item_id": 5, "q": "somequery"}296```297298すでに以下の API が作成されています299300* _パス_ `/``/items/{item_id}`HTTP リクエストを受け取ります301* 両方の _パス_ は `GET` <em>操作</em>(HTTP _メソッド_ としても知られていますを取ります302* _パス_ `/items/{item_id}``int` であるべき _パスパラメータ_ `item_id` を持ちます303* _パス_ `/items/{item_id}` はオプションの `str` _クエリパラメータ_ `q` を持ちます304305### 自動対話型 API ドキュメント { #interactive-api-docs }306307次に、[http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs) にアクセスします。308309自動対話型 API ドキュメントが表示されます([Swagger UI](https://github.com/swagger-api/swagger-ui) が提供しています)。310311![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)312313### 代替 API ドキュメント { #alternative-api-docs }314315次に、[http://127.0.0.1:8000/redoc](http://127.0.0.1:8000/redoc) にアクセスします。316317代替の自動ドキュメントが表示されます([ReDoc](https://github.com/Rebilly/ReDoc) が提供しています)。318319![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)320321## アップグレード例 { #example-upgrade }322323次に`PUT` リクエストからボディを受け取るために `main.py` ファイルを修正しましょう324325Pydantic によって標準的な Python の型を使ってボディを宣言します326327```Python hl_lines="2  7-10 23-25"328from fastapi import FastAPI329from pydantic import BaseModel330331app = FastAPI()332333334class Item(BaseModel):335    name: str336    price: float337    is_offer: bool | None = None338339340@app.get("/")341def read_root():342    return {"Hello": "World"}343344345@app.get("/items/{item_id}")346def read_item(item_id: int, q: str | None = None):347    return {"item_id": item_id, "q": q}348349350@app.put("/items/{item_id}")351def update_item(item_id: int, item: Item):352    return {"item_name": item.name, "item_id": item_id}353```354355`fastapi dev` サーバーは自動でリロードされるはずです356357### 自動対話型 API ドキュメントのアップグレード { #interactive-api-docs-upgrade }358359次に、[http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs) にアクセスします。360361* 自動対話型 API ドキュメントは新しいボディも含めて自動でアップデートされます362363![Swagger UI](https://fastapi.tiangolo.com/img/index/index-03-swagger-02.png)364365* Try it outボタンをクリックしますパラメータを入力して API と直接やりとりできます366367![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-04-swagger-03.png)368369* 次に、「Executeボタンをクリックしますユーザーインターフェースは API と通信しパラメータを送信し結果を取得して画面に表示します370371![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-05-swagger-04.png)372373### 代替 API ドキュメントのアップグレード { #alternative-api-docs-upgrade }374375次に、[http://127.0.0.1:8000/redoc](http://127.0.0.1:8000/redoc) にアクセスします。376377* 代替のドキュメントにも新しいクエリパラメータやボディが反映されます378379![ReDoc](https://fastapi.tiangolo.com/img/index/index-06-redoc-02.png)380381### まとめ { #recap }382383要約すると関数のパラメータとしてパラメータやボディなどの型を **一度だけ** 宣言します384385標準的な最新の Python の型を使います386387新しい構文や特定のライブラリのメソッドやクラスなどを覚える必要はありません388389単なる標準的な **Python** です390391例えば`int` の場合:392393```Python394item_id: int395```396397またはより複雑な `Item` モデルの場合:398399```Python400item: Item401```402403...そしてこの一度の宣言で以下のようになります404405* 以下を含むエディタサポート:406    * 補完407    * 型チェック408* データの検証:409    * データが無効な場合に自動で明確なエラーを返します410    * 深い入れ子になった JSON オブジェクトでも検証が可能です411* 入力データの <dfn title="別名: serialization、parsing、marshalling">変換</dfn>: ネットワークから Python のデータや型へ以下から読み取ります:412    * JSON413    * パスパラメータ414    * クエリパラメータ415    * Cookie416    * ヘッダー417    * フォーム418    * ファイル419* 出力データの <dfn title="別名: serialization、parsing、marshalling">変換</dfn>: Python のデータや型からネットワークデータへJSON として変換します:420    * Python の型`str``int``float``bool``list` などの変換421    * `datetime` オブジェクト422    * `UUID` オブジェクト423    * データベースモデル424    * ...などなど425* 2 つの代替ユーザーインターフェースを含む自動対話型 API ドキュメント:426    * Swagger UI427    * ReDoc428429---430431前のコード例に戻ると、**FastAPI** は次のように動作します432433* `GET` および `PUT` リクエストのパスに `item_id` があることを検証します434* `GET` および `PUT` リクエストに対して `item_id``int` 型であることを検証します435    * そうでない場合クライアントは有用で明確なエラーを受け取ります436* `GET` リクエストに対して`q` という名前のオプションのクエリパラメータ`http://127.0.0.1:8000/items/foo?q=somequery` のようなが存在するかどうかを調べます437    * `q` パラメータは `= None` で宣言されているためオプションです438    * `None` がなければ必須になります`PUT` の場合のボディと同様です)。439* `PUT` リクエストを `/items/{item_id}` に送信する場合ボディを JSON として読み込みます:440    * 必須の属性 `name` があり`str` であるべきことを確認します441    * 必須の属性 `price` があり`float` でなければならないことを確認します442    * オプションの属性 `is_offer` があり存在する場合は `bool` であるべきことを確認します443    * これらはすべて深くネストされた JSON オブジェクトに対しても動作します444* JSON への/からの変換を自動的に行います445* OpenAPI ですべてを文書化し以下で利用できます:446    * 対話型ドキュメントシステム447    * 多くの言語に対応した自動クライアントコード生成システム448* 2 つの対話型ドキュメント Web インターフェースを直接提供します449450---451452まだ表面的な部分に触れただけですが仕組みはすでにイメージできているはずです453454以下の行を変更してみてください455456```Python457    return {"item_name": item.name, "item_id": item_id}458```459460...以下の:461462```Python463        ... "item_name": item.name ...464```465466...:467468```Python469        ... "item_price": item.price ...470```471472...に変更しエディタが属性を自動補完しその型を知ることを確認してください473474![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png)475476より多くの機能を含むより完全な例については、<a href="https://fastapi.tiangolo.com/ja/tutorial/">Tutorial - User Guide</a> を参照してください477478**ネタバレ注意**: tutorial - user guide には以下が含まれます479480* **ヘッダー**、**Cookie**、**フォームフィールド**、**ファイル**など他のさまざまな場所からの **パラメータ** 宣言481* `maximum_length``regex` のような **検証制約** を設定する方法482* 非常に強力で使いやすい **<dfn title="別名: components、resources、providers、services、injectables">依存性注入</dfn>** システム483* **JWT トークン**を用いた **OAuth2****HTTP Basic** 認証のサポートを含むセキュリティと認証484* **深くネストされた JSON モデル**を宣言するためのより高度なしかし同様に簡単な手法Pydantic のおかげです)。485* [Strawberry](https://strawberry.rocks) および他のライブラリによる **GraphQL** 統合。486* 以下のようなたくさんのおまけ機能Starlette のおかげです):487    * **WebSockets**488    * HTTPX`pytest` に基づく極めて簡単なテスト489    * **CORS**490    * **Cookie Sessions**491    * ...などなど492493### アプリをデプロイ任意 { #deploy-your-app-optional }494495必要に応じて FastAPI アプリを [FastAPI Cloud](https://fastapicloud.com) にデプロイできます。まだの場合はウェイティングリストに参加してください。 🚀496497すでに **FastAPI Cloud** アカウントウェイティングリストから招待されました 😉)がある場合は1 コマンドでアプリケーションをデプロイできます498499<div class="termy">500501```console502$ fastapi deploy503504Deploying to FastAPI Cloud...505506 Deployment successful!507508🐔 Ready the chicken! Your app is ready at https://myapp.fastapicloud.dev509```510511</div>512513これで完了ですその URL でアプリにアクセスできます 514515#### FastAPI Cloud について { #about-fastapi-cloud }516517**[FastAPI Cloud](https://fastapicloud.com)** は **FastAPI** の作者と同じチームによって作られています。518519最小限の労力で API**構築**、**デプロイ**、**アクセス** するためのプロセスを効率化します520521FastAPI でアプリを構築するのと同じ **開発者体験**クラウドへの **デプロイ** にももたらします 🎉522523FastAPI Cloud*FastAPI and friends* オープンソースプロジェクトの主要スポンサーであり資金提供元です 524525#### 他のクラウドプロバイダにデプロイ { #deploy-to-other-cloud-providers }526527FastAPI はオープンソースであり標準に基づいています選択した任意のクラウドプロバイダに FastAPI アプリをデプロイできます528529各クラウドプロバイダのガイドに従ってFastAPI アプリをデプロイしてください 🤓530531## パフォーマンス { #performance }532533独立した TechEmpower のベンチマークではUvicorn で動作する **FastAPI** アプリケーションが、[利用可能な最も高速な Python フレームワークの一つ](https://www.techempower.com/benchmarks/#section=test&runid=7464e520-0dc2-473d-bd34-dbdfd7e85911&hw=ph&test=query&l=zijzen-7)であり、Starlette と Uvicorn(FastAPI で内部的に使用されています)にのみ下回っていると示されています。(*)534535詳細は [Benchmarks](https://fastapi.tiangolo.com/ja/benchmarks/) セクションをご覧ください。536537## 依存関係 { #dependencies }538539FastAPIPydanticStarlette に依存しています540541### `standard` 依存関係 { #standard-dependencies }542543FastAPI`pip install "fastapi[standard]"` でインストールすると`standard` グループのオプション依存関係が含まれます544545Pydantic によって使用されるもの:546547* [`email-validator`](https://github.com/JoshData/python-email-validator) - メール検証のため。548549Starlette によって使用されるもの:550551* [`httpx`](https://www.python-httpx.org) - `TestClient` を使用したい場合に必要です。552* [`jinja2`](https://jinja.palletsprojects.com) - デフォルトのテンプレート設定を使用したい場合に必要です。553* [`python-multipart`](https://github.com/Kludex/python-multipart) - `request.form()` とともに、フォームの <dfn title="HTTP リクエストから届く文字列を Python データに変換すること">「parsing」</dfn> をサポートしたい場合に必要です。554555FastAPI によって使用されるもの:556557* [`uvicorn`](https://www.uvicorn.dev) - アプリケーションをロードして提供するサーバーのため。これには `uvicorn[standard]` も含まれ、高性能なサービングに必要な依存関係(例: `uvloop`)が含まれます。558* `fastapi-cli[standard]` - `fastapi` コマンドを提供します559    * これには `fastapi-cloud-cli` が含まれFastAPI アプリケーションを [FastAPI Cloud](https://fastapicloud.com) にデプロイできます。560561### `standard` 依存関係なし { #without-standard-dependencies }562563`standard` のオプション依存関係を含めたくない場合は`pip install "fastapi[standard]"` の代わりに `pip install fastapi` でインストールできます564565### `fastapi-cloud-cli` なし { #without-fastapi-cloud-cli }566567標準の依存関係を含めつつ `fastapi-cloud-cli` を除外して FastAPI をインストールしたい場合は`pip install "fastapi[standard-no-fastapi-cloud-cli]"` でインストールできます568569### 追加のオプション依存関係 { #additional-optional-dependencies }570571追加でインストールしたい依存関係があります572573追加のオプション Pydantic 依存関係:574575* [`pydantic-settings`](https://docs.pydantic.dev/latest/usage/pydantic_settings/) - 設定管理のため。576* [`pydantic-extra-types`](https://docs.pydantic.dev/latest/usage/types/extra_types/extra_types/) - Pydantic で使用する追加の型のため。577578追加のオプション FastAPI 依存関係:579580* [`orjson`](https://github.com/ijl/orjson) - `ORJSONResponse` を使用したい場合に必要です。581* [`ujson`](https://github.com/esnme/ultrajson) - `UJSONResponse` を使用したい場合に必要です。582583## ライセンス { #license }584585このプロジェクトは MIT ライセンスの条項の下でライセンスされています

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.