@@ -199,7 +199,7 @@ async def read_item(item_id: int, q: str | None = None):
**Note**:
-If you don't know, check the _"In a hurry?"_ section about
.
+If you don't know, check the _"In a hurry?"_ section about [`async` and `await` in the docs](https://fastapi.tiangolo.com/async/#in-a-hurry).
@@ -210,7 +210,7 @@ Run the server with:
```console
-$ fastapi dev main.py
+$ fastapi dev
╭────────── FastAPI CLI - Development mode ───────────╮
│ │
@@ -235,19 +235,19 @@ INFO: Application startup complete.
.
+Open your browser at [http://127.0.0.1:8000/items/5?q=somequery](http://127.0.0.1:8000/items/5?q=somequery).
You will see the JSON response as:
@@ -264,17 +264,17 @@ You already created an API that:
### Interactive API docs { #interactive-api-docs }
-Now go to
.
+Now go to [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs).
-You will see the automatic interactive API documentation (provided by
):
+You will see the automatic interactive API documentation (provided by [Swagger UI](https://github.com/swagger-api/swagger-ui)):

### Alternative API docs { #alternative-api-docs }
-And now, go to
.
+And now, go to [http://127.0.0.1:8000/redoc](http://127.0.0.1:8000/redoc).
-You will see the alternative automatic documentation (provided by
):
+You will see the alternative automatic documentation (provided by [ReDoc](https://github.com/Rebilly/ReDoc)):

@@ -316,7 +316,7 @@ The `fastapi dev` server should reload automatically.
### Interactive API docs upgrade { #interactive-api-docs-upgrade }
-Now go to
.
+Now go to [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs).
* The interactive API documentation will be automatically updated, including the new body:
@@ -332,7 +332,7 @@ Now go to
.
+And now, go to [http://127.0.0.1:8000/redoc](http://127.0.0.1:8000/redoc).
* The alternative documentation will also reflect the new query parameter and body:
@@ -442,7 +442,7 @@ For a more complete example including more features, see the
and other libraries.
+* **GraphQL** integration with [Strawberry](https://strawberry.rocks) and other libraries.
* Many extra features (thanks to Starlette) as:
* **WebSockets**
* extremely easy tests based on HTTPX and `pytest`
@@ -452,24 +452,10 @@ For a more complete example including more features, see the
, go and join the waiting list if you haven't. 🚀
+You can optionally deploy your FastAPI app to [FastAPI Cloud](https://fastapicloud.com), go and join the waiting list if you haven't. 🚀
If you already have a **FastAPI Cloud** account (we invited you from the waiting list 😉), you can deploy your application with one command.
-Before deploying, make sure you are logged in:
-
-
```console
@@ -488,7 +474,7 @@ That's it! Now you can access your app at that URL. ✨
#### About FastAPI Cloud { #about-fastapi-cloud }
-**
FastAPI Cloud** is built by the same author and team behind **FastAPI**.
+**[FastAPI Cloud](https://fastapicloud.com)** is built by the same author and team behind **FastAPI**.
It streamlines the process of **building**, **deploying**, and **accessing** an API with minimal effort.
@@ -504,9 +490,9 @@ Follow your cloud provider's guides to deploy FastAPI apps with them. 🤓
## Performance { #performance }
-Independent TechEmpower benchmarks show **FastAPI** applications running under Uvicorn as
one of the fastest Python frameworks available, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)
+Independent TechEmpower benchmarks show **FastAPI** applications running under Uvicorn as [one of the fastest Python frameworks available](https://www.techempower.com/benchmarks/#section=test&runid=7464e520-0dc2-473d-bd34-dbdfd7e85911&hw=ph&test=query&l=zijzen-7), only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)
-To understand more about it, see the section
Benchmarks.
+To understand more about it, see the section [Benchmarks](https://fastapi.tiangolo.com/benchmarks/).
## Dependencies { #dependencies }
@@ -518,19 +504,19 @@ When you install FastAPI with `pip install "fastapi[standard]"` it comes with th
Used by Pydantic:
-*
email-validator - for email validation.
+* [`email-validator`](https://github.com/JoshData/python-email-validator) - for email validation.
Used by Starlette:
-*
httpx - Required if you want to use the `TestClient`.
-*
jinja2 - Required if you want to use the default template configuration.
-*
python-multipart - Required if you want to support form
"parsing", with `request.form()`.
+* [`httpx`](https://www.python-httpx.org) - Required if you want to use the `TestClient`.
+* [`jinja2`](https://jinja.palletsprojects.com) - Required if you want to use the default template configuration.
+* [`python-multipart`](https://github.com/Kludex/python-multipart) - Required if you want to support form
"parsing", with `request.form()`.
Used by FastAPI:
-*
uvicorn - for the server that loads and serves your application. This includes `uvicorn[standard]`, which includes some dependencies (e.g. `uvloop`) needed for high performance serving.
+* [`uvicorn`](https://www.uvicorn.dev) - for the server that loads and serves your application. This includes `uvicorn[standard]`, which includes some dependencies (e.g. `uvloop`) needed for high performance serving.
* `fastapi-cli[standard]` - to provide the `fastapi` command.
- * This includes `fastapi-cloud-cli`, which allows you to deploy your FastAPI application to
FastAPI Cloud.
+ * This includes `fastapi-cloud-cli`, which allows you to deploy your FastAPI application to [FastAPI Cloud](https://fastapicloud.com).
### Without `standard` Dependencies { #without-standard-dependencies }
@@ -546,13 +532,13 @@ There are some additional dependencies you might want to install.
Additional optional Pydantic dependencies:
-*
pydantic-settings - for settings management.
-*
pydantic-extra-types - for extra types to be used with Pydantic.
+* [`pydantic-settings`](https://docs.pydantic.dev/latest/usage/pydantic_settings/) - for settings management.
+* [`pydantic-extra-types`](https://docs.pydantic.dev/latest/usage/types/extra_types/extra_types/) - for extra types to be used with Pydantic.
Additional optional FastAPI dependencies:
-*
orjson - Required if you want to use `ORJSONResponse`.
-*
ujson - Required if you want to use `UJSONResponse`.
+* [`orjson`](https://github.com/ijl/orjson) - Required if you want to use `ORJSONResponse`.
+* [`ujson`](https://github.com/esnme/ultrajson) - Required if you want to use `UJSONResponse`.
## License { #license }
diff --git a/docs/en/docs/js/custom.js b/docs/en/docs/js/custom.js
index be326d3029..311995d7cd 100644
--- a/docs/en/docs/js/custom.js
+++ b/docs/en/docs/js/custom.js
@@ -174,10 +174,38 @@ function handleSponsorImages() {
});
}
+function openLinksInNewTab() {
+ const siteUrl = document.querySelector("link[rel='canonical']")?.href
+ || window.location.origin;
+ const siteOrigin = new URL(siteUrl).origin;
+ document.querySelectorAll(".md-content a[href]").forEach(a => {
+ if (a.getAttribute("target") === "_self") return;
+ const href = a.getAttribute("href");
+ if (!href) return;
+ try {
+ const url = new URL(href, window.location.href);
+ // Skip same-page anchor links (only the hash differs)
+ if (url.origin === window.location.origin
+ && url.pathname === window.location.pathname
+ && url.search === window.location.search) return;
+ if (!a.hasAttribute("target")) {
+ a.setAttribute("target", "_blank");
+ a.setAttribute("rel", "noopener");
+ }
+ if (url.origin !== siteOrigin) {
+ a.dataset.externalLink = "";
+ } else {
+ a.dataset.internalLink = "";
+ }
+ } catch (_) {}
+ });
+}
+
async function main() {
setupTermynal();
showRandomAnnouncement('announce-left', 5000)
handleSponsorImages();
+ openLinksInNewTab();
}
document$.subscribe(() => {
main()
diff --git a/docs/en/docs/management-tasks.md b/docs/en/docs/management-tasks.md
index fc6e1eb280..e4094c4a18 100644
--- a/docs/en/docs/management-tasks.md
+++ b/docs/en/docs/management-tasks.md
@@ -1,6 +1,6 @@
# Repository Management Tasks
-These are the tasks that can be performed to manage the FastAPI repository by [team members](./fastapi-people.md#team){.internal-link target=_blank}.
+These are the tasks that can be performed to manage the FastAPI repository by [team members](./fastapi-people.md#team).
/// tip
@@ -8,9 +8,9 @@ This section is useful only to a handful of people, team members with permission
///
-...so, you are a [team member of FastAPI](./fastapi-people.md#team){.internal-link target=_blank}? Wow, you are so cool! 😎
+...so, you are a [team member of FastAPI](./fastapi-people.md#team)? Wow, you are so cool! 😎
-You can help with everything on [Help FastAPI - Get Help](./help-fastapi.md){.internal-link target=_blank} the same ways as external contributors. But additionally, there are some tasks that only you (as part of the team) can perform.
+You can help with everything on [Help FastAPI - Get Help](./help-fastapi.md) the same ways as external contributors. But additionally, there are some tasks that only you (as part of the team) can perform.
Here are the general instructions for the tasks you can perform.
@@ -40,7 +40,7 @@ For conversations that are more difficult, for example to reject a PR, you can a
## Edit PR Titles
-* Edit the PR title to start with an emoji from
gitmoji.
+* Edit the PR title to start with an emoji from [gitmoji](https://gitmoji.dev/).
* Use the emoji character, not the GitHub code. So, use `🐛` instead of `:bug:`. This is so that it shows up correctly outside of GitHub, for example in the release notes.
* For translations use the `🌐` emoji ("globe with meridians").
* Start the title with a verb. For example `Add`, `Refactor`, `Fix`, etc. This way the title will say the action that the PR does. Like `Add support for teleporting`, instead of `Teleporting wasn't working, so this PR fixes it`.
@@ -53,15 +53,15 @@ For conversations that are more difficult, for example to reject a PR, you can a
🌐 Add Spanish translation for `docs/es/docs/teleporting.md`
```
-Once the PR is merged, a GitHub Action (
latest-changes) will use the PR title to update the latest changes automatically.
+Once the PR is merged, a GitHub Action ([latest-changes](https://github.com/tiangolo/latest-changes)) will use the PR title to update the latest changes automatically.
So, having a nice PR title will not only look nice in GitHub, but also in the release notes. 📝
## Add Labels to PRs
-The same GitHub Action
latest-changes uses one label in the PR to decide the section in the release notes to put this PR in.
+The same GitHub Action [latest-changes](https://github.com/tiangolo/latest-changes) uses one label in the PR to decide the section in the release notes to put this PR in.
-Make sure you use a supported label from the
latest-changes list of labels:
+Make sure you use a supported label from the [latest-changes list of labels](https://github.com/tiangolo/latest-changes#using-labels):
* `breaking`: Breaking Changes
* Existing code will break if they update the version without changing their code. This rarely happens, so this label is not frequently used.
@@ -108,7 +108,7 @@ This way, we can notice when there are new translations ready, because they have
Translations are generated automatically with LLMs and scripts.
-There's one GitHub Action that can be manually run to add or update translations for a language:
`translate.yml`.
+There's one GitHub Action that can be manually run to add or update translations for a language: [`translate.yml`](https://github.com/fastapi/fastapi/actions/workflows/translate.yml).
For these language translation PRs, confirm that:
@@ -140,7 +140,7 @@ For these language translation PRs, confirm that:
## FastAPI People PRs
-Every month, a GitHub Action updates the FastAPI People data. Those PRs look like this one:
👥 Update FastAPI People.
+Every month, a GitHub Action updates the FastAPI People data. Those PRs look like this one: [👥 Update FastAPI People](https://github.com/fastapi/fastapi/pull/11669).
If the tests are passing, you can merge it right away.
@@ -155,4 +155,4 @@ Dependabot will create PRs to update dependencies for several things, and those
When a question in GitHub Discussions has been answered, mark the answer by clicking "Mark as answer".
-You can filter discussions by
`Questions` that are `Unanswered`.
+You can filter discussions by [`Questions` that are `Unanswered`](https://github.com/tiangolo/fastapi/discussions/categories/questions?discussions_q=category:Questions+is:open+is:unanswered).
diff --git a/docs/en/docs/management.md b/docs/en/docs/management.md
index 085a1756f8..7f20474f6d 100644
--- a/docs/en/docs/management.md
+++ b/docs/en/docs/management.md
@@ -4,15 +4,15 @@ Here's a short description of how the FastAPI repository is managed and maintain
## Owner
-I,
@tiangolo, am the creator and owner of the FastAPI repository. 🤓
+I, [@tiangolo](https://github.com/tiangolo), am the creator and owner of the FastAPI repository. 🤓
-I normally give the final review to each PR before merging them. I make the final decisions on the project, I'm the
BDFL. 😅
+I normally give the final review to each PR before merging them. I make the final decisions on the project, I'm the [
BDFL](https://en.wikipedia.org/wiki/Benevolent_dictator_for_life). 😅
## Team
There's a team of people that help manage and maintain the project. 😎
-They have different levels of permissions and [specific instructions](./management-tasks.md){.internal-link target=_blank}.
+They have different levels of permissions and [specific instructions](./management-tasks.md).
Some of the tasks they can perform include:
@@ -22,13 +22,13 @@ Some of the tasks they can perform include:
* Mark answers in GitHub Discussions questions, etc.
* Merge some specific types of PRs.
-You can see the current team members in [FastAPI People - Team](./fastapi-people.md#team){.internal-link target=_blank}.
+You can see the current team members in [FastAPI People - Team](./fastapi-people.md#team).
Joining the team is by invitation only, and I could update or remove permissions, instructions, or membership.
## FastAPI Experts
-The people that help others the most in GitHub Discussions can become [**FastAPI Experts**](./fastapi-people.md#fastapi-experts){.internal-link target=_blank}.
+The people that help others the most in GitHub Discussions can become [**FastAPI Experts**](./fastapi-people.md#fastapi-experts).
This is normally the best way to contribute to the project.
@@ -36,4 +36,4 @@ This is normally the best way to contribute to the project.
External contributions are very welcome and appreciated, including answering questions, submitting PRs, etc. 🙇♂️
-There are many ways to [help maintain FastAPI](./help-fastapi.md#help-maintain-fastapi){.internal-link target=_blank}.
+There are many ways to [help maintain FastAPI](./help-fastapi.md#help-maintain-fastapi).
diff --git a/docs/en/docs/project-generation.md b/docs/en/docs/project-generation.md
index 610d23ccb1..aa579af5ef 100644
--- a/docs/en/docs/project-generation.md
+++ b/docs/en/docs/project-generation.md
@@ -4,7 +4,7 @@ Templates, while typically come with a specific setup, are designed to be flexib
You can use this template to get started, as it includes a lot of the initial set up, security, database and some API endpoints already done for you.
-GitHub Repository:
Full Stack FastAPI Template
+GitHub Repository: [Full Stack FastAPI Template](https://github.com/tiangolo/full-stack-fastapi-template)
## Full Stack FastAPI Template - Technology Stack and Features { #full-stack-fastapi-template-technology-stack-and-features }
diff --git a/docs/en/docs/python-types.md b/docs/en/docs/python-types.md
index 90c32cec8c..0cddcd3902 100644
--- a/docs/en/docs/python-types.md
+++ b/docs/en/docs/python-types.md
@@ -269,7 +269,7 @@ It doesn't mean "`one_person` is the **class** called `Person`".
## Pydantic models { #pydantic-models }
-
Pydantic is a Python library to perform data validation.
+[Pydantic](https://docs.pydantic.dev/) is a Python library to perform data validation.
You declare the "shape" of the data as classes with attributes.
@@ -285,13 +285,13 @@ An example from the official Pydantic docs:
/// info
-To learn more about
Pydantic, check its docs.
+To learn more about [Pydantic, check its docs](https://docs.pydantic.dev/).
///
**FastAPI** is all based on Pydantic.
-You will see a lot more of all this in practice in the [Tutorial - User Guide](tutorial/index.md){.internal-link target=_blank}.
+You will see a lot more of all this in practice in the [Tutorial - User Guide](tutorial/index.md).
## Type Hints with Metadata Annotations { #type-hints-with-metadata-annotations }
@@ -337,12 +337,12 @@ With **FastAPI** you declare parameters with type hints and you get:
* **Document** the API using OpenAPI:
* which is then used by the automatic interactive documentation user interfaces.
-This might all sound abstract. Don't worry. You'll see all this in action in the [Tutorial - User Guide](tutorial/index.md){.internal-link target=_blank}.
+This might all sound abstract. Don't worry. You'll see all this in action in the [Tutorial - User Guide](tutorial/index.md).
The important thing is that by using standard Python types, in a single place (instead of adding more classes, decorators, etc), **FastAPI** will do a lot of the work for you.
/// info
-If you already went through all the tutorial and came back to see more about types, a good resource is
the "cheat sheet" from `mypy`.
+If you already went through all the tutorial and came back to see more about types, a good resource is [the "cheat sheet" from `mypy`](https://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html).
///
diff --git a/docs/en/docs/reference/responses.md b/docs/en/docs/reference/responses.md
index bd57861294..2df53e9701 100644
--- a/docs/en/docs/reference/responses.md
+++ b/docs/en/docs/reference/responses.md
@@ -22,7 +22,13 @@ from fastapi.responses import (
## FastAPI Responses
-There are a couple of custom FastAPI response classes, you can use them to optimize JSON performance.
+There were a couple of custom FastAPI response classes that were intended to optimize JSON performance.
+
+However, they are now deprecated as you will now get better performance by using a [Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/).
+
+That way, Pydantic will serialize the data into JSON bytes on the Rust side, which will achieve better performance than these custom JSON responses.
+
+Read more about it in [Custom Response - HTML, Stream, File, others - `orjson` or Response Model](https://fastapi.tiangolo.com/advanced/custom-response/#orjson-or-response-model).
::: fastapi.responses.UJSONResponse
options:
diff --git a/docs/en/docs/release-notes.md b/docs/en/docs/release-notes.md
index 34492bfc58..f7b4c0891c 100644
--- a/docs/en/docs/release-notes.md
+++ b/docs/en/docs/release-notes.md
@@ -9,11 +9,153 @@ hide:
### Docs
+* 📝 Add docs for `pyproject.toml` with `entrypoint`. PR [#15075](https://github.com/fastapi/fastapi/pull/15075) by [@tiangolo](https://github.com/tiangolo).
+* 📝 Update links in docs to no longer use the classes external-link and internal-link. PR [#15061](https://github.com/fastapi/fastapi/pull/15061) by [@tiangolo](https://github.com/tiangolo).
+* 🔨 Add JS and CSS handling for automatic `target=_blank` for links in docs. PR [#15063](https://github.com/fastapi/fastapi/pull/15063) by [@tiangolo](https://github.com/tiangolo).
+* 💄 Update styles for internal and external links in new tab. PR [#15058](https://github.com/fastapi/fastapi/pull/15058) by [@tiangolo](https://github.com/tiangolo).
+* 📝 Add documentation for the FastAPI VS Code extension. PR [#15008](https://github.com/fastapi/fastapi/pull/15008) by [@savannahostrowski](https://github.com/savannahostrowski).
+* 📝 Fix doctrings for `max_digits` and `decimal_places`. PR [#14944](https://github.com/fastapi/fastapi/pull/14944) by [@YuriiMotov](https://github.com/YuriiMotov).
+* 📝 Add dates to release notes. PR [#15001](https://github.com/fastapi/fastapi/pull/15001) by [@YuriiMotov](https://github.com/YuriiMotov).
+
+### Internal
+
+* 🔨 Update script to autofix permalinks to account for headers with Markdown links. PR [#15062](https://github.com/fastapi/fastapi/pull/15062) by [@tiangolo](https://github.com/tiangolo).
+* 📌 Pin Click for MkDocs live reload. PR [#15057](https://github.com/fastapi/fastapi/pull/15057) by [@tiangolo](https://github.com/tiangolo).
+* ⬆ Bump werkzeug from 3.1.5 to 3.1.6. PR [#14948](https://github.com/fastapi/fastapi/pull/14948) by [@dependabot[bot]](https://github.com/apps/dependabot).
+* ⬆ Bump pydantic-ai from 1.62.0 to 1.63.0. PR [#15035](https://github.com/fastapi/fastapi/pull/15035) by [@dependabot[bot]](https://github.com/apps/dependabot).
+* ⬆ Bump pytest-codspeed from 4.2.0 to 4.3.0. PR [#15034](https://github.com/fastapi/fastapi/pull/15034) by [@dependabot[bot]](https://github.com/apps/dependabot).
+* ⬆ Bump strawberry-graphql from 0.291.2 to 0.307.1. PR [#15033](https://github.com/fastapi/fastapi/pull/15033) by [@dependabot[bot]](https://github.com/apps/dependabot).
+* ⬆ Bump typer from 0.21.1 to 0.24.1. PR [#15032](https://github.com/fastapi/fastapi/pull/15032) by [@dependabot[bot]](https://github.com/apps/dependabot).
+* ⬆ Bump actions/download-artifact from 7 to 8. PR [#15020](https://github.com/fastapi/fastapi/pull/15020) by [@dependabot[bot]](https://github.com/apps/dependabot).
+* ⬆ Bump actions/upload-artifact from 6 to 7. PR [#15019](https://github.com/fastapi/fastapi/pull/15019) by [@dependabot[bot]](https://github.com/apps/dependabot).
+
+## 0.135.1
+
+### Fixes
+
+* 🐛 Fix, avoid yield from a TaskGroup, only as an async context manager, closed in the request async exit stack. PR [#15038](https://github.com/fastapi/fastapi/pull/15038) by [@tiangolo](https://github.com/tiangolo).
+
+### Docs
+
+* ✏️ Fix typo in `docs/en/docs/_llm-test.md`. PR [#15007](https://github.com/fastapi/fastapi/pull/15007) by [@adityagiri3600](https://github.com/adityagiri3600).
+* 📝 Update Skill, optimize context, trim and refactor into references. PR [#15031](https://github.com/fastapi/fastapi/pull/15031) by [@tiangolo](https://github.com/tiangolo).
+
+### Internal
+
+* 👥 Update FastAPI People - Experts. PR [#15037](https://github.com/fastapi/fastapi/pull/15037) by [@tiangolo](https://github.com/tiangolo).
+* 👥 Update FastAPI People - Contributors and Translators. PR [#15029](https://github.com/fastapi/fastapi/pull/15029) by [@tiangolo](https://github.com/tiangolo).
+* 👥 Update FastAPI GitHub topic repositories. PR [#15036](https://github.com/fastapi/fastapi/pull/15036) by [@tiangolo](https://github.com/tiangolo).
+
+## 0.135.0
+
+### Features
+
+* ✨ Add support for Server Sent Events. PR [#15030](https://github.com/fastapi/fastapi/pull/15030) by [@tiangolo](https://github.com/tiangolo).
+ * New docs: [Server-Sent Events (SSE)](https://fastapi.tiangolo.com/tutorial/server-sent-events/).
+
+## 0.134.0
+
+### Features
+
+* ✨ Add support for streaming JSON Lines and binary data with `yield`. PR [#15022](https://github.com/fastapi/fastapi/pull/15022) by [@tiangolo](https://github.com/tiangolo).
+ * This also upgrades Starlette from `>=0.40.0` to `>=0.46.0`, as it's needed to properly unrwap and re-raise exceptions from exception groups.
+ * New docs: [Stream JSON Lines](https://fastapi.tiangolo.com/tutorial/stream-json-lines/).
+ * And new docs: [Stream Data](https://fastapi.tiangolo.com/advanced/stream-data/).
+
+### Docs
+
+* 📝 Update Library Agent Skill with streaming responses. PR [#15024](https://github.com/fastapi/fastapi/pull/15024) by [@tiangolo](https://github.com/tiangolo).
+* 📝 Update docs for responses and new stream with `yield`. PR [#15023](https://github.com/fastapi/fastapi/pull/15023) by [@tiangolo](https://github.com/tiangolo).
+* 📝 Add `await` in `StreamingResponse` code example to allow cancellation. PR [#14681](https://github.com/fastapi/fastapi/pull/14681) by [@casperdcl](https://github.com/casperdcl).
+* 📝 Rename `docs_src/websockets` to `docs_src/websockets_` to avoid import errors. PR [#14979](https://github.com/fastapi/fastapi/pull/14979) by [@YuriiMotov](https://github.com/YuriiMotov).
+
+### Internal
+
+* 🔨 Run tests with `pytest-xdist` and `pytest-cov`. PR [#14992](https://github.com/fastapi/fastapi/pull/14992) by [@YuriiMotov](https://github.com/YuriiMotov).
+
+## 0.133.1
+
+### Features
+
+* 🔧 Add FastAPI Agents Skill. PR [#14982](https://github.com/fastapi/fastapi/pull/14982) by [@tiangolo](https://github.com/tiangolo).
+ * Read more about it in [Library Agent Skills](https://tiangolo.com/ideas/library-agent-skills/).
+
+### Internal
+
+* ✅ Fix all tests are skipped on Windows. PR [#14994](https://github.com/fastapi/fastapi/pull/14994) by [@YuriiMotov](https://github.com/YuriiMotov).
+
+## 0.133.0 (2026-02-24)
+
+### Upgrades
+
+* ⬆️ Add support for Starlette 1.0.0+. PR [#14987](https://github.com/fastapi/fastapi/pull/14987) by [@tiangolo](https://github.com/tiangolo).
+
+## 0.132.1 (2026-02-24)
+
+### Refactors
+
+* ♻️ Refactor logic to handle OpenAPI and Swagger UI escaping data. PR [#14986](https://github.com/fastapi/fastapi/pull/14986) by [@tiangolo](https://github.com/tiangolo).
+
+### Internal
+
+* 👥 Update FastAPI People - Experts. PR [#14972](https://github.com/fastapi/fastapi/pull/14972) by [@tiangolo](https://github.com/tiangolo).
+* 👷 Allow skipping `benchmark` job in `test` workflow. PR [#14974](https://github.com/fastapi/fastapi/pull/14974) by [@YuriiMotov](https://github.com/YuriiMotov).
+
+## 0.132.0 (2026-02-23)
+
+### Breaking Changes
+
+* 🔒️ Add `strict_content_type` checking for JSON requests. PR [#14978](https://github.com/fastapi/fastapi/pull/14978) by [@tiangolo](https://github.com/tiangolo).
+ * Now FastAPI checks, by default, that JSON requests have a `Content-Type` header with a valid JSON value, like `application/json`, and rejects requests that don't.
+ * If the clients for your app don't send a valid `Content-Type` header you can disable this with `strict_content_type=False`.
+ * Check the new docs: [Strict Content-Type Checking](https://fastapi.tiangolo.com/advanced/strict-content-type/).
+
+### Internal
+
+* ⬆ Bump flask from 3.1.2 to 3.1.3. PR [#14949](https://github.com/fastapi/fastapi/pull/14949) by [@dependabot[bot]](https://github.com/apps/dependabot).
+* ⬆ Update all dependencies to use `griffelib` instead of `griffe`. PR [#14973](https://github.com/fastapi/fastapi/pull/14973) by [@svlandeg](https://github.com/svlandeg).
+* 🔨 Fix `FastAPI People` workflow. PR [#14951](https://github.com/fastapi/fastapi/pull/14951) by [@YuriiMotov](https://github.com/YuriiMotov).
+* 👷 Do not run codspeed with coverage as it's not tracked. PR [#14966](https://github.com/fastapi/fastapi/pull/14966) by [@tiangolo](https://github.com/tiangolo).
+* 👷 Do not include benchmark tests in coverage to speed up coverage processing. PR [#14965](https://github.com/fastapi/fastapi/pull/14965) by [@tiangolo](https://github.com/tiangolo).
+
+## 0.131.0 (2026-02-22)
+
+### Breaking Changes
+
+* 🗑️ Deprecate `ORJSONResponse` and `UJSONResponse`. PR [#14964](https://github.com/fastapi/fastapi/pull/14964) by [@tiangolo](https://github.com/tiangolo).
+
+## 0.130.0 (2026-02-22)
+
+### Features
+
+* ✨ Serialize JSON response with Pydantic (in Rust), when there's a Pydantic return type or response model. PR [#14962](https://github.com/fastapi/fastapi/pull/14962) by [@tiangolo](https://github.com/tiangolo).
+ * This results in 2x (or more) performance increase for JSON responses.
+ * New docs: [Custom Response - JSON Performance](https://fastapi.tiangolo.com/advanced/custom-response/#json-performance).
+
+## 0.129.2 (2026-02-21)
+
+### Internal
+
+* ⬆️ Upgrade pytest. PR [#14959](https://github.com/fastapi/fastapi/pull/14959) by [@tiangolo](https://github.com/tiangolo).
+* 👷 Fix CI, do not attempt to publish `fastapi-slim`. PR [#14958](https://github.com/fastapi/fastapi/pull/14958) by [@tiangolo](https://github.com/tiangolo).
+* ➖ Drop support for `fastapi-slim`, no more versions will be released, use only `"fastapi[standard]"` or `fastapi`. PR [#14957](https://github.com/fastapi/fastapi/pull/14957) by [@tiangolo](https://github.com/tiangolo).
+* 🔧 Update pyproject.toml, remove unneeded lines. PR [#14956](https://github.com/fastapi/fastapi/pull/14956) by [@tiangolo](https://github.com/tiangolo).
+
+## 0.129.1 (2026-02-21)
+
+### Fixes
+
+* ♻️ Fix JSON Schema for bytes, use `"contentMediaType": "application/octet-stream"` instead of `"format": "binary"`. PR [#14953](https://github.com/fastapi/fastapi/pull/14953) by [@tiangolo](https://github.com/tiangolo).
+
+### Docs
+
+* 🔨 Add Kapa.ai widget (AI chatbot). PR [#14938](https://github.com/fastapi/fastapi/pull/14938) by [@tiangolo](https://github.com/tiangolo).
* 🔥 Remove Python 3.9 specific files, no longer needed after updating translations. PR [#14931](https://github.com/fastapi/fastapi/pull/14931) by [@tiangolo](https://github.com/tiangolo).
* 📝 Update docs for JWT to prevent timing attacks. PR [#14908](https://github.com/fastapi/fastapi/pull/14908) by [@tiangolo](https://github.com/tiangolo).
### Translations
+* ✏️ Fix several typos in ru translations. PR [#14934](https://github.com/fastapi/fastapi/pull/14934) by [@argoarsiks](https://github.com/argoarsiks).
* 🌐 Update translations for ko (update-all and add-missing). PR [#14923](https://github.com/fastapi/fastapi/pull/14923) by [@YuriiMotov](https://github.com/YuriiMotov).
* 🌐 Update translations for uk (add-missing). PR [#14922](https://github.com/fastapi/fastapi/pull/14922) by [@YuriiMotov](https://github.com/YuriiMotov).
* 🌐 Update translations for zh-hant (update-all and add-missing). PR [#14921](https://github.com/fastapi/fastapi/pull/14921) by [@YuriiMotov](https://github.com/YuriiMotov).
@@ -29,11 +171,12 @@ hide:
### Internal
+* 👷 Always run tests on push to `master` branch and when run by scheduler. PR [#14940](https://github.com/fastapi/fastapi/pull/14940) by [@YuriiMotov](https://github.com/YuriiMotov).
* 🎨 Upgrade typing syntax for Python 3.10. PR [#14932](https://github.com/fastapi/fastapi/pull/14932) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump cryptography from 46.0.4 to 46.0.5. PR [#14892](https://github.com/fastapi/fastapi/pull/14892) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump pillow from 12.1.0 to 12.1.1. PR [#14899](https://github.com/fastapi/fastapi/pull/14899) by [@dependabot[bot]](https://github.com/apps/dependabot).
-## 0.129.0
+## 0.129.0 (2026-02-12)
### Breaking Changes
@@ -52,7 +195,7 @@ hide:
* 🔨 Update docs.py scripts to migrate Python 3.9 to Python 3.10. PR [#14906](https://github.com/fastapi/fastapi/pull/14906) by [@tiangolo](https://github.com/tiangolo).
-## 0.128.8
+## 0.128.8 (2026-02-11)
### Docs
@@ -63,7 +206,7 @@ hide:
* 🔨 Tweak PDM hook script. PR [#14895](https://github.com/fastapi/fastapi/pull/14895) by [@tiangolo](https://github.com/tiangolo).
* ♻️ Update build setup for `fastapi-slim`, deprecate it, and make it only depend on `fastapi`. PR [#14894](https://github.com/fastapi/fastapi/pull/14894) by [@tiangolo](https://github.com/tiangolo).
-## 0.128.7
+## 0.128.7 (2026-02-10)
### Features
@@ -85,7 +228,7 @@ hide:
* ✅ Test order for the submitted byte Files. PR [#14828](https://github.com/fastapi/fastapi/pull/14828) by [@valentinDruzhinin](https://github.com/valentinDruzhinin).
* 🔧 Configure `test` workflow to run tests with `inline-snapshot=review`. PR [#14876](https://github.com/fastapi/fastapi/pull/14876) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.128.6
+## 0.128.6 (2026-02-09)
### Fixes
@@ -99,7 +242,7 @@ hide:
* ✅ Fix parameterized tests with snapshots. PR [#14875](https://github.com/fastapi/fastapi/pull/14875) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.128.5
+## 0.128.5 (2026-02-08)
### Refactors
@@ -109,7 +252,7 @@ hide:
* ✅ Add inline snapshot tests for OpenAPI before changes from Pydantic v2. PR [#14864](https://github.com/fastapi/fastapi/pull/14864) by [@tiangolo](https://github.com/tiangolo).
-## 0.128.4
+## 0.128.4 (2026-02-07)
### Refactors
@@ -126,7 +269,7 @@ hide:
* ⬆️ Upgrade development dependencies. PR [#14854](https://github.com/fastapi/fastapi/pull/14854) by [@tiangolo](https://github.com/tiangolo).
-## 0.128.3
+## 0.128.3 (2026-02-06)
### Refactors
@@ -145,7 +288,7 @@ hide:
* 👷 Run tests with Starlette from git. PR [#14849](https://github.com/fastapi/fastapi/pull/14849) by [@tiangolo](https://github.com/tiangolo).
* 👷 Run tests with lower bound uv sync, upgrade `fastapi[all]` minimum dependencies: `ujson >=5.8.0`, `orjson >=3.9.3`. PR [#14846](https://github.com/fastapi/fastapi/pull/14846) by [@tiangolo](https://github.com/tiangolo).
-## 0.128.2
+## 0.128.2 (2026-02-05)
### Features
@@ -181,7 +324,7 @@ hide:
* 🔨 Add max pages to translate to configs. PR [#14840](https://github.com/fastapi/fastapi/pull/14840) by [@tiangolo](https://github.com/tiangolo).
-## 0.128.1
+## 0.128.1 (2026-02-04)
### Features
@@ -281,7 +424,7 @@ hide:
* 🔥 Remove test variants for Pydantic v1 in test_request_params. PR [#14612](https://github.com/fastapi/fastapi/pull/14612) by [@tiangolo](https://github.com/tiangolo).
* 🔥 Remove Pydantic v1 specific test variants. PR [#14611](https://github.com/fastapi/fastapi/pull/14611) by [@tiangolo](https://github.com/tiangolo).
-## 0.128.0
+## 0.128.0 (2025-12-27)
### Breaking Changes
@@ -291,7 +434,7 @@ hide:
* ✅ Run performance tests only on Pydantic v2. PR [#14608](https://github.com/fastapi/fastapi/pull/14608) by [@tiangolo](https://github.com/tiangolo).
-## 0.127.1
+## 0.127.1 (2025-12-26)
### Refactors
@@ -315,7 +458,7 @@ hide:
* 👷 Run CodSpeed tests in parallel to other tests to speed up CI. PR [#14586](https://github.com/fastapi/fastapi/pull/14586) by [@tiangolo](https://github.com/tiangolo).
* 🔨 Update scripts and pre-commit to autofix files. PR [#14585](https://github.com/fastapi/fastapi/pull/14585) by [@tiangolo](https://github.com/tiangolo).
-## 0.127.0
+## 0.127.0 (2025-12-21)
### Breaking Changes
@@ -330,7 +473,7 @@ hide:
* ⬆️ Upgrade OpenAI model for translations to gpt-5.2. PR [#14579](https://github.com/fastapi/fastapi/pull/14579) by [@tiangolo](https://github.com/tiangolo).
-## 0.126.0
+## 0.126.0 (2025-12-20)
### Upgrades
@@ -352,7 +495,7 @@ hide:
* ⬆️ Use prek as a pre-commit alternative. PR [#14572](https://github.com/fastapi/fastapi/pull/14572) by [@tiangolo](https://github.com/tiangolo).
* 👷 Add performance tests with CodSpeed. PR [#14558](https://github.com/fastapi/fastapi/pull/14558) by [@tiangolo](https://github.com/tiangolo).
-## 0.125.0
+## 0.125.0 (2025-12-17)
### Breaking Changes
@@ -396,13 +539,13 @@ hide:
* 👷 Update github-actions user for GitHub Actions workflows. PR [#14528](https://github.com/fastapi/fastapi/pull/14528) by [@tiangolo](https://github.com/tiangolo).
* ➕ Add requirements for translations. PR [#14515](https://github.com/fastapi/fastapi/pull/14515) by [@tiangolo](https://github.com/tiangolo).
-## 0.124.4
+## 0.124.4 (2025-12-12)
### Fixes
* 🐛 Fix parameter aliases. PR [#14371](https://github.com/fastapi/fastapi/pull/14371) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.124.3
+## 0.124.3 (2025-12-12)
### Fixes
@@ -428,13 +571,13 @@ hide:
* 👷 Tweak coverage to not pass Smokeshow max file size limit. PR [#14507](https://github.com/fastapi/fastapi/pull/14507) by [@tiangolo](https://github.com/tiangolo).
* ✅ Expand test matrix to include Windows and MacOS. PR [#14171](https://github.com/fastapi/fastapi/pull/14171) by [@svlandeg](https://github.com/svlandeg).
-## 0.124.2
+## 0.124.2 (2025-12-10)
### Fixes
* 🐛 Fix support for `if TYPE_CHECKING`, non-evaluated stringified annotations. PR [#14485](https://github.com/fastapi/fastapi/pull/14485) by [@tiangolo](https://github.com/tiangolo).
-## 0.124.1
+## 0.124.1 (2025-12-10)
### Fixes
@@ -449,7 +592,7 @@ hide:
* ✅ Add test for Pydantic v2, dataclasses, UUID, and `__annotations__`. PR [#14477](https://github.com/fastapi/fastapi/pull/14477) by [@tiangolo](https://github.com/tiangolo).
-## 0.124.0
+## 0.124.0 (2025-12-06)
### Features
@@ -459,38 +602,38 @@ hide:
* ✏️ Fix typo in `scripts/mkdocs_hooks.py`. PR [#14457](https://github.com/fastapi/fastapi/pull/14457) by [@yujiteshima](https://github.com/yujiteshima).
-## 0.123.10
+## 0.123.10 (2025-12-05)
### Fixes
* 🐛 Fix using class (not instance) dependency that has `__call__` method. PR [#14458](https://github.com/fastapi/fastapi/pull/14458) by [@YuriiMotov](https://github.com/YuriiMotov).
* 🐛 Fix `separate_input_output_schemas=False` with `computed_field`. PR [#14453](https://github.com/fastapi/fastapi/pull/14453) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.123.9
+## 0.123.9 (2025-12-04)
### Fixes
* 🐛 Fix OAuth2 scopes in OpenAPI in extra corner cases, parent dependency with scopes, sub-dependency security scheme without scopes. PR [#14459](https://github.com/fastapi/fastapi/pull/14459) by [@tiangolo](https://github.com/tiangolo).
-## 0.123.8
+## 0.123.8 (2025-12-04)
### Fixes
* 🐛 Fix OpenAPI security scheme OAuth2 scopes declaration, deduplicate security schemes with different scopes. PR [#14455](https://github.com/fastapi/fastapi/pull/14455) by [@tiangolo](https://github.com/tiangolo).
-## 0.123.7
+## 0.123.7 (2025-12-04)
### Fixes
* 🐛 Fix evaluating stringified annotations in Python 3.10. PR [#11355](https://github.com/fastapi/fastapi/pull/11355) by [@chaen](https://github.com/chaen).
-## 0.123.6
+## 0.123.6 (2025-12-04)
### Fixes
* 🐛 Fix support for functools wraps and partial combined, for async and regular functions and classes in path operations and dependencies. PR [#14448](https://github.com/fastapi/fastapi/pull/14448) by [@tiangolo](https://github.com/tiangolo).
-## 0.123.5
+## 0.123.5 (2025-12-02)
### Features
@@ -511,7 +654,7 @@ hide:
* 🌐 Sync German docs. PR [#14367](https://github.com/fastapi/fastapi/pull/14367) by [@nilslindemann](https://github.com/nilslindemann).
-## 0.123.4
+## 0.123.4 (2025-12-02)
### Fixes
@@ -521,14 +664,14 @@ hide:
* 📝 Fix docstring of `servers` parameter. PR [#14405](https://github.com/fastapi/fastapi/pull/14405) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.123.3
+## 0.123.3 (2025-12-02)
### Fixes
* 🐛 Fix Query\Header\Cookie parameter model alias. PR [#14360](https://github.com/fastapi/fastapi/pull/14360) by [@YuriiMotov](https://github.com/YuriiMotov).
* 🐛 Fix optional sequence handling in `serialize sequence value` with Pydantic V2. PR [#14297](https://github.com/fastapi/fastapi/pull/14297) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.123.2
+## 0.123.2 (2025-12-02)
### Fixes
@@ -543,7 +686,7 @@ hide:
* 📝 Update Primary Key notes for the SQL databases tutorial to avoid confusion. PR [#14120](https://github.com/fastapi/fastapi/pull/14120) by [@FlaviusRaducu](https://github.com/FlaviusRaducu).
* 📝 Clarify estimation note in documentation. PR [#14070](https://github.com/fastapi/fastapi/pull/14070) by [@SaisakthiM](https://github.com/SaisakthiM).
-## 0.123.1
+## 0.123.1 (2025-12-02)
### Fixes
@@ -559,13 +702,13 @@ hide:
* 👥 Update FastAPI People - Sponsors. PR [#14422](https://github.com/fastapi/fastapi/pull/14422) by [@tiangolo](https://github.com/tiangolo).
* 👥 Update FastAPI People - Contributors and Translators. PR [#14420](https://github.com/fastapi/fastapi/pull/14420) by [@tiangolo](https://github.com/tiangolo).
-## 0.123.0
+## 0.123.0 (2025-11-30)
### Fixes
* 🐛 Cache dependencies that don't use scopes and don't have sub-dependencies with scopes. PR [#14419](https://github.com/fastapi/fastapi/pull/14419) by [@tiangolo](https://github.com/tiangolo).
-## 0.122.1
+## 0.122.1 (2025-11-30)
### Fixes
@@ -579,7 +722,7 @@ hide:
* ⬆ Bump markdown-include-variants from 0.0.5 to 0.0.6. PR [#14418](https://github.com/fastapi/fastapi/pull/14418) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.122.0
+## 0.122.0 (2025-11-24)
### Fixes
@@ -597,7 +740,7 @@ hide:
* 🛠️ Add `add-permalinks` and `add-permalinks-page` to `scripts/docs.py`. PR [#14033](https://github.com/fastapi/fastapi/pull/14033) by [@YuriiMotov](https://github.com/YuriiMotov).
* 🔧 Upgrade Material for MkDocs and remove insiders. PR [#14375](https://github.com/fastapi/fastapi/pull/14375) by [@tiangolo](https://github.com/tiangolo).
-## 0.121.3
+## 0.121.3 (2025-11-19)
### Refactors
@@ -613,7 +756,7 @@ hide:
* 📝 Fix typos in code comments. PR [#14364](https://github.com/fastapi/fastapi/pull/14364) by [@Edge-Seven](https://github.com/Edge-Seven).
* 📝 Add docs for using FastAPI Cloud. PR [#14359](https://github.com/fastapi/fastapi/pull/14359) by [@tiangolo](https://github.com/tiangolo).
-## 0.121.2
+## 0.121.2 (2025-11-13)
### Fixes
@@ -631,7 +774,7 @@ hide:
* 🌐 Sync Russian docs. PR [#14331](https://github.com/fastapi/fastapi/pull/14331) by [@YuriiMotov](https://github.com/YuriiMotov).
* 🌐 Sync German docs. PR [#14317](https://github.com/fastapi/fastapi/pull/14317) by [@nilslindemann](https://github.com/nilslindemann).
-## 0.121.1
+## 0.121.1 (2025-11-08)
### Fixes
@@ -646,7 +789,7 @@ hide:
* ⬆ Bump ruff from 0.13.2 to 0.14.3. PR [#14276](https://github.com/fastapi/fastapi/pull/14276) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#14289](https://github.com/fastapi/fastapi/pull/14289) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
-## 0.121.0
+## 0.121.0 (2025-11-03)
### Features
@@ -661,13 +804,13 @@ hide:
* ⬆ Bump mkdocs-macros-plugin from 1.4.0 to 1.4.1. PR [#14277](https://github.com/fastapi/fastapi/pull/14277) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocstrings[python] from 0.26.1 to 0.30.1. PR [#14279](https://github.com/fastapi/fastapi/pull/14279) by [@dependabot[bot]](https://github.com/apps/dependabot).
-## 0.120.4
+## 0.120.4 (2025-10-31)
### Fixes
* 🐛 Fix security schemes in OpenAPI when added at the top level app. PR [#14266](https://github.com/fastapi/fastapi/pull/14266) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.120.3
+## 0.120.3 (2025-10-30)
### Refactors
@@ -679,7 +822,7 @@ hide:
* 📝 Update note for untranslated pages. PR [#14257](https://github.com/fastapi/fastapi/pull/14257) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.120.2
+## 0.120.2 (2025-10-29)
### Fixes
@@ -692,7 +835,7 @@ hide:
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#14237](https://github.com/fastapi/fastapi/pull/14237) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump actions/upload-artifact from 4 to 5. PR [#14235](https://github.com/fastapi/fastapi/pull/14235) by [@dependabot[bot]](https://github.com/apps/dependabot).
-## 0.120.1
+## 0.120.1 (2025-10-27)
### Upgrades
@@ -702,7 +845,7 @@ hide:
* 🔧 Add `license` and `license-files` to `pyproject.toml`, remove `License` from `classifiers`. PR [#14230](https://github.com/fastapi/fastapi/pull/14230) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.120.0
+## 0.120.0 (2025-10-23)
There are no major nor breaking changes in this release. ☕️
@@ -722,7 +865,7 @@ This new version `0.120.0` only contains that transition to the new home package
* 🛠️ Update German LLM prompt and test file. PR [#14189](https://github.com/fastapi/fastapi/pull/14189) by [@nilslindemann](https://github.com/nilslindemann).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#14181](https://github.com/fastapi/fastapi/pull/14181) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
-## 0.119.1
+## 0.119.1 (2025-10-20)
### Fixes
@@ -737,7 +880,7 @@ This new version `0.120.0` only contains that transition to the new home package
* 🔧 Add sponsor Requestly. PR [#14205](https://github.com/fastapi/fastapi/pull/14205) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Configure reminder for `waiting` label in `issue-manager`. PR [#14156](https://github.com/fastapi/fastapi/pull/14156) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.119.0
+## 0.119.0 (2025-10-11)
FastAPI now (temporarily) supports both Pydantic v2 models and `pydantic.v1` models at the same time in the same app, to make it easier for any FastAPI apps still using Pydantic v1 to gradually but quickly **migrate to Pydantic v2**.
@@ -777,13 +920,13 @@ You can read in the docs more about how to [Migrate from Pydantic v1 to Pydantic
* ✨ Add support for `from pydantic.v1 import BaseModel`, mixed Pydantic v1 and v2 models in the same app. PR [#14168](https://github.com/fastapi/fastapi/pull/14168) by [@tiangolo](https://github.com/tiangolo).
-## 0.118.3
+## 0.118.3 (2025-10-10)
### Upgrades
* ⬆️ Add support for Python 3.14. PR [#14165](https://github.com/fastapi/fastapi/pull/14165) by [@svlandeg](https://github.com/svlandeg).
-## 0.118.2
+## 0.118.2 (2025-10-08)
### Fixes
@@ -793,7 +936,7 @@ You can read in the docs more about how to [Migrate from Pydantic v1 to Pydantic
* ⬆ Bump astral-sh/setup-uv from 6 to 7. PR [#14167](https://github.com/fastapi/fastapi/pull/14167) by [@dependabot[bot]](https://github.com/apps/dependabot).
-## 0.118.1
+## 0.118.1 (2025-10-08)
### Upgrades
@@ -828,7 +971,7 @@ You can read in the docs more about how to [Migrate from Pydantic v1 to Pydantic
* 👷 Update docs previews comment, single comment, add failure status. PR [#14129](https://github.com/fastapi/fastapi/pull/14129) by [@tiangolo](https://github.com/tiangolo).
* 🔨 Modify `mkdocs_hooks.py` to add `title` to page's metadata (remove permalinks in social cards). PR [#14125](https://github.com/fastapi/fastapi/pull/14125) by [@YuriiMotov](https://github.com/YuriiMotov).
-## 0.118.0
+## 0.118.0 (2025-09-29)
### Fixes
@@ -861,13 +1004,13 @@ You can read more about it in the docs for [Advanced Dependencies - Dependencies
* 🐛 Fix sponsor display issue by hiding element on image error. PR [#14097](https://github.com/fastapi/fastapi/pull/14097) by [@alejsdev](https://github.com/alejsdev).
* 🐛 Hide sponsor badge when sponsor image is not displayed. PR [#14096](https://github.com/fastapi/fastapi/pull/14096) by [@alejsdev](https://github.com/alejsdev).
-## 0.117.1
+## 0.117.1 (2025-09-20)
### Fixes
* 🐛 Fix validation error when `File` is declared after `Form` parameter. PR [#11194](https://github.com/fastapi/fastapi/pull/11194) by [@thomasleveil](https://github.com/thomasleveil).
-## 0.117.0
+## 0.117.0 (2025-09-20)
### Features
@@ -908,7 +1051,7 @@ You can read more about it in the docs for [Advanced Dependencies - Dependencies
* 🛠️ Update `docs.py generate-readme` command to remove permalinks from headers. PR [#14055](https://github.com/fastapi/fastapi/pull/14055) by [@YuriiMotov](https://github.com/YuriiMotov).
* ⬆️ Update mypy to 1.14.1. PR [#12970](https://github.com/fastapi/fastapi/pull/12970) by [@tamird](https://github.com/tamird).
-## 0.116.2
+## 0.116.2 (2025-09-16)
### Upgrades
@@ -989,7 +1132,7 @@ You can read more about it in the docs for [Advanced Dependencies - Dependencies
* 👥 Update FastAPI People - Experts. PR [#13889](https://github.com/fastapi/fastapi/pull/13889) by [@tiangolo](https://github.com/tiangolo).
* 🔨 Update FastAPI People sleep interval, use external settings. PR [#13888](https://github.com/fastapi/fastapi/pull/13888) by [@tiangolo](https://github.com/tiangolo).
-## 0.116.1
+## 0.116.1 (2025-07-11)
### Upgrades
@@ -1003,7 +1146,7 @@ You can read more about it in the docs for [Advanced Dependencies - Dependencies
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#13871](https://github.com/fastapi/fastapi/pull/13871) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
-## 0.116.0
+## 0.116.0 (2025-07-07)
### Features
@@ -1030,7 +1173,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#13843](https://github.com/fastapi/fastapi/pull/13843) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* 👥 Update FastAPI People - Contributors and Translators. PR [#13845](https://github.com/fastapi/fastapi/pull/13845) by [@tiangolo](https://github.com/tiangolo).
-## 0.115.14
+## 0.115.14 (2025-06-26)
### Fixes
@@ -1054,7 +1197,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#13823](https://github.com/fastapi/fastapi/pull/13823) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
-## 0.115.13
+## 0.115.13 (2025-06-17)
### Fixes
@@ -1159,7 +1302,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* 🔧 Clean up `docs/en/mkdocs.yml` configuration file. PR [#13542](https://github.com/fastapi/fastapi/pull/13542) by [@svlandeg](https://github.com/svlandeg).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#12986](https://github.com/fastapi/fastapi/pull/12986) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
-## 0.115.12
+## 0.115.12 (2025-03-23)
### Fixes
@@ -1188,7 +1331,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* ⬆ Bump ruff to 0.9.4. PR [#13299](https://github.com/fastapi/fastapi/pull/13299) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 🔧 Update sponsors: pause TestDriven. PR [#13446](https://github.com/fastapi/fastapi/pull/13446) by [@tiangolo](https://github.com/tiangolo).
-## 0.115.11
+## 0.115.11 (2025-03-01)
### Fixes
@@ -1205,7 +1348,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* 👥 Update FastAPI People - Contributors and Translators. PR [#13432](https://github.com/fastapi/fastapi/pull/13432) by [@tiangolo](https://github.com/tiangolo).
* 👥 Update FastAPI People - Sponsors. PR [#13433](https://github.com/fastapi/fastapi/pull/13433) by [@tiangolo](https://github.com/tiangolo).
-## 0.115.10
+## 0.115.10 (2025-02-28)
### Fixes
@@ -1229,7 +1372,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* 🌐 Add Ukrainian translation for `docs/uk/docs/tutorial/request-forms.md`. PR [#13383](https://github.com/fastapi/fastapi/pull/13383) by [@valentinDruzhinin](https://github.com/valentinDruzhinin).
* 🌐 Add Ukrainian translation for `docs/uk/docs/tutorial/testing.md`. PR [#13371](https://github.com/fastapi/fastapi/pull/13371) by [@valentinDruzhinin](https://github.com/valentinDruzhinin).
-## 0.115.9
+## 0.115.9 (2025-02-27)
### Fixes
@@ -1292,7 +1435,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* ⬆ Bump inline-snapshot from 0.18.1 to 0.19.3. PR [#13298](https://github.com/fastapi/fastapi/pull/13298) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 🔧 Update sponsors, add Permit. PR [#13288](https://github.com/fastapi/fastapi/pull/13288) by [@tiangolo](https://github.com/tiangolo).
-## 0.115.8
+## 0.115.8 (2025-01-30)
### Fixes
@@ -1327,7 +1470,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* 🔨 Update FastAPI People Experts script, refactor and optimize data fetching to handle rate limits. PR [#13267](https://github.com/fastapi/fastapi/pull/13267) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump pypa/gh-action-pypi-publish from 1.12.3 to 1.12.4. PR [#13251](https://github.com/fastapi/fastapi/pull/13251) by [@dependabot[bot]](https://github.com/apps/dependabot).
-## 0.115.7
+## 0.115.7 (2025-01-22)
### Upgrades
@@ -1459,7 +1602,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* 🔧 Update team members. PR [#13033](https://github.com/fastapi/fastapi/pull/13033) by [@tiangolo](https://github.com/tiangolo).
* 📝 Update sponsors: remove Codacy. PR [#13032](https://github.com/fastapi/fastapi/pull/13032) by [@tiangolo](https://github.com/tiangolo).
-## 0.115.6
+## 0.115.6 (2024-12-03)
### Fixes
@@ -1493,7 +1636,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#12954](https://github.com/fastapi/fastapi/pull/12954) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
-## 0.115.5
+## 0.115.5 (2024-11-12)
### Refactors
@@ -1630,7 +1773,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* 🔧 Update sponsors: add Render. PR [#12733](https://github.com/fastapi/fastapi/pull/12733) by [@tiangolo](https://github.com/tiangolo).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#12707](https://github.com/fastapi/fastapi/pull/12707) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
-## 0.115.4
+## 0.115.4 (2024-10-27)
### Refactors
@@ -1692,7 +1835,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* 👷 Update GitHub Action to deploy docs previews to handle missing deploy comments. PR [#12527](https://github.com/fastapi/fastapi/pull/12527) by [@tiangolo](https://github.com/tiangolo).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#12505](https://github.com/fastapi/fastapi/pull/12505) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
-## 0.115.3
+## 0.115.3 (2024-10-22)
### Upgrades
@@ -1728,13 +1871,13 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* 👷 Use uv in CI. PR [#12281](https://github.com/fastapi/fastapi/pull/12281) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Update httpx requirement from <0.25.0,>=0.23.0 to >=0.23.0,<0.28.0. PR [#11509](https://github.com/fastapi/fastapi/pull/11509) by [@dependabot[bot]](https://github.com/apps/dependabot).
-## 0.115.2
+## 0.115.2 (2024-10-12)
### Upgrades
* ⬆️ Upgrade Starlette to `>=0.37.2,<0.41.0`. PR [#12431](https://github.com/fastapi/fastapi/pull/12431) by [@tiangolo](https://github.com/tiangolo).
-## 0.115.1
+## 0.115.1 (2024-10-12)
### Fixes
@@ -1790,7 +1933,7 @@ If you want to install `fastapi` with the standard dependencies but without `fas
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#12253](https://github.com/fastapi/fastapi/pull/12253) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ✏️ Fix docstring typos in http security. PR [#12223](https://github.com/fastapi/fastapi/pull/12223) by [@albertvillanova](https://github.com/albertvillanova).
-## 0.115.0
+## 0.115.0 (2024-09-17)
### Highlights
@@ -1924,7 +2067,7 @@ This applies to `Query`, `Header`, and `Cookie` parameters, read the new docs:
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#12204](https://github.com/fastapi/fastapi/pull/12204) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
-## 0.114.2
+## 0.114.2 (2024-09-13)
### Fixes
@@ -1941,7 +2084,7 @@ This applies to `Query`, `Header`, and `Cookie` parameters, read the new docs:
* 💡 Add comments with instructions for Playwright screenshot scripts. PR [#12193](https://github.com/fastapi/fastapi/pull/12193) by [@tiangolo](https://github.com/tiangolo).
* ➕ Add inline-snapshot for tests. PR [#12189](https://github.com/fastapi/fastapi/pull/12189) by [@tiangolo](https://github.com/tiangolo).
-## 0.114.1
+## 0.114.1 (2024-09-11)
### Refactors
@@ -1966,7 +2109,7 @@ This applies to `Query`, `Header`, and `Cookie` parameters, read the new docs:
* 👷 Update `issue-manager.yml`. PR [#12159](https://github.com/fastapi/fastapi/pull/12159) by [@tiangolo](https://github.com/tiangolo).
* ✏️ Fix typo in `fastapi/params.py`. PR [#12143](https://github.com/fastapi/fastapi/pull/12143) by [@surreal30](https://github.com/surreal30).
-## 0.114.0
+## 0.114.0 (2024-09-06)
You can restrict form fields to only include those declared in a Pydantic model and forbid any extra field sent in the request using Pydantic's `model_config = {"extra": "forbid"}`:
@@ -2004,7 +2147,7 @@ Read the new docs: [Form Models - Forbid Extra Form Fields](https://fastapi.tian
* ✅ Update internal tests for latest Pydantic, including CI tweaks to install the latest Pydantic. PR [#12147](https://github.com/fastapi/fastapi/pull/12147) by [@tiangolo](https://github.com/tiangolo).
-## 0.113.0
+## 0.113.0 (2024-09-05)
Now you can declare form fields with Pydantic models:
@@ -2037,7 +2180,7 @@ Read the new docs: [Form Models](https://fastapi.tiangolo.com/tutorial/request-f
* 🔧 Update sponsors: Coherence link. PR [#12130](https://github.com/fastapi/fastapi/pull/12130) by [@tiangolo](https://github.com/tiangolo).
-## 0.112.4
+## 0.112.4 (2024-09-05)
This release is mainly a big internal refactor to enable adding support for Pydantic models for `Form` fields, but that feature comes in the next release.
@@ -2052,7 +2195,7 @@ This release shouldn't affect apps using FastAPI in any way. You don't even have
* ⏪️ Temporarily revert "✨ Add support for Pydantic models in `Form` parameters" to make a checkpoint release. PR [#12128](https://github.com/fastapi/fastapi/pull/12128) by [@tiangolo](https://github.com/tiangolo). Restored by PR [#12129](https://github.com/fastapi/fastapi/pull/12129).
* ✨ Add support for Pydantic models in `Form` parameters. PR [#12127](https://github.com/fastapi/fastapi/pull/12127) by [@tiangolo](https://github.com/tiangolo). Reverted by PR [#12128](https://github.com/fastapi/fastapi/pull/12128) to make a checkpoint release with only refactors. Restored by PR [#12129](https://github.com/fastapi/fastapi/pull/12129).
-## 0.112.3
+## 0.112.3 (2024-09-05)
This release is mainly internal refactors, it shouldn't affect apps using FastAPI in any way. You don't even have to upgrade to this version yet. There are a few bigger releases coming right after. 🚀
@@ -2099,7 +2242,7 @@ This release is mainly internal refactors, it shouldn't affect apps using FastAP
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#12076](https://github.com/fastapi/fastapi/pull/12076) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* 👷 Update `latest-changes` GitHub Action. PR [#12073](https://github.com/fastapi/fastapi/pull/12073) by [@tiangolo](https://github.com/tiangolo).
-## 0.112.2
+## 0.112.2 (2024-08-24)
### Fixes
@@ -2150,7 +2293,7 @@ This release is mainly internal refactors, it shouldn't affect apps using FastAP
* 🙈 Add .coverage* to `.gitignore`. PR [#11940](https://github.com/fastapi/fastapi/pull/11940) by [@gitworkflows](https://github.com/gitworkflows).
* ⚙️ Record and show test coverage contexts (what test covers which line). PR [#11518](https://github.com/fastapi/fastapi/pull/11518) by [@slafs](https://github.com/slafs).
-## 0.112.1
+## 0.112.1 (2024-08-15)
### Upgrades
@@ -2202,7 +2345,7 @@ This release is mainly internal refactors, it shouldn't affect apps using FastAP
* 🔧 Update docs setup with latest configs and plugins. PR [#11953](https://github.com/fastapi/fastapi/pull/11953) by [@tiangolo](https://github.com/tiangolo).
* 🔇 Ignore warning from attrs in Trio. PR [#11949](https://github.com/fastapi/fastapi/pull/11949) by [@tiangolo](https://github.com/tiangolo).
-## 0.112.0
+## 0.112.0 (2024-08-02)
### Breaking Changes
@@ -2272,7 +2415,7 @@ Discussed here: [#11522](https://github.com/fastapi/fastapi/pull/11522) and here
* 🔧 Update sponsors: remove TalkPython. PR [#11861](https://github.com/tiangolo/fastapi/pull/11861) by [@tiangolo](https://github.com/tiangolo).
* 🔨 Update docs Termynal scripts to not include line nums for local dev. PR [#11854](https://github.com/tiangolo/fastapi/pull/11854) by [@tiangolo](https://github.com/tiangolo).
-## 0.111.1
+## 0.111.1 (2024-07-14)
### Upgrades
@@ -2366,7 +2509,7 @@ Discussed here: [#11522](https://github.com/fastapi/fastapi/pull/11522) and here
* 👷 Tweak CI for test-redistribute, add needed env vars for slim. PR [#11549](https://github.com/tiangolo/fastapi/pull/11549) by [@tiangolo](https://github.com/tiangolo).
* 👥 Update FastAPI People. PR [#11511](https://github.com/tiangolo/fastapi/pull/11511) by [@tiangolo](https://github.com/tiangolo).
-## 0.111.0
+## 0.111.0 (2024-05-03)
### Features
@@ -2405,7 +2548,7 @@ INFO: Application startup complete.
* 🔧 Add configs and setup for `fastapi-slim` including optional extras `fastapi-slim[standard]`, and `fastapi` including by default the same `standard` extras. PR [#11503](https://github.com/tiangolo/fastapi/pull/11503) by [@tiangolo](https://github.com/tiangolo).
-## 0.110.3
+## 0.110.3 (2024-04-30)
### Docs
@@ -2429,7 +2572,7 @@ INFO: Application startup complete.
* ⬆ 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
+## 0.110.2 (2024-04-19)
### Fixes
@@ -2467,7 +2610,7 @@ INFO: Application startup complete.
* ⬆️ Upgrade version of typer for docs. PR [#11393](https://github.com/tiangolo/fastapi/pull/11393) by [@tiangolo](https://github.com/tiangolo).
-## 0.110.1
+## 0.110.1 (2024-04-02)
### Fixes
@@ -2656,7 +2799,7 @@ INFO: Application startup complete.
* 🔥 Remove Jina AI QA Bot from the docs. PR [#11268](https://github.com/tiangolo/fastapi/pull/11268) by [@nan-wang](https://github.com/nan-wang).
* 🔧 Update sponsors, remove Jina, remove Powens, move TestDriven.io. PR [#11213](https://github.com/tiangolo/fastapi/pull/11213) by [@tiangolo](https://github.com/tiangolo).
-## 0.110.0
+## 0.110.0 (2024-02-24)
### Breaking Changes
@@ -2717,7 +2860,7 @@ def my_dep():
* 🌐 Add Spanish translation for `docs/es/docs/benchmarks.md`. PR [#10928](https://github.com/tiangolo/fastapi/pull/10928) by [@pablocm83](https://github.com/pablocm83).
* 🌐 Add Spanish translation for `docs/es/docs/advanced/response-change-status-code.md`. PR [#11100](https://github.com/tiangolo/fastapi/pull/11100) by [@alejsdev](https://github.com/alejsdev).
-## 0.109.2
+## 0.109.2 (2024-02-04)
### Upgrades
@@ -2731,7 +2874,7 @@ def my_dep():
* 🍱 Add new FastAPI logo. PR [#11090](https://github.com/tiangolo/fastapi/pull/11090) by [@tiangolo](https://github.com/tiangolo).
-## 0.109.1
+## 0.109.1 (2024-02-03)
### Security fixes
@@ -2895,7 +3038,7 @@ Read more in the [advisory: Content-Type Header ReDoS](https://github.com/tiango
* ⬆ Bump dawidd6/action-download-artifact from 2.28.0 to 3.0.0. PR [#10777](https://github.com/tiangolo/fastapi/pull/10777) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 🔧 Add support for translations to languages with a longer code name, like `zh-hant`. PR [#10950](https://github.com/tiangolo/fastapi/pull/10950) by [@tiangolo](https://github.com/tiangolo).
-## 0.109.0
+## 0.109.0 (2024-01-11)
### Features
@@ -2965,13 +3108,13 @@ Read more in the [advisory: Content-Type Header ReDoS](https://github.com/tiango
* 👷 Upgrade GitHub Action label-approved. PR [#10913](https://github.com/tiangolo/fastapi/pull/10913) by [@tiangolo](https://github.com/tiangolo).
* ⬆️ Upgrade GitHub Action label-approved. PR [#10905](https://github.com/tiangolo/fastapi/pull/10905) by [@tiangolo](https://github.com/tiangolo).
-## 0.108.0
+## 0.108.0 (2023-12-26)
### Upgrades
* ⬆️ Upgrade Starlette to `>=0.29.0,<0.33.0`, update docs and usage of templates with new Starlette arguments. Remove pin of AnyIO `>=3.7.1,<4.0.0`, add support for AnyIO 4.x.x. PR [#10846](https://github.com/tiangolo/fastapi/pull/10846) by [@tiangolo](https://github.com/tiangolo).
-## 0.107.0
+## 0.107.0 (2023-12-26)
### Upgrades
@@ -2982,7 +3125,7 @@ Read more in the [advisory: Content-Type Header ReDoS](https://github.com/tiango
* 📝 Add docs: Node.js script alternative to update OpenAPI for generated clients. PR [#10845](https://github.com/tiangolo/fastapi/pull/10845) by [@alejsdev](https://github.com/alejsdev).
* 📝 Restructure Docs section in Contributing page. PR [#10844](https://github.com/tiangolo/fastapi/pull/10844) by [@alejsdev](https://github.com/alejsdev).
-## 0.106.0
+## 0.106.0 (2023-12-25)
### Breaking Changes
@@ -3098,7 +3241,7 @@ The new execution flow can be found in the docs: [Execution of dependencies with
* 👥 Update FastAPI People. PR [#10567](https://github.com/tiangolo/fastapi/pull/10567) by [@tiangolo](https://github.com/tiangolo).
-## 0.105.0
+## 0.105.0 (2023-12-12)
### Features
@@ -3123,7 +3266,7 @@ The new execution flow can be found in the docs: [Execution of dependencies with
* 📝 Update release notes, move and check latest-changes. PR [#10588](https://github.com/tiangolo/fastapi/pull/10588) by [@tiangolo](https://github.com/tiangolo).
* 👷 Upgrade latest-changes GitHub Action. PR [#10587](https://github.com/tiangolo/fastapi/pull/10587) by [@tiangolo](https://github.com/tiangolo).
-## 0.104.1
+## 0.104.1 (2023-10-30)
### Fixes
@@ -3158,7 +3301,7 @@ The new execution flow can be found in the docs: [Execution of dependencies with
* 🐛 Fix overriding MKDocs theme lang in hook. PR [#10490](https://github.com/tiangolo/fastapi/pull/10490) by [@tiangolo](https://github.com/tiangolo).
* 🔥 Drop/close Gitter chat. Questions should go to GitHub Discussions, free conversations to Discord.. PR [#10485](https://github.com/tiangolo/fastapi/pull/10485) by [@tiangolo](https://github.com/tiangolo).
-## 0.104.0
+## 0.104.0 (2023-10-18)
## Features
@@ -3176,7 +3319,7 @@ The new execution flow can be found in the docs: [Execution of dependencies with
* 🔧 Update sponsors, Bump.sh images. PR [#10381](https://github.com/tiangolo/fastapi/pull/10381) by [@tiangolo](https://github.com/tiangolo).
* 👥 Update FastAPI People. PR [#10363](https://github.com/tiangolo/fastapi/pull/10363) by [@tiangolo](https://github.com/tiangolo).
-## 0.103.2
+## 0.103.2 (2023-09-28)
### Refactors
@@ -3203,7 +3346,7 @@ The new execution flow can be found in the docs: [Execution of dependencies with
* 🔧 Update sponsors, remove Svix. PR [#10228](https://github.com/tiangolo/fastapi/pull/10228) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update sponsors, add Bump.sh. PR [#10227](https://github.com/tiangolo/fastapi/pull/10227) by [@tiangolo](https://github.com/tiangolo).
-## 0.103.1
+## 0.103.1 (2023-09-02)
### Fixes
@@ -3238,7 +3381,7 @@ The new execution flow can be found in the docs: [Execution of dependencies with
* 👥 Update FastAPI People. PR [#10186](https://github.com/tiangolo/fastapi/pull/10186) by [@tiangolo](https://github.com/tiangolo).
-## 0.103.0
+## 0.103.0 (2023-08-26)
### Features
@@ -3249,7 +3392,7 @@ The new execution flow can be found in the docs: [Execution of dependencies with
* 📝 Add note to docs about Separate Input and Output Schemas with FastAPI version. PR [#10150](https://github.com/tiangolo/fastapi/pull/10150) by [@tiangolo](https://github.com/tiangolo).
-## 0.102.0
+## 0.102.0 (2023-08-25)
### Features
@@ -3273,7 +3416,7 @@ The new execution flow can be found in the docs: [Execution of dependencies with
* 🔧 Update sponsors, add Speakeasy. PR [#10098](https://github.com/tiangolo/fastapi/pull/10098) by [@tiangolo](https://github.com/tiangolo).
-## 0.101.1
+## 0.101.1 (2023-08-14)
### Fixes
@@ -3310,7 +3453,7 @@ The new execution flow can be found in the docs: [Execution of dependencies with
* ⬆ Bump mypy from 1.4.0 to 1.4.1. PR [#9756](https://github.com/tiangolo/fastapi/pull/9756) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump mkdocs-material from 9.1.17 to 9.1.21. PR [#9960](https://github.com/tiangolo/fastapi/pull/9960) by [@dependabot[bot]](https://github.com/apps/dependabot).
-## 0.101.0
+## 0.101.0 (2023-08-04)
### Features
@@ -3345,7 +3488,7 @@ The new execution flow can be found in the docs: [Execution of dependencies with
* 🔧 Update sponsor Fern. PR [#9979](https://github.com/tiangolo/fastapi/pull/9979) by [@tiangolo](https://github.com/tiangolo).
* 👷 Update CI debug mode with Tmate. PR [#9977](https://github.com/tiangolo/fastapi/pull/9977) by [@tiangolo](https://github.com/tiangolo).
-## 0.100.1
+## 0.100.1 (2023-07-27)
### Fixes
@@ -3377,7 +3520,7 @@ The new execution flow can be found in the docs: [Execution of dependencies with
* 👷 Update MkDocs Material token. PR [#9843](https://github.com/tiangolo/fastapi/pull/9843) by [@tiangolo](https://github.com/tiangolo).
* 👷 Update token for latest changes. PR [#9842](https://github.com/tiangolo/fastapi/pull/9842) by [@tiangolo](https://github.com/tiangolo).
-## 0.100.0
+## 0.100.0 (2023-07-07)
✨ Support for **Pydantic v2** ✨
@@ -3448,14 +3591,14 @@ There are **tests for both Pydantic v1 and v2**, and test **coverage** is kept a
* The attribute `schema_extra` for the internal class `Config` has been replaced by the key `json_schema_extra` in the new `model_config` dict.
* You can read more about it in the docs for [Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/).
* When you install `"fastapi[all]"` it now also includes:
- *
pydantic-settings - for settings management.
- *
pydantic-extra-types - for extra types to be used with Pydantic.
+ * [`pydantic-settings`](https://docs.pydantic.dev/latest/usage/pydantic_settings/) - for settings management.
+ * [`pydantic-extra-types`](https://docs.pydantic.dev/latest/usage/types/extra_types/extra_types/) - for extra types to be used with Pydantic.
* Now Pydantic Settings is an additional optional package (included in `"fastapi[all]"`). To use settings you should now import `from pydantic_settings import BaseSettings` instead of importing from `pydantic` directly.
* You can read more about it in the docs for [Settings and Environment Variables](https://fastapi.tiangolo.com/advanced/settings/).
* PR [#9816](https://github.com/tiangolo/fastapi/pull/9816) by [@tiangolo](https://github.com/tiangolo), included all the work done (in multiple PRs) on the beta branch (`main-pv2`).
-## 0.99.1
+## 0.99.1 (2023-07-02)
### Fixes
@@ -3465,15 +3608,15 @@ There are **tests for both Pydantic v1 and v2**, and test **coverage** is kept a
* 📝 Update source examples to use new JSON Schema examples field. PR [#9776](https://github.com/tiangolo/fastapi/pull/9776) by [@tiangolo](https://github.com/tiangolo).
-## 0.99.0
+## 0.99.0 (2023-06-30)
### Features
* ✨ Add support for OpenAPI 3.1.0. PR [#9770](https://github.com/tiangolo/fastapi/pull/9770) by [@tiangolo](https://github.com/tiangolo).
- * New support for documenting **webhooks**, read the new docs here:
Advanced User Guide: OpenAPI Webhooks.
+ * New support for documenting **webhooks**, read the new docs here: [Advanced User Guide: OpenAPI Webhooks](https://fastapi.tiangolo.com/advanced/openapi-webhooks/).
* Upgrade OpenAPI 3.1.0, this uses JSON Schema 2020-12.
* Upgrade Swagger UI to version 5.x.x, that supports OpenAPI 3.1.0.
- * Updated `examples` field in `Query()`, `Cookie()`, `Body()`, etc. based on the latest JSON Schema and OpenAPI. Now it takes a list of examples and they are included directly in the JSON Schema, not outside. Read more about it (including the historical technical details) in the updated docs:
Tutorial: Declare Request Example Data.
+ * Updated `examples` field in `Query()`, `Cookie()`, `Body()`, etc. based on the latest JSON Schema and OpenAPI. Now it takes a list of examples and they are included directly in the JSON Schema, not outside. Read more about it (including the historical technical details) in the updated docs: [Tutorial: Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/).
* ✨ Add support for `deque` objects and children in `jsonable_encoder`. PR [#9433](https://github.com/tiangolo/fastapi/pull/9433) by [@cranium](https://github.com/cranium).
@@ -3504,7 +3647,7 @@ There are **tests for both Pydantic v1 and v2**, and test **coverage** is kept a
* ⬆️ Upgrade MkDocs and MkDocs Material. PR [#9729](https://github.com/tiangolo/fastapi/pull/9729) by [@tiangolo](https://github.com/tiangolo).
* 👷 Build and deploy docs only on docs changes. PR [#9728](https://github.com/tiangolo/fastapi/pull/9728) by [@tiangolo](https://github.com/tiangolo).
-## 0.98.0
+## 0.98.0 (2023-06-22)
### Features
@@ -3548,7 +3691,7 @@ There are **tests for both Pydantic v1 and v2**, and test **coverage** is kept a
* 🔧 Update sponsors, add Flint. PR [#9699](https://github.com/tiangolo/fastapi/pull/9699) by [@tiangolo](https://github.com/tiangolo).
* 👷 Lint in CI only once, only with one version of Python, run tests with all of them. PR [#9686](https://github.com/tiangolo/fastapi/pull/9686) by [@tiangolo](https://github.com/tiangolo).
-## 0.97.0
+## 0.97.0 (2023-06-11)
### Features
@@ -3570,7 +3713,7 @@ There are **tests for both Pydantic v1 and v2**, and test **coverage** is kept a
* 💚 Update CI cache to fix installs when dependencies change. PR [#9659](https://github.com/tiangolo/fastapi/pull/9659) by [@tiangolo](https://github.com/tiangolo).
* ⬇️ Separate requirements for development into their own requirements.txt files, they shouldn't be extras. PR [#9655](https://github.com/tiangolo/fastapi/pull/9655) by [@tiangolo](https://github.com/tiangolo).
-## 0.96.1
+## 0.96.1 (2023-06-10)
### Fixes
@@ -3603,7 +3746,7 @@ There are **tests for both Pydantic v1 and v2**, and test **coverage** is kept a
* 👷 Add custom token to Smokeshow and Preview Docs for download-artifact, to prevent API rate limits. PR [#9646](https://github.com/tiangolo/fastapi/pull/9646) by [@tiangolo](https://github.com/tiangolo).
* 👷 Add custom tokens for GitHub Actions to avoid rate limits. PR [#9647](https://github.com/tiangolo/fastapi/pull/9647) by [@tiangolo](https://github.com/tiangolo).
-## 0.96.0
+## 0.96.0 (2023-06-03)
### Features
@@ -3633,7 +3776,7 @@ There are **tests for both Pydantic v1 and v2**, and test **coverage** is kept a
* 👥 Update FastAPI People. PR [#9602](https://github.com/tiangolo/fastapi/pull/9602) by [@github-actions[bot]](https://github.com/apps/github-actions).
* 🔧 Update sponsors, remove InvestSuite. PR [#9612](https://github.com/tiangolo/fastapi/pull/9612) by [@tiangolo](https://github.com/tiangolo).
-## 0.95.2
+## 0.95.2 (2023-05-16)
* ⬆️ Upgrade Starlette version to `>=0.27.0` for a security release. PR [#9541](https://github.com/tiangolo/fastapi/pull/9541) by [@tiangolo](https://github.com/tiangolo). Details on [Starlette's security advisory](https://github.com/encode/starlette/security/advisories/GHSA-v5gw-mw7f-84px).
@@ -3659,7 +3802,7 @@ There are **tests for both Pydantic v1 and v2**, and test **coverage** is kept a
* 💚 Disable setup-python pip cache in CI. PR [#9438](https://github.com/tiangolo/fastapi/pull/9438) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Bump pypa/gh-action-pypi-publish from 1.6.4 to 1.8.5. PR [#9346](https://github.com/tiangolo/fastapi/pull/9346) by [@dependabot[bot]](https://github.com/apps/dependabot).
-## 0.95.1
+## 0.95.1 (2023-04-13)
### Fixes
@@ -3696,7 +3839,7 @@ There are **tests for both Pydantic v1 and v2**, and test **coverage** is kept a
* 🔧 Update sponsors: remove Jina. PR [#9388](https://github.com/tiangolo/fastapi/pull/9388) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update sponsors, add databento, remove Ines's course and StriveWorks. PR [#9351](https://github.com/tiangolo/fastapi/pull/9351) by [@tiangolo](https://github.com/tiangolo).
-## 0.95.0
+## 0.95.0 (2023-03-18)
### Highlights
@@ -3805,13 +3948,13 @@ Special thanks to [@nzig](https://github.com/nzig) for the core implementation a
* 📝 Update order of examples, latest Python version first, and simplify version tab names. PR [#9269](https://github.com/tiangolo/fastapi/pull/9269) by [@tiangolo](https://github.com/tiangolo).
* 📝 Update all docs to use `Annotated` as the main recommendation, with new examples and tests. PR [#9268](https://github.com/tiangolo/fastapi/pull/9268) by [@tiangolo](https://github.com/tiangolo).
-## 0.94.1
+## 0.94.1 (2023-03-14)
### Fixes
* 🎨 Fix types for lifespan, upgrade Starlette to 0.26.1. PR [#9245](https://github.com/tiangolo/fastapi/pull/9245) by [@tiangolo](https://github.com/tiangolo).
-## 0.94.0
+## 0.94.0 (2023-03-10)
### Upgrades
@@ -3834,7 +3977,7 @@ Special thanks to [@nzig](https://github.com/nzig) for the core implementation a
* ⬆ Bump dawidd6/action-download-artifact from 2.24.3 to 2.26.0. PR [#6034](https://github.com/tiangolo/fastapi/pull/6034) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#5709](https://github.com/tiangolo/fastapi/pull/5709) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
-## 0.93.0
+## 0.93.0 (2023-03-07)
### Features
@@ -3903,7 +4046,7 @@ Read more about it in the new docs: [Advanced User Guide: Lifespan Events](https
* ⬆️ Upgrade analytics. PR [#6025](https://github.com/tiangolo/fastapi/pull/6025) by [@tiangolo](https://github.com/tiangolo).
* ⬆️ Upgrade and re-enable installing Typer-CLI. PR [#6008](https://github.com/tiangolo/fastapi/pull/6008) by [@tiangolo](https://github.com/tiangolo).
-## 0.92.0
+## 0.92.0 (2023-02-14)
🚨 This is a security fix. Please upgrade as soon as possible.
@@ -3914,7 +4057,7 @@ Read more about it in the new docs: [Advanced User Guide: Lifespan Events](https
* Only applications using forms (e.g. file uploads) could be affected.
* For most cases, upgrading won't have any breaking changes.
-## 0.91.0
+## 0.91.0 (2023-02-10)
### Upgrades
@@ -3922,7 +4065,7 @@ Read more about it in the new docs: [Advanced User Guide: Lifespan Events](https
* This can solve nuanced errors when using middlewares. Before Starlette `0.24.0`, a new instance of each middleware class would be created when a new middleware was added. That normally was not a problem, unless the middleware class expected to be created only once, with only one instance, that happened in some cases. This upgrade would solve those cases (thanks [@adriangb](https://github.com/adriangb)! Starlette PR [#2017](https://github.com/encode/starlette/pull/2017)). Now the middleware class instances are created once, right before the first request (the first time the app is called).
* If you depended on that previous behavior, you might need to update your code. As always, make sure your tests pass before merging the upgrade.
-## 0.90.1
+## 0.90.1 (2023-02-09)
### Upgrades
@@ -3942,7 +4085,7 @@ Read more about it in the new docs: [Advanced User Guide: Lifespan Events](https
* ✏ Update `zip-docs.sh` internal script, remove extra space. PR [#5931](https://github.com/tiangolo/fastapi/pull/5931) by [@JuanPerdomo00](https://github.com/JuanPerdomo00).
-## 0.90.0
+## 0.90.0 (2023-02-08)
### Upgrades
@@ -3974,7 +4117,7 @@ Read more about it in the new docs: [Advanced User Guide: Lifespan Events](https
* 🔧 Update Sponsor Budget Insight to Powens. PR [#5916](https://github.com/tiangolo/fastapi/pull/5916) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update GitHub Sponsors badge data. PR [#5915](https://github.com/tiangolo/fastapi/pull/5915) by [@tiangolo](https://github.com/tiangolo).
-## 0.89.1
+## 0.89.1 (2023-01-10)
### Fixes
@@ -3989,7 +4132,7 @@ Read more about it in the new docs: [Advanced User Guide: Lifespan Events](https
* 🌐 Add Turkish translation for `docs/tr/docs/tutorial/first_steps.md`. PR [#5691](https://github.com/tiangolo/fastapi/pull/5691) by [@Kadermiyanyedi](https://github.com/Kadermiyanyedi).
-## 0.89.0
+## 0.89.0 (2023-01-07)
### Features
@@ -4059,7 +4202,7 @@ Read more about it in the new docs: [Response Model - Return Type](https://fasta
* 🔧 Update sponsors, disable course bundle. PR [#5713](https://github.com/tiangolo/fastapi/pull/5713) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Update typer[all] requirement from <0.7.0,>=0.6.1 to >=0.6.1,<0.8.0. PR [#5639](https://github.com/tiangolo/fastapi/pull/5639) by [@dependabot[bot]](https://github.com/apps/dependabot).
-## 0.88.0
+## 0.88.0 (2022-11-27)
### Upgrades
@@ -4084,7 +4227,7 @@ Read more about it in the new docs: [Response Model - Return Type](https://fasta
* 👷 Update `setup-python` action in tests to use new caching feature. PR [#5680](https://github.com/tiangolo/fastapi/pull/5680) by [@madkinsz](https://github.com/madkinsz).
* ⬆ Bump black from 22.8.0 to 22.10.0. PR [#5569](https://github.com/tiangolo/fastapi/pull/5569) by [@dependabot[bot]](https://github.com/apps/dependabot).
-## 0.87.0
+## 0.87.0 (2022-11-13)
Highlights of this release:
@@ -4123,7 +4266,7 @@ Highlights of this release:
* ⬆ Bump dawidd6/action-download-artifact from 2.24.0 to 2.24.1. PR [#5603](https://github.com/tiangolo/fastapi/pull/5603) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 📝 Update coverage badge to use Samuel Colvin's Smokeshow. PR [#5585](https://github.com/tiangolo/fastapi/pull/5585) by [@tiangolo](https://github.com/tiangolo).
-## 0.86.0
+## 0.86.0 (2022-11-03)
### Features
@@ -4151,7 +4294,7 @@ Highlights of this release:
* 👷 Switch from Codecov to Smokeshow plus pytest-cov to pure coverage for internal tests. PR [#5583](https://github.com/tiangolo/fastapi/pull/5583) by [@tiangolo](https://github.com/tiangolo).
* 👥 Update FastAPI People. PR [#5571](https://github.com/tiangolo/fastapi/pull/5571) by [@github-actions[bot]](https://github.com/apps/github-actions).
-## 0.85.2
+## 0.85.2 (2022-10-31)
### Docs
@@ -4189,7 +4332,7 @@ Highlights of this release:
* ⬆️ Upgrade Typer to include Rich in scripts for docs. PR [#5502](https://github.com/tiangolo/fastapi/pull/5502) by [@tiangolo](https://github.com/tiangolo).
* 🐛 Fix calling `mkdocs` for languages as a subprocess to fix/enable MkDocs Material search plugin. PR [#5501](https://github.com/tiangolo/fastapi/pull/5501) by [@tiangolo](https://github.com/tiangolo).
-## 0.85.1
+## 0.85.1 (2022-10-14)
### Fixes
@@ -4205,7 +4348,7 @@ Highlights of this release:
* 🔧 Disable Material for MkDocs search plugin. PR [#5495](https://github.com/tiangolo/fastapi/pull/5495) by [@tiangolo](https://github.com/tiangolo).
* 🔇 Ignore Trio warning in tests for CI. PR [#5483](https://github.com/tiangolo/fastapi/pull/5483) by [@samuelcolvin](https://github.com/samuelcolvin).
-## 0.85.0
+## 0.85.0 (2022-09-15)
### Features
@@ -4220,7 +4363,7 @@ Highlights of this release:
* ⬆️ Upgrade mypy and tweak internal type annotations. PR [#5398](https://github.com/tiangolo/fastapi/pull/5398) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update test dependencies, upgrade Pytest, move dependencies from dev to test. PR [#5396](https://github.com/tiangolo/fastapi/pull/5396) by [@tiangolo](https://github.com/tiangolo).
-## 0.84.0
+## 0.84.0 (2022-09-14)
### Breaking Changes
@@ -4228,7 +4371,7 @@ This version of FastAPI drops support for Python 3.6. 🔥 Please upgrade to a s
* 🔧 Update package metadata, drop support for Python 3.6, move build internals from Flit to Hatch. PR [#5240](https://github.com/tiangolo/fastapi/pull/5240) by [@ofek](https://github.com/ofek).
-## 0.83.0
+## 0.83.0 (2022-09-11)
🚨 This is probably the last release (or one of the last releases) to support Python 3.6. 🔥
@@ -4253,7 +4396,7 @@ You hopefully updated to a supported version of Python a while ago. If you haven
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#5352](https://github.com/tiangolo/fastapi/pull/5352) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
-## 0.82.0
+## 0.82.0 (2022-09-04)
🚨 This is probably the last release (or one of the last releases) to support Python 3.6. 🔥
@@ -4300,7 +4443,7 @@ You hopefully updated to a supported version of Python a while ago. If you haven
* ♻ Internal small refactor, move `operation_id` parameter position in delete method for consistency with the code. PR [#4474](https://github.com/tiangolo/fastapi/pull/4474) by [@hiel](https://github.com/hiel).
* 🔧 Update sponsors, disable ImgWhale. PR [#5338](https://github.com/tiangolo/fastapi/pull/5338) by [@tiangolo](https://github.com/tiangolo).
-## 0.81.0
+## 0.81.0 (2022-08-26)
### Features
@@ -4353,7 +4496,7 @@ You hopefully updated to a supported version of Python a while ago. If you haven
* ⬆ Upgrade version pin accepted for Flake8, for internal code, to `flake8 >=3.8.3,<6.0.0`. PR [#4097](https://github.com/tiangolo/fastapi/pull/4097) by [@jamescurtin](https://github.com/jamescurtin).
* 🍱 Update Jina banner, fix typo. PR [#5301](https://github.com/tiangolo/fastapi/pull/5301) by [@tiangolo](https://github.com/tiangolo).
-## 0.80.0
+## 0.80.0 (2022-08-23)
### Breaking Changes - Fixes
@@ -4436,7 +4579,7 @@ This way the data will be correctly validated, you won't have an internal server
* 🌐 Add missing navigator for `encoder.md` in Korean translation. PR [#5238](https://github.com/tiangolo/fastapi/pull/5238) by [@joonas-yoon](https://github.com/joonas-yoon).
* (Empty PR merge by accident) [#4913](https://github.com/tiangolo/fastapi/pull/4913).
-## 0.79.1
+## 0.79.1 (2022-08-18)
### Fixes
@@ -4472,7 +4615,7 @@ This way the data will be correctly validated, you won't have an internal server
* 🔧 Update Jina sponsorship. PR [#5272](https://github.com/tiangolo/fastapi/pull/5272) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update sponsors, Striveworks badge. PR [#5179](https://github.com/tiangolo/fastapi/pull/5179) by [@tiangolo](https://github.com/tiangolo).
-## 0.79.0
+## 0.79.0 (2022-07-14)
### Fixes - Breaking Changes
@@ -4509,7 +4652,7 @@ This way the data will be correctly validated, you won't have an internal server
* 🔧 Update sponsors, remove Dropbase, add Doist. PR [#5096](https://github.com/tiangolo/fastapi/pull/5096) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update sponsors, remove Classiq, add ImgWhale. PR [#5079](https://github.com/tiangolo/fastapi/pull/5079) by [@tiangolo](https://github.com/tiangolo).
-## 0.78.0
+## 0.78.0 (2022-05-14)
### Features
@@ -4615,7 +4758,7 @@ def main(
* 🔧 Add pre-commit with first config and first formatting pass. PR [#4888](https://github.com/tiangolo/fastapi/pull/4888) by [@tiangolo](https://github.com/tiangolo).
* 👷 Disable CI installing Material for MkDocs in forks. PR [#4410](https://github.com/tiangolo/fastapi/pull/4410) by [@dolfinus](https://github.com/dolfinus).
-## 0.77.1
+## 0.77.1 (2022-05-10)
### Upgrades
@@ -4638,7 +4781,7 @@ def main(
* 🔧 Add notifications in issue for Uzbek translations. PR [#4884](https://github.com/tiangolo/fastapi/pull/4884) by [@tiangolo](https://github.com/tiangolo).
-## 0.77.0
+## 0.77.0 (2022-05-10)
### Upgrades
@@ -4671,7 +4814,7 @@ def main(
* 🌐 Add Portuguese translation of `tutorial/extra-data-types.md`. PR [#4077](https://github.com/tiangolo/fastapi/pull/4077) by [@luccasmmg](https://github.com/luccasmmg).
* 🌐 Update German translation for `docs/features.md`. PR [#3905](https://github.com/tiangolo/fastapi/pull/3905) by [@jomue](https://github.com/jomue).
-## 0.76.0
+## 0.76.0 (2022-05-05)
### Upgrades
@@ -4684,7 +4827,7 @@ def main(
* 🍱 Update sponsor, ExoFlare badge. PR [#4822](https://github.com/tiangolo/fastapi/pull/4822) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update sponsors, enable Dropbase again, update TalkPython link. PR [#4821](https://github.com/tiangolo/fastapi/pull/4821) by [@tiangolo](https://github.com/tiangolo).
-## 0.75.2
+## 0.75.2 (2022-04-17)
This release includes upgrades to third-party packages that handle security issues. Although there's a chance these issues don't affect you in particular, please upgrade as soon as possible.
@@ -4705,7 +4848,7 @@ This release includes upgrades to third-party packages that handle security issu
* 🔧 Update sponsors, add: ExoFlare, Ines Course; remove: Dropbase, Vim.so, Calmcode; update: Striveworks, TalkPython and TestDriven.io. PR [#4805](https://github.com/tiangolo/fastapi/pull/4805) by [@tiangolo](https://github.com/tiangolo).
* ⬆️ Upgrade Codecov GitHub Action. PR [#4801](https://github.com/tiangolo/fastapi/pull/4801) by [@tiangolo](https://github.com/tiangolo).
-## 0.75.1
+## 0.75.1 (2022-04-01)
### Translations
@@ -4724,19 +4867,19 @@ This release includes upgrades to third-party packages that handle security issu
* 🔧 Add Classiq sponsor. PR [#4671](https://github.com/tiangolo/fastapi/pull/4671) by [@tiangolo](https://github.com/tiangolo).
* 📝 Add Jina's QA Bot to the docs to help people that want to ask quick questions. PR [#4655](https://github.com/tiangolo/fastapi/pull/4655) by [@tiangolo](https://github.com/tiangolo) based on original PR [#4626](https://github.com/tiangolo/fastapi/pull/4626) by [@hanxiao](https://github.com/hanxiao).
-## 0.75.0
+## 0.75.0 (2022-03-04)
### Features
* ✨ Add support for custom `generate_unique_id_function` and docs for generating clients. New docs: [Advanced - Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/). PR [#4650](https://github.com/tiangolo/fastapi/pull/4650) by [@tiangolo](https://github.com/tiangolo).
-## 0.74.1
+## 0.74.1 (2022-02-21)
### Features
* ✨ Include route in scope to allow middleware and other tools to extract its information. PR [#4603](https://github.com/tiangolo/fastapi/pull/4603) by [@tiangolo](https://github.com/tiangolo).
-## 0.74.0
+## 0.74.0 (2022-02-17)
### Breaking Changes
@@ -4806,7 +4949,7 @@ async def set_up_request_state_dependency():
* 💚 Only build docs on push when on master to avoid duplicate runs from PRs. PR [#4564](https://github.com/tiangolo/fastapi/pull/4564) by [@tiangolo](https://github.com/tiangolo).
* 👥 Update FastAPI People. PR [#4502](https://github.com/tiangolo/fastapi/pull/4502) by [@github-actions[bot]](https://github.com/apps/github-actions).
-## 0.73.0
+## 0.73.0 (2022-01-23)
### Features
@@ -4829,7 +4972,7 @@ async def set_up_request_state_dependency():
* 🐛 Fix docs dependencies cache, to get the latest Material for MkDocs. PR [#4466](https://github.com/tiangolo/fastapi/pull/4466) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Add sponsor Dropbase. PR [#4465](https://github.com/tiangolo/fastapi/pull/4465) by [@tiangolo](https://github.com/tiangolo).
-## 0.72.0
+## 0.72.0 (2022-01-16)
### Features
@@ -4850,7 +4993,7 @@ async def set_up_request_state_dependency():
* 🔧 Enable MkDocs Material Insiders' `content.tabs.link`. PR [#4399](https://github.com/tiangolo/fastapi/pull/4399) by [@tiangolo](https://github.com/tiangolo).
-## 0.71.0
+## 0.71.0 (2022-01-07)
### Features
@@ -4865,7 +5008,7 @@ async def set_up_request_state_dependency():
* 🔧 Add FastAPI Trove Classifier for PyPI as now there's one 🤷😁. PR [#4386](https://github.com/tiangolo/fastapi/pull/4386) by [@tiangolo](https://github.com/tiangolo).
* ⬆ Upgrade MkDocs Material and configs. PR [#4385](https://github.com/tiangolo/fastapi/pull/4385) by [@tiangolo](https://github.com/tiangolo).
-## 0.70.1
+## 0.70.1 (2021-12-12)
There's nothing interesting in this particular FastAPI release. It is mainly to enable/unblock the release of the next version of Pydantic that comes packed with features and improvements. 🤩
@@ -4894,7 +5037,7 @@ There's nothing interesting in this particular FastAPI release. It is mainly to
* 👥 Update FastAPI People. PR [#4274](https://github.com/tiangolo/fastapi/pull/4274) by [@github-actions[bot]](https://github.com/apps/github-actions).
-## 0.70.0
+## 0.70.0 (2021-10-07)
This release just upgrades Starlette to the latest version, `0.16.0`, which includes several bug fixes and some small breaking changes.
@@ -4915,7 +5058,7 @@ Also upgrades the ranges of optional dependencies:
* `"jinja2 >=2.11.2,<4.0.0"`
* `"itsdangerous >=1.1.0,<3.0.0"`
-## 0.69.0
+## 0.69.0 (2021-10-07)
### Breaking Changes - Upgrade
@@ -4964,7 +5107,7 @@ This release also removes `graphene` as an optional dependency for GraphQL. If y
* 🔧 Lint only in Python 3.7 and above. PR [#4006](https://github.com/tiangolo/fastapi/pull/4006) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Add GitHub Action notify-translations config for Azerbaijani. PR [#3995](https://github.com/tiangolo/fastapi/pull/3995) by [@tiangolo](https://github.com/tiangolo).
-## 0.68.2
+## 0.68.2 (2021-10-05)
This release has **no breaking changes**. 🎉
@@ -5008,7 +5151,7 @@ Soon there will be a new FastAPI release upgrading Starlette to take advantage o
* 🎨 Tweak CSS styles for shell animations. PR [#3888](https://github.com/tiangolo/fastapi/pull/3888) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Add new Sponsor Calmcode.io. PR [#3777](https://github.com/tiangolo/fastapi/pull/3777) by [@tiangolo](https://github.com/tiangolo).
-## 0.68.1
+## 0.68.1 (2021-08-24)
* ✨ Add support for `read_with_orm_mode`, to support [SQLModel](https://sqlmodel.tiangolo.com/) relationship attributes. PR [#3757](https://github.com/tiangolo/fastapi/pull/3757) by [@tiangolo](https://github.com/tiangolo).
@@ -5032,7 +5175,7 @@ Soon there will be a new FastAPI release upgrading Starlette to take advantage o
* ⬆ Enable tests for Python 3.9. PR [#2298](https://github.com/tiangolo/fastapi/pull/2298) by [@Kludex](https://github.com/Kludex).
* 👥 Update FastAPI People. PR [#3642](https://github.com/tiangolo/fastapi/pull/3642) by [@github-actions[bot]](https://github.com/apps/github-actions).
-## 0.68.0
+## 0.68.0 (2021-07-29)
### Features
@@ -5061,7 +5204,7 @@ Soon there will be a new FastAPI release upgrading Starlette to take advantage o
* 🔧 Add new GitHub templates with forms for new issues. PR [#3612](https://github.com/tiangolo/fastapi/pull/3612) by [@tiangolo](https://github.com/tiangolo).
* 📝 Add official FastAPI Twitter to docs: [@fastapi](https://x.com/fastapi). PR [#3578](https://github.com/tiangolo/fastapi/pull/3578) by [@tiangolo](https://github.com/tiangolo).
-## 0.67.0
+## 0.67.0 (2021-07-21)
### Features
@@ -5089,7 +5232,7 @@ Soon there will be a new FastAPI release upgrading Starlette to take advantage o
* 👷 Update GitHub Action latest-changes, strike 2 ⚾. PR [#3575](https://github.com/tiangolo/fastapi/pull/3575) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Sort external links in docs to have the most recent at the top. PR [#3568](https://github.com/tiangolo/fastapi/pull/3568) by [@tiangolo](https://github.com/tiangolo).
-## 0.66.1
+## 0.66.1 (2021-07-19)
### Translations
@@ -5102,7 +5245,7 @@ Soon there will be a new FastAPI release upgrading Starlette to take advantage o
* 🔧 Configure strict pytest options and update/refactor tests. Upgrade pytest to `>=6.2.4,<7.0.0` and pytest-cov to `>=2.12.0,<3.0.0`. Initial PR [#2790](https://github.com/tiangolo/fastapi/pull/2790) by [@graingert](https://github.com/graingert).
* ⬆️ Upgrade python-jose dependency to `>=3.3.0,<4.0.0` for tests. PR [#3468](https://github.com/tiangolo/fastapi/pull/3468) by [@tiangolo](https://github.com/tiangolo).
-## 0.66.0
+## 0.66.0 (2021-07-04)
### Features
@@ -5120,7 +5263,7 @@ Soon there will be a new FastAPI release upgrading Starlette to take advantage o
* 🌐 Add Spanish translation for `advanced/additional-status-codes.md`. PR [#1252](https://github.com/tiangolo/fastapi/pull/1252) by [@jfunez](https://github.com/jfunez).
* 🌐 Add Spanish translation for `advanced/path-operation-advanced-configuration.md`. PR [#1251](https://github.com/tiangolo/fastapi/pull/1251) by [@jfunez](https://github.com/jfunez).
-## 0.65.3
+## 0.65.3 (2021-07-03)
### Fixes
@@ -5151,7 +5294,7 @@ Soon there will be a new FastAPI release upgrading Starlette to take advantage o
* 👥 Update FastAPI People. PR [#3319](https://github.com/tiangolo/fastapi/pull/3319) by [@github-actions[bot]](https://github.com/apps/github-actions).
* ⬆ Upgrade docs development dependency on `typer-cli` to >=0.0.12 to fix conflicts. PR [#3429](https://github.com/tiangolo/fastapi/pull/3429) by [@tiangolo](https://github.com/tiangolo).
-## 0.65.2
+## 0.65.2 (2021-06-09)
### Security fixes
@@ -5176,13 +5319,13 @@ Thanks to [Dima Boger](https://x.com/b0g3r) for the security report! 🙇🔒
* 🔧 Add new banner sponsor badge for FastAPI courses bundle. PR [#3288](https://github.com/tiangolo/fastapi/pull/3288) by [@tiangolo](https://github.com/tiangolo).
* 👷 Upgrade Issue Manager GitHub Action. PR [#3236](https://github.com/tiangolo/fastapi/pull/3236) by [@tiangolo](https://github.com/tiangolo).
-## 0.65.1
+## 0.65.1 (2021-05-11)
### Security fixes
* 📌 Upgrade pydantic pin, to handle security vulnerability [CVE-2021-29510](https://github.com/pydantic/pydantic/security/advisories/GHSA-5jqp-qgf6-3pvh). PR [#3213](https://github.com/tiangolo/fastapi/pull/3213) by [@tiangolo](https://github.com/tiangolo).
-## 0.65.0
+## 0.65.0 (2021-05-10)
### Breaking Changes - Upgrade
@@ -5201,7 +5344,7 @@ Thanks to [Dima Boger](https://x.com/b0g3r) for the security report! 🙇🔒
* 👥 Update FastAPI People. PR [#3189](https://github.com/tiangolo/fastapi/pull/3189) by [@github-actions[bot]](https://github.com/apps/github-actions).
* 🔊 Update FastAPI People to allow better debugging. PR [#3188](https://github.com/tiangolo/fastapi/pull/3188) by [@tiangolo](https://github.com/tiangolo).
-## 0.64.0
+## 0.64.0 (2021-05-07)
### Features
@@ -5281,7 +5424,7 @@ Thanks to [Dima Boger](https://x.com/b0g3r) for the security report! 🙇🔒
* 🔧 Update InvestSuite sponsor data. PR [#2608](https://github.com/tiangolo/fastapi/pull/2608) by [@tiangolo](https://github.com/tiangolo).
* 👥 Update FastAPI People. PR [#2590](https://github.com/tiangolo/fastapi/pull/2590) by [@github-actions[bot]](https://github.com/apps/github-actions).
-## 0.63.0
+## 0.63.0 (2020-12-20)
### Features
@@ -5320,7 +5463,7 @@ Thanks to [Dima Boger](https://x.com/b0g3r) for the security report! 🙇🔒
* ✨ Add new Gold Sponsor: InvestSuite 🎉. PR [#2508](https://github.com/tiangolo/fastapi/pull/2508) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Add issue template configs. PR [#2476](https://github.com/tiangolo/fastapi/pull/2476) by [@tiangolo](https://github.com/tiangolo).
-## 0.62.0
+## 0.62.0 (2020-11-29)
### Features
@@ -5406,10 +5549,10 @@ Note: all the previous parameters are still there, so it's still possible to dec
### Docs
* PR [#2434](https://github.com/tiangolo/fastapi/pull/2434) (above) includes new or updated docs:
- *
Advanced User Guide - OpenAPI Callbacks.
- *
Tutorial - Bigger Applications.
- *
Tutorial - Dependencies - Dependencies in path operation decorators.
- *
Tutorial - Dependencies - Global Dependencies.
+ * [Advanced User Guide - OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/).
+ * [Tutorial - Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/).
+ * [Tutorial - Dependencies - Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/).
+ * [Tutorial - Dependencies - Global Dependencies](https://fastapi.tiangolo.com/tutorial/dependencies/global-dependencies/).
* 📝 Add FastAPI monitoring blog post to External Links. PR [#2324](https://github.com/tiangolo/fastapi/pull/2324) by [@louisguitton](https://github.com/louisguitton).
* ✏️ Fix typo in Deta tutorial. PR [#2320](https://github.com/tiangolo/fastapi/pull/2320) by [@tiangolo](https://github.com/tiangolo).
@@ -5436,7 +5579,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* ✨ Add silver sponsor WeTransfer. PR [#2338](https://github.com/tiangolo/fastapi/pull/2338) by [@tiangolo](https://github.com/tiangolo).
* ✨ Set up and enable Material for MkDocs Insiders for the docs. PR [#2325](https://github.com/tiangolo/fastapi/pull/2325) by [@tiangolo](https://github.com/tiangolo).
-## 0.61.2
+## 0.61.2 (2020-11-05)
### Fixes
@@ -5518,7 +5661,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* 👷 Add GitHub Action Latest Changes. PR [#2160](https://github.com/tiangolo/fastapi/pull/2160).
* 👷 Add GitHub Action Label Approved. PR [#2161](https://github.com/tiangolo/fastapi/pull/2161).
-## 0.61.1
+## 0.61.1 (2020-08-29)
### Fixes
@@ -5538,7 +5681,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Improve docs maintainability by updating `hl_lines` syntax to use ranges. PR [#1863](https://github.com/tiangolo/fastapi/pull/1863) by [@la-mar](https://github.com/la-mar).
-## 0.61.0
+## 0.61.0 (2020-08-09)
### Features
@@ -5571,7 +5714,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add Flake8 linting. Original PR [#1774](https://github.com/tiangolo/fastapi/pull/1774) by [@MashhadiNima](https://github.com/MashhadiNima).
* Disable Gitter bot, as it's currently broken, and Gitter's response doesn't show the problem. PR [#1853](https://github.com/tiangolo/fastapi/pull/1853).
-## 0.60.2
+## 0.60.2 (2020-08-08)
* Fix typo in docs for query parameters. PR [#1832](https://github.com/tiangolo/fastapi/pull/1832) by [@ycd](https://github.com/ycd).
* Add docs about [Async Tests](https://fastapi.tiangolo.com/advanced/async-tests/). PR [#1619](https://github.com/tiangolo/fastapi/pull/1619) by [@empicano](https://github.com/empicano).
@@ -5600,7 +5743,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Remove docs preview comment from each commit. PR [#1826](https://github.com/tiangolo/fastapi/pull/1826).
* Update GitHub context extraction for Gitter notification bot. PR [#1766](https://github.com/tiangolo/fastapi/pull/1766).
-## 0.60.1
+## 0.60.1 (2020-07-22)
* Add debugging logs for GitHub actions to introspect GitHub hidden context. PR [#1764](https://github.com/tiangolo/fastapi/pull/1764).
* Use OS preference theme for online docs. PR [#1760](https://github.com/tiangolo/fastapi/pull/1760) by [@adriencaccia](https://github.com/adriencaccia).
@@ -5609,7 +5752,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Update GitHub Actions, use commit from PR for docs preview, not commit from pre-merge. PR [#1761](https://github.com/tiangolo/fastapi/pull/1761).
* Update GitHub Actions, refactor Gitter bot. PR [#1746](https://github.com/tiangolo/fastapi/pull/1746).
-## 0.60.0
+## 0.60.0 (2020-07-20)
* Add GitHub Action to watch for missing preview docs and trigger a preview deploy. PR [#1740](https://github.com/tiangolo/fastapi/pull/1740).
* Add custom GitHub Action to get artifact with docs preview. PR [#1739](https://github.com/tiangolo/fastapi/pull/1739).
@@ -5619,7 +5762,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add GitHub Actions for CI, move from Travis. PR [#1735](https://github.com/tiangolo/fastapi/pull/1735).
* Add support for adding OpenAPI schema for GET requests with a body. PR [#1626](https://github.com/tiangolo/fastapi/pull/1626) by [@victorphoenix3](https://github.com/victorphoenix3).
-## 0.59.0
+## 0.59.0 (2020-07-10)
* Fix typo in docstring for OAuth2 utils. PR [#1621](https://github.com/tiangolo/fastapi/pull/1621) by [@tomarv2](https://github.com/tomarv2).
* Update JWT docs to use Python-jose instead of PyJWT. Initial PR [#1610](https://github.com/tiangolo/fastapi/pull/1610) by [@asheux](https://github.com/asheux).
@@ -5637,7 +5780,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Pin dependencies. PR [#1697](https://github.com/tiangolo/fastapi/pull/1697).
* Update isort to version 5.x.x. PR [#1670](https://github.com/tiangolo/fastapi/pull/1670) by [@asheux](https://github.com/asheux).
-## 0.58.1
+## 0.58.1 (2020-06-28)
* Add link in docs to Pydantic data types. PR [#1612](https://github.com/tiangolo/fastapi/pull/1612) by [@tayoogunbiyi](https://github.com/tayoogunbiyi).
* Fix link in warning logs for `openapi_prefix`. PR [#1611](https://github.com/tiangolo/fastapi/pull/1611) by [@bavaria95](https://github.com/bavaria95).
@@ -5652,7 +5795,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add translation to Chinese for [Path Parameters and Numeric Validations - 路径参数和数值校验](https://fastapi.tiangolo.com/zh/tutorial/path-params-numeric-validations/). PR [#1506](https://github.com/tiangolo/fastapi/pull/1506) by [@waynerv](https://github.com/waynerv).
* Add GitHub action to auto-label approved PRs (mainly for translations). PR [#1638](https://github.com/tiangolo/fastapi/pull/1638).
-## 0.58.0
+## 0.58.0 (2020-06-15)
* Deep merge OpenAPI responses to preserve all the additional metadata. PR [#1577](https://github.com/tiangolo/fastapi/pull/1577).
* Mention in docs that only main app events are run (not sub-apps). PR [#1554](https://github.com/tiangolo/fastapi/pull/1554) by [@amacfie](https://github.com/amacfie).
@@ -5661,7 +5804,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix Model for JSON Schema keyword `not` as a JSON Schema instead of a list. PR [#1548](https://github.com/tiangolo/fastapi/pull/1548) by [@v-do](https://github.com/v-do).
* Add support for OpenAPI `servers`. PR [#1547](https://github.com/tiangolo/fastapi/pull/1547) by [@mikaello](https://github.com/mikaello).
-## 0.57.0
+## 0.57.0 (2020-06-13)
* Remove broken link from "External Links". PR [#1565](https://github.com/tiangolo/fastapi/pull/1565) by [@victorphoenix3](https://github.com/victorphoenix3).
* Update/fix docs for [WebSockets with dependencies](https://fastapi.tiangolo.com/advanced/websockets/#using-depends-and-others). Original PR [#1540](https://github.com/tiangolo/fastapi/pull/1540) by [@ChihSeanHsu](https://github.com/ChihSeanHsu).
@@ -5683,7 +5826,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Remove obsolete Chinese articles after adding official community translations. PR [#1510](https://github.com/tiangolo/fastapi/pull/1510) by [@waynerv](https://github.com/waynerv).
* Add `__repr__` for *path operation function* parameter helpers (like `Query`, `Depends`, etc) to simplify debugging. PR [#1560](https://github.com/tiangolo/fastapi/pull/1560) by [@rkbeatss](https://github.com/rkbeatss) and [@victorphoenix3](https://github.com/victorphoenix3).
-## 0.56.1
+## 0.56.1 (2020-06-12)
* Add link to advanced docs from tutorial. PR [#1512](https://github.com/tiangolo/fastapi/pull/1512) by [@kx-chen](https://github.com/kx-chen).
* Remove internal unnecessary f-strings. PR [#1526](https://github.com/tiangolo/fastapi/pull/1526) by [@kotamatsuoka](https://github.com/kotamatsuoka).
@@ -5703,7 +5846,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Remove `*,` from functions in docs where it's not needed. PR [#1239](https://github.com/tiangolo/fastapi/pull/1239) by [@pankaj-giri](https://github.com/pankaj-giri).
* Start translations for Italian. PR [#1557](https://github.com/tiangolo/fastapi/pull/1557) by [@csr](https://github.com/csr).
-## 0.56.0
+## 0.56.0 (2020-06-11)
* Add support for ASGI `root_path`:
* Use `root_path` internally for mounted applications, so that OpenAPI and the docs UI works automatically without extra configurations and parameters.
@@ -5733,11 +5876,11 @@ Note: all the previous parameters are still there, so it's still possible to dec
* PR [#1467](https://github.com/tiangolo/fastapi/pull/1467).
* Add translation to Chinese for [Python Types Intro - Python 类型提示简介](https://fastapi.tiangolo.com/zh/python-types/). PR [#1197](https://github.com/tiangolo/fastapi/pull/1197) by [@waynerv](https://github.com/waynerv).
-## 0.55.1
+## 0.55.1 (2020-05-23)
* Fix handling of enums with their own schema in path parameters. To support [pydantic/pydantic#1432](https://github.com/pydantic/pydantic/pull/1432) in FastAPI. PR [#1463](https://github.com/tiangolo/fastapi/pull/1463).
-## 0.55.0
+## 0.55.0 (2020-05-23)
* Allow enums to allow them to have their own schemas in OpenAPI. To support [pydantic/pydantic#1432](https://github.com/pydantic/pydantic/pull/1432) in FastAPI. PR [#1461](https://github.com/tiangolo/fastapi/pull/1461).
* Add links for funding through [GitHub sponsors](https://github.com/sponsors/tiangolo). PR [#1425](https://github.com/tiangolo/fastapi/pull/1425).
@@ -5753,7 +5896,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Update order of execution for `get_db` in SQLAlchemy tutorial. PR [#1293](https://github.com/tiangolo/fastapi/pull/1293) by [@bcb](https://github.com/bcb).
* Fix typos in Async docs. PR [#1423](https://github.com/tiangolo/fastapi/pull/1423).
-## 0.54.2
+## 0.54.2 (2020-05-16)
* Add translation to Spanish for [Concurrency and async / await - Concurrencia y async / await](https://fastapi.tiangolo.com/es/async/). PR [#1290](https://github.com/tiangolo/fastapi/pull/1290) by [@alvaropernas](https://github.com/alvaropernas).
* Remove obsolete vote link. PR [#1289](https://github.com/tiangolo/fastapi/pull/1289) by [@donhui](https://github.com/donhui).
@@ -5773,12 +5916,12 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add Spanish translation for [Introducción a los Tipos de Python (Python Types Intro)](https://fastapi.tiangolo.com/es/python-types/). PR [#1237](https://github.com/tiangolo/fastapi/pull/1237) by [@mariacamilagl](https://github.com/mariacamilagl).
* Add Spanish translation for [Características (Features)](https://fastapi.tiangolo.com/es/features/). PR [#1220](https://github.com/tiangolo/fastapi/pull/1220) by [@mariacamilagl](https://github.com/mariacamilagl).
-## 0.54.1
+## 0.54.1 (2020-04-08)
* Update database test setup. PR [#1226](https://github.com/tiangolo/fastapi/pull/1226).
* Improve test debugging by showing response text in failing tests. PR [#1222](https://github.com/tiangolo/fastapi/pull/1222) by [@samuelcolvin](https://github.com/samuelcolvin).
-## 0.54.0
+## 0.54.0 (2020-04-05)
* Fix grammatical mistakes in async docs. PR [#1188](https://github.com/tiangolo/fastapi/pull/1188) by [@mickeypash](https://github.com/mickeypash).
* Add support for `response_model_exclude_defaults` and `response_model_exclude_none`:
@@ -5793,7 +5936,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add first translation to Spanish [FastAPI](https://fastapi.tiangolo.com/es/). PR [#1201](https://github.com/tiangolo/fastapi/pull/1201) by [@mariacamilagl](https://github.com/mariacamilagl).
* Add docs about [Settings and Environment Variables](https://fastapi.tiangolo.com/advanced/settings/). Initial PR [1118](https://github.com/tiangolo/fastapi/pull/1118) by [@alexmitelman](https://github.com/alexmitelman).
-## 0.53.2
+## 0.53.2 (2020-03-30)
* Fix automatic embedding of body fields for dependencies and sub-dependencies. Original PR [#1079](https://github.com/tiangolo/fastapi/pull/1079) by [@Toad2186](https://github.com/Toad2186).
* Fix dependency overrides in WebSocket testing. PR [#1122](https://github.com/tiangolo/fastapi/pull/1122) by [@amitlissack](https://github.com/amitlissack).
@@ -5801,7 +5944,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Start translations for Chinese. PR [#1187](https://github.com/tiangolo/fastapi/pull/1187) by [@RunningIkkyu](https://github.com/RunningIkkyu).
* Add docs for [Schema Extra - Example](https://fastapi.tiangolo.com/tutorial/schema-extra-example/). PR [#1185](https://github.com/tiangolo/fastapi/pull/1185).
-## 0.53.1
+## 0.53.1 (2020-03-29)
* Fix included example after translations refactor. PR [#1182](https://github.com/tiangolo/fastapi/pull/1182).
* Add docs example for `example` in `Field`. Docs at [Body - Fields: JSON Schema extras](https://fastapi.tiangolo.com/tutorial/body-fields/#json-schema-extras). PR [#1106](https://github.com/tiangolo/fastapi/pull/1106) by [@JohnPaton](https://github.com/JohnPaton).
@@ -5810,7 +5953,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix typo in docs. PR [#1148](https://github.com/tiangolo/fastapi/pull/1148) by [@PLNech](https://github.com/PLNech).
* Update Windows development environment instructions. PR [#1179](https://github.com/tiangolo/fastapi/pull/1179).
-## 0.53.0
+## 0.53.0 (2020-03-27)
* Update test coverage badge. PR [#1175](https://github.com/tiangolo/fastapi/pull/1175).
* Add `orjson` to `pip install fastapi[all]`. PR [#1161](https://github.com/tiangolo/fastapi/pull/1161) by [@michael0liver](https://github.com/michael0liver).
@@ -5825,11 +5968,11 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add support for docs translations. New docs: [Development - Contributing: Docs: Translations](https://fastapi.tiangolo.com/contributing/#translations). PR [#1168](https://github.com/tiangolo/fastapi/pull/1168).
* Update terminal styles in docs and add note about [**Typer**, the FastAPI of CLIs](https://typer.tiangolo.com/). PR [#1139](https://github.com/tiangolo/fastapi/pull/1139).
-## 0.52.0
+## 0.52.0 (2020-03-01)
* Add new high-performance JSON response class using `orjson`. New docs: [Custom Response - HTML, Stream, File, others: `ORJSONResponse`](https://fastapi.tiangolo.com/advanced/custom-response/#use-orjsonresponse). PR [#1065](https://github.com/tiangolo/fastapi/pull/1065).
-## 0.51.0
+## 0.51.0 (2020-03-01)
* Re-export utils from Starlette:
* This allows using things like `from fastapi.responses import JSONResponse` instead of `from starlette.responses import JSONResponse`.
@@ -5841,7 +5984,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* [Including WSGI - Flask, Django, others](https://fastapi.tiangolo.com/advanced/wsgi/).
* PR [#1064](https://github.com/tiangolo/fastapi/pull/1064).
-## 0.50.0
+## 0.50.0 (2020-02-29)
* Add link to Release Notes from docs about pinning versions for deployment. PR [#1058](https://github.com/tiangolo/fastapi/pull/1058).
* Upgrade code to use the latest version of Starlette, including:
@@ -5851,7 +5994,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* PR [#1057](https://github.com/tiangolo/fastapi/pull/1057).
* Add docs about pinning FastAPI versions for deployment: [Deployment: FastAPI versions](https://fastapi.tiangolo.com/deployment/#fastapi-versions). PR [#1056](https://github.com/tiangolo/fastapi/pull/1056).
-## 0.49.2
+## 0.49.2 (2020-02-29)
* Fix links in release notes. PR [#1052](https://github.com/tiangolo/fastapi/pull/1052) by [@sattosan](https://github.com/sattosan).
* Fix typo in release notes. PR [#1051](https://github.com/tiangolo/fastapi/pull/1051) by [@sattosan](https://github.com/sattosan).
@@ -5861,14 +6004,14 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix accepting valid types for response models, including Python types like `List[int]`. PR [#1017](https://github.com/tiangolo/fastapi/pull/1017) by [@patrickmckenna](https://github.com/patrickmckenna).
* Fix format in SQL tutorial. PR [#1015](https://github.com/tiangolo/fastapi/pull/1015) by [@vegarsti](https://github.com/vegarsti).
-## 0.49.1
+## 0.49.1 (2020-02-28)
* Fix path operation duplicated parameters when used in dependencies and the path operation function. PR [#994](https://github.com/tiangolo/fastapi/pull/994) by [@merowinger92](https://github.com/merowinger92).
* Update Netlify previews deployment GitHub action as the fix is already merged and there's a new release. PR [#1047](https://github.com/tiangolo/fastapi/pull/1047).
* Move mypy configurations to config file. PR [#987](https://github.com/tiangolo/fastapi/pull/987) by [@hukkinj1](https://github.com/hukkinj1).
* Temporary fix to Netlify previews not deployable from PRs from forks. PR [#1046](https://github.com/tiangolo/fastapi/pull/1046) by [@mariacamilagl](https://github.com/mariacamilagl).
-## 0.49.0
+## 0.49.0 (2020-02-16)
* Fix encoding of `pathlib` paths in `jsonable_encoder`. PR [#978](https://github.com/tiangolo/fastapi/pull/978) by [@patrickmckenna](https://github.com/patrickmckenna).
* Add articles to [External Links](https://fastapi.tiangolo.com/external-links/): [PythonのWeb frameworkのパフォーマンス比較 (Django, Flask, responder, FastAPI, japronto)](https://qiita.com/bee2/items/0ad260ab9835a2087dae) and [[FastAPI] Python製のASGI Web フレームワーク FastAPIに入門する](https://qiita.com/bee2/items/75d9c0d7ba20e7a4a0e9). PR [#974](https://github.com/tiangolo/fastapi/pull/974) by [@tokusumi](https://github.com/tokusumi).
@@ -5879,7 +6022,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Update CI to run docs deployment in GitHub actions. PR [#983](https://github.com/tiangolo/fastapi/pull/983).
* Allow `callable`s in *path operation functions*, like functions modified with `functools.partial`. PR [#977](https://github.com/tiangolo/fastapi/pull/977).
-## 0.48.0
+## 0.48.0 (2020-02-04)
* Run linters first in tests to error out faster. PR [#948](https://github.com/tiangolo/fastapi/pull/948).
* Log warning about `email-validator` only when used. PR [#946](https://github.com/tiangolo/fastapi/pull/946).
@@ -5896,12 +6039,12 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix link in middleware docs. PR [#893](https://github.com/tiangolo/fastapi/pull/893) by [@linchiwei123](https://github.com/linchiwei123).
* Rename default API title from "Fast API" to "FastAPI" for consistency. PR [#890](https://github.com/tiangolo/fastapi/pull/890).
-## 0.47.1
+## 0.47.1 (2020-01-18)
* Fix model filtering in `response_model`, cloning sub-models. PR [#889](https://github.com/tiangolo/fastapi/pull/889).
* Fix FastAPI serialization of Pydantic models using ORM mode blocking the event loop. PR [#888](https://github.com/tiangolo/fastapi/pull/888).
-## 0.47.0
+## 0.47.0 (2020-01-18)
* Refactor documentation to make a simpler and shorter [Tutorial - User Guide](https://fastapi.tiangolo.com/tutorial/) and an additional [Advanced User Guide](https://fastapi.tiangolo.com/advanced/) with all the additional docs. PR [#887](https://github.com/tiangolo/fastapi/pull/887).
* Tweak external links, Markdown format, typos. PR [#881](https://github.com/tiangolo/fastapi/pull/881).
@@ -5913,7 +6056,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Setup development environment with Python's Venv and Flit, instead of requiring the extra Pipenv duplicating dependencies. Updated docs: [Development - Contributing](https://fastapi.tiangolo.com/contributing/). PR [#877](https://github.com/tiangolo/fastapi/pull/877).
* Update docs for [HTTP Basic Auth](https://fastapi.tiangolo.com/advanced/security/http-basic-auth/) to improve security against timing attacks. Initial PR [#807](https://github.com/tiangolo/fastapi/pull/807) by [@zwass](https://github.com/zwass).
-## 0.46.0
+## 0.46.0 (2020-01-08)
* Fix typos and tweak configs. PR [#837](https://github.com/tiangolo/fastapi/pull/837).
* Add link to Chinese article in [External Links](https://fastapi.tiangolo.com/external-links/). PR [810](https://github.com/tiangolo/fastapi/pull/810) by [@wxq0309](https://github.com/wxq0309).
@@ -5927,7 +6070,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix Twitter links in docs. PR [#813](https://github.com/tiangolo/fastapi/pull/813) by [@justindujardin](https://github.com/justindujardin).
* Add docs for correctly [using FastAPI with Peewee ORM](https://fastapi.tiangolo.com/advanced/sql-databases-peewee/). Including how to overwrite parts of Peewee to correctly handle async threads. PR [#789](https://github.com/tiangolo/fastapi/pull/789).
-## 0.45.0
+## 0.45.0 (2019-12-11)
* Add support for OpenAPI Callbacks:
* New docs: [OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/).
@@ -5939,7 +6082,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Remove gender bias in docs for handling errors. PR [#780](https://github.com/tiangolo/fastapi/pull/780). Original idea in PR [#761](https://github.com/tiangolo/fastapi/pull/761) by [@classywhetten](https://github.com/classywhetten).
* Rename docs and references to `body-schema` to `body-fields` to keep in line with Pydantic. PR [#746](https://github.com/tiangolo/fastapi/pull/746) by [@prostomarkeloff](https://github.com/prostomarkeloff).
-## 0.44.1
+## 0.44.1 (2019-12-04)
* Add GitHub social preview images to git. PR [#752](https://github.com/tiangolo/fastapi/pull/752).
* Update PyPI "trove classifiers". PR [#751](https://github.com/tiangolo/fastapi/pull/751).
@@ -5947,7 +6090,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Update "new issue" templates. PR [#749](https://github.com/tiangolo/fastapi/pull/749).
* Fix serialization of errors for exotic Pydantic types. PR [#748](https://github.com/tiangolo/fastapi/pull/748) by [@dmontagu](https://github.com/dmontagu).
-## 0.44.0
+## 0.44.0 (2019-11-27)
* Add GitHub action [Issue Manager](https://github.com/tiangolo/issue-manager). PR [#742](https://github.com/tiangolo/fastapi/pull/742).
* Fix typos in docs. PR [734](https://github.com/tiangolo/fastapi/pull/734) by [@bundabrg](https://github.com/bundabrg).
@@ -5960,7 +6103,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix typo in HTTP protocol in CORS example. PR [#647](https://github.com/tiangolo/fastapi/pull/647) by [@forestmonster](https://github.com/forestmonster).
* Add support for Pydantic versions `1.0.0` and above, with temporary (deprecated) backwards compatibility for Pydantic `0.32.2`. PR [#646](https://github.com/tiangolo/fastapi/pull/646) by [@dmontagu](https://github.com/dmontagu).
-## 0.43.0
+## 0.43.0 (2019-11-24)
* Update docs to reduce gender bias. PR [#645](https://github.com/tiangolo/fastapi/pull/645) by [@ticosax](https://github.com/ticosax).
* Add docs about [overriding the `operationId` for all the *path operations*](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#using-the-path-operation-function-name-as-the-operationid) based on their function name. PR [#642](https://github.com/tiangolo/fastapi/pull/642) by [@SKalt](https://github.com/SKalt).
@@ -5970,7 +6113,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add docs for [self-serving docs' (Swagger UI) static assets](https://fastapi.tiangolo.com/advanced/extending-openapi/#self-hosting-javascript-and-css-for-docs), e.g. to use the docs offline, or without Internet. Initial PR [#557](https://github.com/tiangolo/fastapi/pull/557) by [@svalouch](https://github.com/svalouch).
* Fix `black` linting after upgrade. PR [#682](https://github.com/tiangolo/fastapi/pull/682) by [@frankie567](https://github.com/frankie567).
-## 0.42.0
+## 0.42.0 (2019-10-09)
* Add dependencies with `yield`, a.k.a. exit steps, context managers, cleanup, teardown, ...
* This allows adding extra code after a dependency is done. It can be used, for example, to close database connections.
@@ -5985,7 +6128,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* PR [#595](https://github.com/tiangolo/fastapi/pull/595).
* Fix `sitemap.xml` in website. PR [#598](https://github.com/tiangolo/fastapi/pull/598) by [@samuelcolvin](https://github.com/samuelcolvin).
-## 0.41.0
+## 0.41.0 (2019-10-07)
* Upgrade required Starlette to `0.12.9`, the new range is `>=0.12.9,<=0.12.9`.
* Add `State` to FastAPI apps at `app.state`.
@@ -6000,7 +6143,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* PR [#589](https://github.com/tiangolo/fastapi/pull/589) by [@dmontagu](https://github.com/dmontagu).
* Fix preserving custom route class in routers when including other sub-routers. PR [#538](https://github.com/tiangolo/fastapi/pull/538) by [@dmontagu](https://github.com/dmontagu).
-## 0.40.0
+## 0.40.0 (2019-10-04)
* Add notes to docs about installing `python-multipart` when using forms. PR [#574](https://github.com/tiangolo/fastapi/pull/574) by [@sliptonic](https://github.com/sliptonic).
* Generate OpenAPI schemas in alphabetical order. PR [#554](https://github.com/tiangolo/fastapi/pull/554) by [@dmontagu](https://github.com/dmontagu).
@@ -6013,7 +6156,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix incorrect documentation example in [first steps](https://fastapi.tiangolo.com/tutorial/first-steps/). PR [#511](https://github.com/tiangolo/fastapi/pull/511) by [@IgnatovFedor](https://github.com/IgnatovFedor).
* Add support for Swagger UI [initOauth](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/oauth2.md) settings with the parameter `swagger_ui_init_oauth`. PR [#499](https://github.com/tiangolo/fastapi/pull/499) by [@zamiramir](https://github.com/zamiramir).
-## 0.39.0
+## 0.39.0 (2019-09-29)
* Allow path parameters to have default values (e.g. `None`) and discard them instead of raising an error.
* This allows declaring a parameter like `user_id: str = None` that can be taken from a query parameter, but the same *path operation* can be included in a router with a path `/users/{user_id}`, in which case will be taken from the path and will be required.
@@ -6021,17 +6164,17 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add support for setting a `default_response_class` in the `FastAPI` instance or in `include_router`. Initial PR [#467](https://github.com/tiangolo/fastapi/pull/467) by [@toppk](https://github.com/toppk).
* Add support for type annotations using strings and `from __future__ import annotations`. PR [#451](https://github.com/tiangolo/fastapi/pull/451) by [@dmontagu](https://github.com/dmontagu).
-## 0.38.1
+## 0.38.1 (2019-09-01)
* Fix incorrect `Request` class import. PR [#493](https://github.com/tiangolo/fastapi/pull/493) by [@kamalgill](https://github.com/kamalgill).
-## 0.38.0
+## 0.38.0 (2019-08-31)
* Add recent articles to [External Links](https://fastapi.tiangolo.com/external-links/) and recent opinions. PR [#490](https://github.com/tiangolo/fastapi/pull/490).
* Upgrade support range for Starlette to include `0.12.8`. The new range is `>=0.11.1,<=0.12.8"`. PR [#477](https://github.com/tiangolo/fastapi/pull/477) by [@dmontagu](https://github.com/dmontagu).
* Upgrade support to Pydantic version 0.32.2 and update internal code to use it (breaking change). PR [#463](https://github.com/tiangolo/fastapi/pull/463) by [@dmontagu](https://github.com/dmontagu).
-## 0.37.0
+## 0.37.0 (2019-08-31)
* Add support for custom route classes for advanced use cases. PR [#468](https://github.com/tiangolo/fastapi/pull/468) by [@dmontagu](https://github.com/dmontagu).
* Allow disabling Google fonts in ReDoc. PR [#481](https://github.com/tiangolo/fastapi/pull/481) by [@b1-luettje](https://github.com/b1-luettje).
@@ -6047,7 +6190,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix using `"default"` extra response with status codes at the same time. PR [#489](https://github.com/tiangolo/fastapi/pull/489).
* Allow additional responses to use status code ranges (like `5XX` and `4XX`) and `"default"`. PR [#435](https://github.com/tiangolo/fastapi/pull/435) by [@divums](https://github.com/divums).
-## 0.36.0
+## 0.36.0 (2019-08-26)
* Fix implementation for `skip_defaults` when returning a Pydantic model. PR [#422](https://github.com/tiangolo/fastapi/pull/422) by [@dmontagu](https://github.com/dmontagu).
* Fix OpenAPI generation when using the same dependency in multiple places for the same *path operation*. PR [#417](https://github.com/tiangolo/fastapi/pull/417) by [@dmontagu](https://github.com/dmontagu).
@@ -6058,23 +6201,23 @@ Note: all the previous parameters are still there, so it's still possible to dec
* PR [#415](https://github.com/tiangolo/fastapi/pull/415) by [@vitalik](https://github.com/vitalik).
* Fix mypy error after merging PR #415. PR [#462](https://github.com/tiangolo/fastapi/pull/462).
-## 0.35.0
+## 0.35.0 (2019-08-08)
* Fix typo in routing `assert`. PR [#419](https://github.com/tiangolo/fastapi/pull/419) by [@pablogamboa](https://github.com/pablogamboa).
* Fix typo in docs. PR [#411](https://github.com/tiangolo/fastapi/pull/411) by [@bronsen](https://github.com/bronsen).
* Fix parsing a body type declared with `Union`. PR [#400](https://github.com/tiangolo/fastapi/pull/400) by [@koxudaxi](https://github.com/koxudaxi).
-## 0.34.0
+## 0.34.0 (2019-08-06)
* Upgrade Starlette supported range to include the latest `0.12.7`. The new range is `0.11.1,<=0.12.7`. PR [#367](https://github.com/tiangolo/fastapi/pull/367) by [@dedsm](https://github.com/dedsm).
* Add test for OpenAPI schema with duplicate models from PR [#333](https://github.com/tiangolo/fastapi/pull/333) by [@dmontagu](https://github.com/dmontagu). PR [#385](https://github.com/tiangolo/fastapi/pull/385).
-## 0.33.0
+## 0.33.0 (2019-07-13)
* Upgrade Pydantic version to `0.30.0`. PR [#384](https://github.com/tiangolo/fastapi/pull/384) by [@jekirl](https://github.com/jekirl).
-## 0.32.0
+## 0.32.0 (2019-07-12)
* Fix typo in docs for features. PR [#380](https://github.com/tiangolo/fastapi/pull/380) by [@MartinoMensio](https://github.com/MartinoMensio).
@@ -6098,14 +6241,14 @@ Note: all the previous parameters are still there, so it's still possible to dec
* This also adds the possibility of using `.include_router()` with the same `APIRouter` *multiple* times, with different prefixes, e.g. `/api/v2` and `/api/latest`, and it will now work correctly.
* PR [#347](https://github.com/tiangolo/fastapi/pull/347).
-## 0.31.0
+## 0.31.0 (2019-06-28)
* Upgrade Pydantic supported version to `0.29.0`.
* New supported version range is `"pydantic >=0.28,<=0.29.0"`.
* This adds support for Pydantic [Generic Models](https://docs.pydantic.dev/latest/#generic-models), kudos to [@dmontagu](https://github.com/dmontagu).
* PR [#344](https://github.com/tiangolo/fastapi/pull/344).
-## 0.30.1
+## 0.30.1 (2019-06-28)
* Add section in docs about [External Links and Articles](https://fastapi.tiangolo.com/external-links/). PR [#341](https://github.com/tiangolo/fastapi/pull/341).
@@ -6119,7 +6262,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add SQLite [online viewers to the docs](https://fastapi.tiangolo.com/tutorial/sql-databases/#interact-with-the-database-directly). PR [#330](https://github.com/tiangolo/fastapi/pull/330) by [@cyrilbois](https://github.com/cyrilbois).
-## 0.30.0
+## 0.30.0 (2019-06-20)
* Add support for Pydantic's ORM mode:
* Updated documentation about SQL with SQLAlchemy, using Pydantic models with ORM mode, SQLAlchemy models with relations, separation of files, simplification of code and other changes. New docs: [SQL (Relational) Databases](https://fastapi.tiangolo.com/tutorial/sql-databases/).
@@ -6142,7 +6285,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Upgrade Pydantic support to `0.28`. PR [#320](https://github.com/tiangolo/fastapi/pull/320) by [@jekirl](https://github.com/jekirl).
-## 0.29.1
+## 0.29.1 (2019-06-13)
* Fix handling an empty-body request with a required body param. PR [#311](https://github.com/tiangolo/fastapi/pull/311).
@@ -6150,7 +6293,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix docs discrepancy in docs for [Response Model](https://fastapi.tiangolo.com/tutorial/response-model/). PR [#288](https://github.com/tiangolo/fastapi/pull/288) by [@awiddersheim](https://github.com/awiddersheim).
-## 0.29.0
+## 0.29.0 (2019-06-06)
* Add support for declaring a `Response` parameter:
* This allows declaring:
@@ -6161,7 +6304,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Update attribution to Hug, for inspiring the `response` parameter pattern.
* PR [#294](https://github.com/tiangolo/fastapi/pull/294).
-## 0.28.0
+## 0.28.0 (2019-06-05)
* Implement dependency cache per request.
* This avoids calling each dependency multiple times for the same request.
@@ -6176,17 +6319,17 @@ Note: all the previous parameters are still there, so it's still possible to dec
* New docs: [Testing Dependencies with Overrides](https://fastapi.tiangolo.com/advanced/testing-dependencies/).
* PR [#291](https://github.com/tiangolo/fastapi/pull/291).
-## 0.27.2
+## 0.27.2 (2019-06-03)
* Fix path and query parameters receiving `dict` as a valid type. It should be mapped to a body payload. PR [#287](https://github.com/tiangolo/fastapi/pull/287). Updated docs at: [Query parameter list / multiple values with defaults: Using `list`](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#using-list).
-## 0.27.1
+## 0.27.1 (2019-06-03)
* Fix `auto_error=False` handling in `HTTPBearer` security scheme. Do not `raise` when there's an incorrect `Authorization` header if `auto_error=False`. PR [#282](https://github.com/tiangolo/fastapi/pull/282).
* Fix type declaration of `HTTPException`. PR [#279](https://github.com/tiangolo/fastapi/pull/279).
-## 0.27.0
+## 0.27.0 (2019-05-30)
* Fix broken link in docs about OAuth 2.0 with scopes. PR [#275](https://github.com/tiangolo/fastapi/pull/275) by [@dmontagu](https://github.com/dmontagu).
@@ -6197,7 +6340,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add support for type annotations using `Optional` as in `param: Optional[str] = None`. New documentation: [Optional type declarations](https://fastapi.tiangolo.com/tutorial/query-params/#optional-type-declarations).
* PR [#278](https://github.com/tiangolo/fastapi/pull/278).
-## 0.26.0
+## 0.26.0 (2019-05-29)
* Separate error handling for validation errors.
* This will allow developers to customize the exception handlers.
@@ -6218,7 +6361,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix type declaration of `response_model` to allow generic Python types as `List[Model]`. Mainly to fix `mypy` for users. PR [#266](https://github.com/tiangolo/fastapi/pull/266).
-## 0.25.0
+## 0.25.0 (2019-05-27)
* Add support for Pydantic's `include`, `exclude`, `by_alias`.
* Update documentation: [Response Model](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude).
@@ -6234,7 +6377,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* New [documentation section about using `response_model_skip_defaults`](https://fastapi.tiangolo.com/tutorial/response-model/#response-model-encoding-parameters).
* PR [#248](https://github.com/tiangolo/fastapi/pull/248) by [@wshayes](https://github.com/wshayes).
-## 0.24.0
+## 0.24.0 (2019-05-24)
* Add support for WebSockets with dependencies and parameters.
* Support included for:
@@ -6252,7 +6395,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* This includes JSON Schema support for IP address and network objects, bug fixes, and other features.
* PR [#247](https://github.com/tiangolo/fastapi/pull/247) by [@euri10](https://github.com/euri10).
-## 0.23.0
+## 0.23.0 (2019-05-21)
* Upgrade the compatible version of Starlette to `0.12.0`.
* This includes support for ASGI 3 (the latest version of the standard).
@@ -6270,7 +6413,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Make Swagger UI and ReDoc URLs parameterizable, allowing to host and serve local versions of them and have offline docs. PR [#112](https://github.com/tiangolo/fastapi/pull/112) by [@euri10](https://github.com/euri10).
-## 0.22.0
+## 0.22.0 (2019-05-16)
* Add support for `dependencies` parameter:
* A parameter in *path operation decorators*, for dependencies that should be executed but the return value is not important or not used in the *path operation function*.
@@ -6292,7 +6435,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Re-enable `black` formatting checks for Python 3.7. PR [#229](https://github.com/tiangolo/fastapi/pull/229) by [@zamiramir](https://github.com/zamiramir).
-## 0.21.0
+## 0.21.0 (2019-05-15)
* On body parsing errors, raise `from` previous exception, to allow better introspection in logging code. PR [#192](https://github.com/tiangolo/fastapi/pull/195) by [@ricardomomm](https://github.com/ricardomomm).
@@ -6302,13 +6445,13 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix typo in routing. PR [#221](https://github.com/tiangolo/fastapi/pull/221) by [@djlambert](https://github.com/djlambert).
-## 0.20.1
+## 0.20.1 (2019-05-11)
* Add typing information to package including file `py.typed`. PR [#209](https://github.com/tiangolo/fastapi/pull/209) by [@meadsteve](https://github.com/meadsteve).
* Add FastAPI bot for Gitter. To automatically announce new releases. PR [#189](https://github.com/tiangolo/fastapi/pull/189).
-## 0.20.0
+## 0.20.0 (2019-04-27)
* Upgrade OAuth2:
* Upgrade Password flow using Bearer tokens to use the correct HTTP status code 401 `UNAUTHORIZED`, with `WWW-Authenticate` headers.
@@ -6325,7 +6468,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix typos in docs. PR [#176](https://github.com/tiangolo/fastapi/pull/176) by [@chdsbd](https://github.com/chdsbd).
-## 0.19.0
+## 0.19.0 (2019-04-26)
* Rename *path operation decorator* parameter `content_type` to `response_class`. PR [#183](https://github.com/tiangolo/fastapi/pull/183).
@@ -6335,7 +6478,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Update how to use a [Custom Response Class](https://fastapi.tiangolo.com/advanced/custom-response/).
* PR [#184](https://github.com/tiangolo/fastapi/pull/184).
-## 0.18.0
+## 0.18.0 (2019-04-22)
* Add docs for [HTTP Basic Auth](https://fastapi.tiangolo.com/advanced/custom-response/). PR [#177](https://github.com/tiangolo/fastapi/pull/177).
@@ -6345,7 +6488,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add docs for [Middleware](https://fastapi.tiangolo.com/tutorial/middleware/). PR [#173](https://github.com/tiangolo/fastapi/pull/173).
-## 0.17.0
+## 0.17.0 (2019-04-20)
* Make Flit publish from CI. PR [#170](https://github.com/tiangolo/fastapi/pull/170).
@@ -6353,7 +6496,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* By default, encode by alias. This allows using Pydantic `alias` parameters working by default. PR [#168](https://github.com/tiangolo/fastapi/pull/168).
-## 0.16.0
+## 0.16.0 (2019-04-16)
* Upgrade *path operation* `docstring` parsing to support proper Markdown descriptions. New documentation at [Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#description-from-docstring). PR [#163](https://github.com/tiangolo/fastapi/pull/163).
@@ -6365,13 +6508,13 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix [Query Parameters](https://fastapi.tiangolo.com/tutorial/query-params/) URL examples in docs. PR [#157](https://github.com/tiangolo/fastapi/pull/157) by [@hayata-yamamoto](https://github.com/hayata-yamamoto).
-## 0.15.0
+## 0.15.0 (2019-04-14)
* Add support for multiple file uploads (as a single form field). New docs at: [Multiple file uploads](https://fastapi.tiangolo.com/tutorial/request-files/#multiple-file-uploads). PR [#158](https://github.com/tiangolo/fastapi/pull/158).
* Add docs for: [Additional Status Codes](https://fastapi.tiangolo.com/advanced/additional-status-codes/). PR [#156](https://github.com/tiangolo/fastapi/pull/156).
-## 0.14.0
+## 0.14.0 (2019-04-12)
* Improve automatically generated names of *path operations* in OpenAPI (in API docs). A function `read_items` instead of having a generated name "Read Items Get" will have "Read Items". PR [#155](https://github.com/tiangolo/fastapi/pull/155).
@@ -6383,7 +6526,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Include Falcon and Hug in: [Alternatives, Inspiration and Comparisons](https://fastapi.tiangolo.com/alternatives/).
-## 0.13.0
+## 0.13.0 (2019-04-09)
* Improve/upgrade OAuth2 scopes support with `SecurityScopes`:
* `SecurityScopes` can be declared as a parameter like `Request`, to get the scopes of all super-dependencies/dependants.
@@ -6393,7 +6536,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* New docs about: [OAuth2 scopes](https://fastapi.tiangolo.com/advanced/security/oauth2-scopes/).
* PR [#141](https://github.com/tiangolo/fastapi/pull/141).
-## 0.12.1
+## 0.12.1 (2019-04-05)
* Fix bug: handling additional `responses` in `APIRouter.include_router()`. PR [#140](https://github.com/tiangolo/fastapi/pull/140).
@@ -6401,7 +6544,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix typos in section about nested models and OAuth2 with JWT. PR [#127](https://github.com/tiangolo/fastapi/pull/127) by [@mmcloud](https://github.com/mmcloud).
-## 0.12.0
+## 0.12.0 (2019-04-05)
* Add additional `responses` parameter to *path operation decorators* to extend responses in OpenAPI (and API docs).
* It also allows extending existing responses generated from `response_model`, declare other media types (like images), etc.
@@ -6410,7 +6553,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* PR [#97](https://github.com/tiangolo/fastapi/pull/97) originally initiated by [@barsi](https://github.com/barsi).
* Update `scripts/test-cov-html.sh` to allow passing extra parameters like `-vv`, for development.
-## 0.11.0
+## 0.11.0 (2019-04-03)
* Add `auto_error` parameter to security utility functions. Allowing them to be optional. Also allowing to have multiple alternative security schemes that are then checked in a single dependency instead of each one verifying and returning the error to the client automatically when not satisfied. PR [#134](https://github.com/tiangolo/fastapi/pull/134).
@@ -6418,7 +6561,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix duplicate dependency in `pyproject.toml`. PR [#128](https://github.com/tiangolo/fastapi/pull/128) by [@zxalif](https://github.com/zxalif).
-## 0.10.3
+## 0.10.3 (2019-03-30)
* Add Gitter chat, badge, links, etc. [https://gitter.im/tiangolo/fastapi](https://gitter.im/tiangolo/fastapi) . PR [#117](https://github.com/tiangolo/fastapi/pull/117).
@@ -6432,7 +6575,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix event docs (startup/shutdown) function name. PR [#105](https://github.com/tiangolo/fastapi/pull/105) by [@stratosgear](https://github.com/stratosgear).
-## 0.10.2
+## 0.10.2 (2019-03-29)
* Fix OpenAPI (JSON Schema) for declarations of Python `Union` (JSON Schema `additionalProperties`). PR [#121](https://github.com/tiangolo/fastapi/pull/121).
@@ -6440,11 +6583,11 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Document response models using unions and lists, updated at: [Extra Models](https://fastapi.tiangolo.com/tutorial/extra-models/). PR [#108](https://github.com/tiangolo/fastapi/pull/108).
-## 0.10.1
+## 0.10.1 (2019-03-25)
* Add docs and tests for [encode/databases](https://github.com/encode/databases). New docs at: [Async SQL (Relational) Databases](https://fastapi.tiangolo.com/advanced/async-sql-databases/). PR [#107](https://github.com/tiangolo/fastapi/pull/107).
-## 0.10.0
+## 0.10.0 (2019-03-24)
* Add support for Background Tasks in *path operation functions* and dependencies. New documentation about [Background Tasks is here](https://fastapi.tiangolo.com/tutorial/background-tasks/). PR [#103](https://github.com/tiangolo/fastapi/pull/103).
@@ -6452,11 +6595,11 @@ Note: all the previous parameters are still there, so it's still possible to dec
* New docs section about [Events: startup - shutdown](https://fastapi.tiangolo.com/advanced/events/). PR [#99](https://github.com/tiangolo/fastapi/pull/99).
-## 0.9.1
+## 0.9.1 (2019-03-22)
* Document receiving [Multiple values with the same query parameter](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#query-parameter-list-multiple-values) and [Duplicate headers](https://fastapi.tiangolo.com/tutorial/header-params/#duplicate-headers). PR [#95](https://github.com/tiangolo/fastapi/pull/95).
-## 0.9.0
+## 0.9.0 (2019-03-22)
* Upgrade compatible Pydantic version to `0.21.0`. PR [#90](https://github.com/tiangolo/fastapi/pull/90).
@@ -6466,7 +6609,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Fix link in "Deployment" to "Bigger Applications".
-## 0.8.0
+## 0.8.0 (2019-03-16)
* Make development scripts executable. PR [#76](https://github.com/tiangolo/fastapi/pull/76) by [@euri10](https://github.com/euri10).
@@ -6476,7 +6619,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Update `isort` imports and scripts to be compatible with newer versions. PR [#75](https://github.com/tiangolo/fastapi/pull/75).
-## 0.7.1
+## 0.7.1 (2019-03-04)
* Update [technical details about `async def` handling](https://fastapi.tiangolo.com/async/#path-operation-functions) with respect to previous frameworks. PR [#64](https://github.com/tiangolo/fastapi/pull/64) by [@haizaar](https://github.com/haizaar).
@@ -6484,7 +6627,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Trigger Docker images build on Travis CI automatically. PR [#65](https://github.com/tiangolo/fastapi/pull/65).
-## 0.7.0
+## 0.7.0 (2019-03-03)
* Add support for `UploadFile` in `File` parameter annotations.
* This includes a file-like interface.
@@ -6492,7 +6635,7 @@ Note: all the previous parameters are still there, so it's still possible to dec
* And here's the updated documentation for using [`Form` parameters mixed with `File` parameters, supporting `bytes` and `UploadFile`](https://fastapi.tiangolo.com/tutorial/request-forms-and-files/) at the same time.
* PR [#63](https://github.com/tiangolo/fastapi/pull/63).
-## 0.6.4
+## 0.6.4 (2019-03-02)
* Add [technical details about `async def` handling to docs](https://fastapi.tiangolo.com/async/#very-technical-details). PR [#61](https://github.com/tiangolo/fastapi/pull/61).
@@ -6506,11 +6649,11 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Add docs for using [WebSockets with **FastAPI**](https://fastapi.tiangolo.com/advanced/websockets/). PR [#62](https://github.com/tiangolo/fastapi/pull/62).
-## 0.6.3
+## 0.6.3 (2019-02-23)
* Add Favicons to docs. PR [#53](https://github.com/tiangolo/fastapi/pull/53).
-## 0.6.2
+## 0.6.2 (2019-02-23)
* Introduce new project generator based on FastAPI and PostgreSQL: [https://github.com/tiangolo/full-stack-fastapi-postgresql](https://github.com/tiangolo/full-stack-fastapi-postgresql). PR [#52](https://github.com/tiangolo/fastapi/pull/52).
@@ -6518,17 +6661,17 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Improve middleware naming in tutorial for SQL with SQLAlchemy [https://fastapi.tiangolo.com/tutorial/sql-databases/](https://fastapi.tiangolo.com/tutorial/sql-databases/).
-## 0.6.1
+## 0.6.1 (2019-02-20)
* Add docs for GraphQL: [https://fastapi.tiangolo.com/advanced/graphql/](https://fastapi.tiangolo.com/advanced/graphql/). PR [#48](https://github.com/tiangolo/fastapi/pull/48).
-## 0.6.0
+## 0.6.0 (2019-02-19)
* Update SQL with SQLAlchemy tutorial at [https://fastapi.tiangolo.com/tutorial/sql-databases/](https://fastapi.tiangolo.com/tutorial/sql-databases/) using the new official `request.state`. PR [#45](https://github.com/tiangolo/fastapi/pull/45).
* Upgrade Starlette to version `0.11.1` and add required compatibility changes. PR [#44](https://github.com/tiangolo/fastapi/pull/44).
-## 0.5.1
+## 0.5.1 (2019-02-18)
* Add section about [helping and getting help with **FastAPI**](https://fastapi.tiangolo.com/help-fastapi/).
@@ -6536,9 +6679,9 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Update [section about error handling](https://fastapi.tiangolo.com/tutorial/handling-errors/) with more information and make relation with Starlette error handling utilities more explicit. PR [#41](https://github.com/tiangolo/fastapi/pull/41).
-* Add
Development - Contributing section to the docs. PR [#42](https://github.com/tiangolo/fastapi/pull/42).
+* Add [Development - Contributing section to the docs](). PR [#42](https://github.com/tiangolo/fastapi/pull/42).
-## 0.5.0
+## 0.5.0 (2019-02-16)
* Add new `HTTPException` with support for custom headers. With new documentation for handling errors at: [https://fastapi.tiangolo.com/tutorial/handling-errors/](https://fastapi.tiangolo.com/tutorial/handling-errors/). PR [#35](https://github.com/tiangolo/fastapi/pull/35).
@@ -6548,26 +6691,26 @@ Note: all the previous parameters are still there, so it's still possible to dec
* Update example for the SQLAlchemy tutorial at [https://fastapi.tiangolo.com/tutorial/sql-databases/](https://fastapi.tiangolo.com/tutorial/sql-databases/) using middleware and database session attached to request.
-## 0.4.0
+## 0.4.0 (2019-02-16)
* Add `openapi_prefix`, support for reverse proxy and mounting sub-applications. See the docs at [https://fastapi.tiangolo.com/advanced/sub-applications-proxy/](https://fastapi.tiangolo.com/advanced/sub-applications-proxy/): [#26](https://github.com/tiangolo/fastapi/pull/26) by [@kabirkhan](https://github.com/kabirkhan).
* Update [docs/tutorial for SQLAlchemy](https://fastapi.tiangolo.com/tutorial/sql-databases/) including note about _DB Browser for SQLite_.
-## 0.3.0
+## 0.3.0 (2019-02-12)
* Fix/add SQLAlchemy support, including ORM, and update [docs for SQLAlchemy](https://fastapi.tiangolo.com/tutorial/sql-databases/): [#30](https://github.com/tiangolo/fastapi/pull/30).
-## 0.2.1
+## 0.2.1 (2019-02-12)
* Fix `jsonable_encoder` for Pydantic models with `Config` but without `json_encoders`: [#29](https://github.com/tiangolo/fastapi/pull/29).
-## 0.2.0
+## 0.2.0 (2019-02-08)
* Fix typos in Security section: [#24](https://github.com/tiangolo/fastapi/pull/24) by [@kkinder](https://github.com/kkinder).
* Add support for Pydantic custom JSON encoders: [#21](https://github.com/tiangolo/fastapi/pull/21) by [@euri10](https://github.com/euri10).
-## 0.1.19
+## 0.1.19 (2019-02-01)
* Upgrade Starlette version to the current latest `0.10.1`: [#17](https://github.com/tiangolo/fastapi/pull/17) by [@euri10](https://github.com/euri10).
diff --git a/docs/en/docs/tutorial/background-tasks.md b/docs/en/docs/tutorial/background-tasks.md
index 163070d3d3..dfb082f34c 100644
--- a/docs/en/docs/tutorial/background-tasks.md
+++ b/docs/en/docs/tutorial/background-tasks.md
@@ -63,7 +63,7 @@ And then another background task generated at the *path operation function* will
## Technical Details { #technical-details }
-The class `BackgroundTasks` comes directly from
`starlette.background`.
+The class `BackgroundTasks` comes directly from [`starlette.background`](https://www.starlette.dev/background/).
It is imported/included directly into FastAPI so that you can import it from `fastapi` and avoid accidentally importing the alternative `BackgroundTask` (without the `s` at the end) from `starlette.background`.
@@ -71,11 +71,11 @@ By only using `BackgroundTasks` (and not `BackgroundTask`), it's then possible t
It's still possible to use `BackgroundTask` alone in FastAPI, but you have to create the object in your code and return a Starlette `Response` including it.
-You can see more details in
Starlette's official docs for Background Tasks.
+You can see more details in [Starlette's official docs for Background Tasks](https://www.starlette.dev/background/).
## Caveat { #caveat }
-If you need to perform heavy background computation and you don't necessarily need it to be run by the same process (for example, you don't need to share memory, variables, etc), you might benefit from using other bigger tools like
Celery.
+If you need to perform heavy background computation and you don't necessarily need it to be run by the same process (for example, you don't need to share memory, variables, etc), you might benefit from using other bigger tools like [Celery](https://docs.celeryq.dev).
They tend to require more complex configurations, a message/job queue manager, like RabbitMQ or Redis, but they allow you to run background tasks in multiple processes, and especially, in multiple servers.
diff --git a/docs/en/docs/tutorial/bigger-applications.md b/docs/en/docs/tutorial/bigger-applications.md
index 7fe83c0635..675ec1b437 100644
--- a/docs/en/docs/tutorial/bigger-applications.md
+++ b/docs/en/docs/tutorial/bigger-applications.md
@@ -123,7 +123,7 @@ We will now use a simple dependency to read a custom `X-Token` header:
We are using an invented header to simplify this example.
-But in real cases you will get better results using the integrated [Security utilities](security/index.md){.internal-link target=_blank}.
+But in real cases you will get better results using the integrated [Security utilities](security/index.md).
///
@@ -169,7 +169,7 @@ And we can add a list of `dependencies` that will be added to all the *path oper
/// tip
-Note that, much like [dependencies in *path operation decorators*](dependencies/dependencies-in-path-operation-decorators.md){.internal-link target=_blank}, no value will be passed to your *path operation function*.
+Note that, much like [dependencies in *path operation decorators*](dependencies/dependencies-in-path-operation-decorators.md), no value will be passed to your *path operation function*.
///
@@ -185,8 +185,8 @@ The end result is that the item paths are now:
* All of them will include the predefined `responses`.
* All these *path operations* will have the list of `dependencies` evaluated/executed before them.
* If you also declare dependencies in a specific *path operation*, **they will be executed too**.
- * The router dependencies are executed first, then the [`dependencies` in the decorator](dependencies/dependencies-in-path-operation-decorators.md){.internal-link target=_blank}, and then the normal parameter dependencies.
- * You can also add [`Security` dependencies with `scopes`](../advanced/security/oauth2-scopes.md){.internal-link target=_blank}.
+ * The router dependencies are executed first, then the [`dependencies` in the decorator](dependencies/dependencies-in-path-operation-decorators.md), and then the normal parameter dependencies.
+ * You can also add [`Security` dependencies with `scopes`](../advanced/security/oauth2-scopes.md).
/// tip
@@ -303,7 +303,7 @@ And as most of your logic will now live in its own specific module, the main fil
You import and create a `FastAPI` class as normally.
-And we can even declare [global dependencies](dependencies/global-dependencies.md){.internal-link target=_blank} that will be combined with the dependencies for each `APIRouter`:
+And we can even declare [global dependencies](dependencies/global-dependencies.md) that will be combined with the dependencies for each `APIRouter`:
{* ../../docs_src/bigger_applications/app_an_py310/main.py hl[1,3,7] title["app/main.py"] *}
@@ -353,7 +353,7 @@ The second version is an "absolute import":
from app.routers import items, users
```
-To learn more about Python Packages and Modules, read
the official Python documentation about Modules.
+To learn more about Python Packages and Modules, read [the official Python documentation about Modules](https://docs.python.org/3/tutorial/modules.html).
///
@@ -465,6 +465,37 @@ As we cannot just isolate them and "mount" them independently of the rest, the *
///
+## Configure the `entrypoint` in `pyproject.toml` { #configure-the-entrypoint-in-pyproject-toml }
+
+As your FastAPI `app` object lives in `app/main.py`, you can configure the `entrypoint` in your `pyproject.toml` file like this:
+
+```toml
+[tool.fastapi]
+entrypoint = "app.main:app"
+```
+
+that is equivalent to importing like:
+
+```python
+from app.main import app
+```
+
+That way the `fastapi` command will know where to find your app.
+
+/// Note
+
+You could also pass the path to the command, like:
+
+```console
+$ fastapi dev app/main.py
+```
+
+But you would have to remember to pass the correct path every time you call the `fastapi` command.
+
+Additionally, other tools might not be able to find it, for example the [VS Code Extension](../editor-support.md) or [FastAPI Cloud](https://fastapicloud.com), so it is recommended to use the `entrypoint` in `pyproject.toml`.
+
+///
+
## Check the automatic API docs { #check-the-automatic-api-docs }
Now, run your app:
@@ -472,14 +503,14 @@ Now, run your app:
```console
-$ fastapi dev app/main.py
+$ fastapi dev
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
-And open the docs at
http://127.0.0.1:8000/docs.
+And open the docs at [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs).
You will see the automatic API docs, including the paths from all the submodules, using the correct paths (and prefixes) and the correct tags:
diff --git a/docs/en/docs/tutorial/body-nested-models.md b/docs/en/docs/tutorial/body-nested-models.md
index b84c9242e9..17c560f40e 100644
--- a/docs/en/docs/tutorial/body-nested-models.md
+++ b/docs/en/docs/tutorial/body-nested-models.md
@@ -96,7 +96,7 @@ Again, doing just that declaration, with **FastAPI** you get:
Apart from normal singular types like `str`, `int`, `float`, etc. you can use more complex singular types that inherit from `str`.
-To see all the options you have, checkout
Pydantic's Type Overview. You will see some examples in the next chapter.
+To see all the options you have, checkout [Pydantic's Type Overview](https://docs.pydantic.dev/latest/concepts/types/). You will see some examples in the next chapter.
For example, as in the `Image` model we have a `url` field, we can declare it to be an instance of Pydantic's `HttpUrl` instead of a `str`:
diff --git a/docs/en/docs/tutorial/body-updates.md b/docs/en/docs/tutorial/body-updates.md
index 1b7fd70661..e45f96c16f 100644
--- a/docs/en/docs/tutorial/body-updates.md
+++ b/docs/en/docs/tutorial/body-updates.md
@@ -2,7 +2,7 @@
## Update replacing with `PUT` { #update-replacing-with-put }
-To update an item you can use the
HTTP `PUT` operation.
+To update an item you can use the [HTTP `PUT`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) operation.
You can use the `jsonable_encoder` to convert the input data to data that can be stored as JSON (e.g. with a NoSQL database). For example, converting `datetime` to `str`.
@@ -28,7 +28,7 @@ And the data would be saved with that "new" `tax` of `10.5`.
## Partial updates with `PATCH` { #partial-updates-with-patch }
-You can also use the
HTTP `PATCH` operation to *partially* update data.
+You can also use the [HTTP `PATCH`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) operation to *partially* update data.
This means that you can send only the data that you want to update, leaving the rest intact.
@@ -95,6 +95,6 @@ Notice that the input model is still validated.
So, if you want to receive partial updates that can omit all the attributes, you need to have a model with all the attributes marked as optional (with default values or `None`).
-To distinguish from the models with all optional values for **updates** and models with required values for **creation**, you can use the ideas described in [Extra Models](extra-models.md){.internal-link target=_blank}.
+To distinguish from the models with all optional values for **updates** and models with required values for **creation**, you can use the ideas described in [Extra Models](extra-models.md).
///
diff --git a/docs/en/docs/tutorial/body.md b/docs/en/docs/tutorial/body.md
index fb4471836e..ca72548a4d 100644
--- a/docs/en/docs/tutorial/body.md
+++ b/docs/en/docs/tutorial/body.md
@@ -6,7 +6,7 @@ A **request** body is data sent by the client to your API. A **response** body i
Your API almost always has to send a **response** body. But clients don't necessarily need to send **request bodies** all the time, sometimes they only request a path, maybe with some query parameters, but don't send a body.
-To declare a **request** body, you use
Pydantic models with all their power and benefits.
+To declare a **request** body, you use [Pydantic](https://docs.pydantic.dev/) models with all their power and benefits.
/// info
@@ -73,7 +73,7 @@ With just that Python type declaration, **FastAPI** will:
* If the data is invalid, it will return a nice and clear error, indicating exactly where and what was the incorrect data.
* Give you the received data in the parameter `item`.
* As you declared it in the function to be of type `Item`, you will also have all the editor support (completion, etc) for all of the attributes and their types.
-* Generate
JSON Schema definitions for your model, you can also use them anywhere else you like if it makes sense for your project.
+* Generate [JSON Schema](https://json-schema.org) definitions for your model, you can also use them anywhere else you like if it makes sense for your project.
* Those schemas will be part of the generated OpenAPI schema, and used by the automatic documentation
UIs.
## Automatic docs { #automatic-docs }
@@ -102,15 +102,15 @@ And it was thoroughly tested at the design phase, before any implementation, to
There were even some changes to Pydantic itself to support this.
-The previous screenshots were taken with
Visual Studio Code.
+The previous screenshots were taken with [Visual Studio Code](https://code.visualstudio.com).
-But you would get the same editor support with
PyCharm and most of the other Python editors:
+But you would get the same editor support with [PyCharm](https://www.jetbrains.com/pycharm/) and most of the other Python editors:

/// tip
-If you use
PyCharm as your editor, you can use the
Pydantic PyCharm Plugin.
+If you use [PyCharm](https://www.jetbrains.com/pycharm/) as your editor, you can use the [Pydantic PyCharm Plugin](https://github.com/koxudaxi/pydantic-pycharm-plugin/).
It improves editor support for Pydantic models, with:
@@ -163,4 +163,4 @@ But adding the type annotations will allow your editor to give you better suppor
## Without Pydantic { #without-pydantic }
-If you don't want to use Pydantic models, you can also use **Body** parameters. See the docs for [Body - Multiple Parameters: Singular values in body](body-multiple-params.md#singular-values-in-body){.internal-link target=_blank}.
+If you don't want to use Pydantic models, you can also use **Body** parameters. See the docs for [Body - Multiple Parameters: Singular values in body](body-multiple-params.md#singular-values-in-body).
diff --git a/docs/en/docs/tutorial/cors.md b/docs/en/docs/tutorial/cors.md
index 61aaa56360..cd84e5214d 100644
--- a/docs/en/docs/tutorial/cors.md
+++ b/docs/en/docs/tutorial/cors.md
@@ -1,6 +1,6 @@
# CORS (Cross-Origin Resource Sharing) { #cors-cross-origin-resource-sharing }
-
CORS or "Cross-Origin Resource Sharing" refers to the situations when a frontend running in a browser has JavaScript code that communicates with a backend, and the backend is in a different "origin" than the frontend.
+[CORS or "Cross-Origin Resource Sharing"](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) refers to the situations when a frontend running in a browser has JavaScript code that communicates with a backend, and the backend is in a different "origin" than the frontend.
## Origin { #origin }
@@ -56,10 +56,10 @@ The following arguments are supported:
* `allow_origins` - A list of origins that should be permitted to make cross-origin requests. E.g. `['https://example.org', 'https://www.example.org']`. You can use `['*']` to allow any origin.
* `allow_origin_regex` - A regex string to match against origins that should be permitted to make cross-origin requests. e.g. `'https://.*\.example\.org'`.
* `allow_methods` - A list of HTTP methods that should be allowed for cross-origin requests. Defaults to `['GET']`. You can use `['*']` to allow all standard methods.
-* `allow_headers` - A list of HTTP request headers that should be supported for cross-origin requests. Defaults to `[]`. You can use `['*']` to allow all headers. The `Accept`, `Accept-Language`, `Content-Language` and `Content-Type` headers are always allowed for
simple CORS requests.
+* `allow_headers` - A list of HTTP request headers that should be supported for cross-origin requests. Defaults to `[]`. You can use `['*']` to allow all headers. The `Accept`, `Accept-Language`, `Content-Language` and `Content-Type` headers are always allowed for [simple CORS requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests).
* `allow_credentials` - Indicate that cookies should be supported for cross-origin requests. Defaults to `False`.
- None of `allow_origins`, `allow_methods` and `allow_headers` can be set to `['*']` if `allow_credentials` is set to `True`. All of them must be
explicitly specified.
+ None of `allow_origins`, `allow_methods` and `allow_headers` can be set to `['*']` if `allow_credentials` is set to `True`. All of them must be [explicitly specified](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#credentialed_requests_and_wildcards).
* `expose_headers` - Indicate any response headers that should be made accessible to the browser. Defaults to `[]`.
* `max_age` - Sets a maximum time in seconds for browsers to cache CORS responses. Defaults to `600`.
@@ -78,7 +78,7 @@ Any request with an `Origin` header. In this case the middleware will pass the r
## More info { #more-info }
-For more info about
CORS, check the
Mozilla CORS documentation.
+For more info about
CORS, check the [Mozilla CORS documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).
/// note | Technical Details
diff --git a/docs/en/docs/tutorial/debugging.md b/docs/en/docs/tutorial/debugging.md
index 89bfb702a6..d157cb7bf0 100644
--- a/docs/en/docs/tutorial/debugging.md
+++ b/docs/en/docs/tutorial/debugging.md
@@ -74,7 +74,7 @@ will not be executed.
/// info
-For more information, check
the official Python docs.
+For more information, check [the official Python docs](https://docs.python.org/3/library/__main__.html).
///
diff --git a/docs/en/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md b/docs/en/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
index c57c608d2b..e663c40823 100644
--- a/docs/en/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
+++ b/docs/en/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
@@ -32,7 +32,7 @@ It might also help avoid confusion for new developers that see an unused paramet
In this example we use invented custom headers `X-Key` and `X-Token`.
-But in real cases, when implementing security, you would get more benefits from using the integrated [Security utilities (the next chapter)](../security/index.md){.internal-link target=_blank}.
+But in real cases, when implementing security, you would get more benefits from using the integrated [Security utilities (the next chapter)](../security/index.md).
///
@@ -62,7 +62,7 @@ So, you can reuse a normal dependency (that returns a value) you already use som
## Dependencies for a group of *path operations* { #dependencies-for-a-group-of-path-operations }
-Later, when reading about how to structure bigger applications ([Bigger Applications - Multiple Files](../../tutorial/bigger-applications.md){.internal-link target=_blank}), possibly with multiple files, you will learn how to declare a single `dependencies` parameter for a group of *path operations*.
+Later, when reading about how to structure bigger applications ([Bigger Applications - Multiple Files](../../tutorial/bigger-applications.md)), possibly with multiple files, you will learn how to declare a single `dependencies` parameter for a group of *path operations*.
## Global Dependencies { #global-dependencies }
diff --git a/docs/en/docs/tutorial/dependencies/dependencies-with-yield.md b/docs/en/docs/tutorial/dependencies/dependencies-with-yield.md
index 24a2076431..7b80a74e44 100644
--- a/docs/en/docs/tutorial/dependencies/dependencies-with-yield.md
+++ b/docs/en/docs/tutorial/dependencies/dependencies-with-yield.md
@@ -14,8 +14,8 @@ Make sure to use `yield` one single time per dependency.
Any function that is valid to use with:
-*
`@contextlib.contextmanager` or
-*
`@contextlib.asynccontextmanager`
+* [`@contextlib.contextmanager`](https://docs.python.org/3/library/contextlib.html#contextlib.contextmanager) or
+* [`@contextlib.asynccontextmanager`](https://docs.python.org/3/library/contextlib.html#contextlib.asynccontextmanager)
would be valid to use as a **FastAPI** dependency.
@@ -87,7 +87,7 @@ You can have any combinations of dependencies that you want.
/// note | Technical Details
-This works thanks to Python's
Context Managers.
+This works thanks to Python's [Context Managers](https://docs.python.org/3/library/contextlib.html).
**FastAPI** uses them internally to achieve this.
@@ -111,7 +111,7 @@ But it's there for you if you need it. 🤓
{* ../../docs_src/dependencies/tutorial008b_an_py310.py hl[18:22,31] *}
-If you want to catch exceptions and create a custom response based on that, create a [Custom Exception Handler](../handling-errors.md#install-custom-exception-handlers){.internal-link target=_blank}.
+If you want to catch exceptions and create a custom response based on that, create a [Custom Exception Handler](../handling-errors.md#install-custom-exception-handlers).
## Dependencies with `yield` and `except` { #dependencies-with-yield-and-except }
@@ -233,14 +233,14 @@ participant operation as Path Operation
Dependencies with `yield` have evolved over time to cover different use cases and fix some issues.
-If you want to see what has changed in different versions of FastAPI, you can read more about it in the advanced guide, in [Advanced Dependencies - Dependencies with `yield`, `HTTPException`, `except` and Background Tasks](../../advanced/advanced-dependencies.md#dependencies-with-yield-httpexception-except-and-background-tasks){.internal-link target=_blank}.
+If you want to see what has changed in different versions of FastAPI, you can read more about it in the advanced guide, in [Advanced Dependencies - Dependencies with `yield`, `HTTPException`, `except` and Background Tasks](../../advanced/advanced-dependencies.md#dependencies-with-yield-httpexception-except-and-background-tasks).
## Context Managers { #context-managers }
### What are "Context Managers" { #what-are-context-managers }
"Context Managers" are any of those Python objects that you can use in a `with` statement.
-For example,
you can use `with` to read a file:
+For example, [you can use `with` to read a file](https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files):
```Python
with open("./somefile.txt") as f:
@@ -264,7 +264,7 @@ If you are just starting with **FastAPI** you might want to skip it for now.
///
-In Python, you can create Context Managers by
creating a class with two methods: `__enter__()` and `__exit__()`.
+In Python, you can create Context Managers by [creating a class with two methods: `__enter__()` and `__exit__()`](https://docs.python.org/3/reference/datamodel.html#context-managers).
You can also use them inside of **FastAPI** dependencies with `yield` by using
`with` or `async with` statements inside of the dependency function:
@@ -275,8 +275,8 @@ You can also use them inside of **FastAPI** dependencies with `yield` by using
Another way to create a context manager is with:
-*
`@contextlib.contextmanager` or
-*
`@contextlib.asynccontextmanager`
+* [`@contextlib.contextmanager`](https://docs.python.org/3/library/contextlib.html#contextlib.contextmanager) or
+* [`@contextlib.asynccontextmanager`](https://docs.python.org/3/library/contextlib.html#contextlib.asynccontextmanager)
using them to decorate a function with a single `yield`.
diff --git a/docs/en/docs/tutorial/dependencies/global-dependencies.md b/docs/en/docs/tutorial/dependencies/global-dependencies.md
index 6feda0bc82..e02ac14db2 100644
--- a/docs/en/docs/tutorial/dependencies/global-dependencies.md
+++ b/docs/en/docs/tutorial/dependencies/global-dependencies.md
@@ -2,15 +2,15 @@
For some types of applications you might want to add dependencies to the whole application.
-Similar to the way you can [add `dependencies` to the *path operation decorators*](dependencies-in-path-operation-decorators.md){.internal-link target=_blank}, you can add them to the `FastAPI` application.
+Similar to the way you can [add `dependencies` to the *path operation decorators*](dependencies-in-path-operation-decorators.md), you can add them to the `FastAPI` application.
In that case, they will be applied to all the *path operations* in the application:
{* ../../docs_src/dependencies/tutorial012_an_py310.py hl[17] *}
-And all the ideas in the section about [adding `dependencies` to the *path operation decorators*](dependencies-in-path-operation-decorators.md){.internal-link target=_blank} still apply, but in this case, to all of the *path operations* in the app.
+And all the ideas in the section about [adding `dependencies` to the *path operation decorators*](dependencies-in-path-operation-decorators.md) still apply, but in this case, to all of the *path operations* in the app.
## Dependencies for groups of *path operations* { #dependencies-for-groups-of-path-operations }
-Later, when reading about how to structure bigger applications ([Bigger Applications - Multiple Files](../../tutorial/bigger-applications.md){.internal-link target=_blank}), possibly with multiple files, you will learn how to declare a single `dependencies` parameter for a group of *path operations*.
+Later, when reading about how to structure bigger applications ([Bigger Applications - Multiple Files](../../tutorial/bigger-applications.md)), possibly with multiple files, you will learn how to declare a single `dependencies` parameter for a group of *path operations*.
diff --git a/docs/en/docs/tutorial/dependencies/index.md b/docs/en/docs/tutorial/dependencies/index.md
index 4a1bb774d9..396c23acbb 100644
--- a/docs/en/docs/tutorial/dependencies/index.md
+++ b/docs/en/docs/tutorial/dependencies/index.md
@@ -57,7 +57,7 @@ FastAPI added support for `Annotated` (and started recommending it) in version 0
If you have an older version, you would get errors when trying to use `Annotated`.
-Make sure you [Upgrade the FastAPI version](../../deployment/versions.md#upgrading-the-fastapi-versions){.internal-link target=_blank} to at least 0.95.1 before using `Annotated`.
+Make sure you [Upgrade the FastAPI version](../../deployment/versions.md#upgrading-the-fastapi-versions) to at least 0.95.1 before using `Annotated`.
///
@@ -152,7 +152,7 @@ It doesn't matter. **FastAPI** will know what to do.
/// note
-If you don't know, check the [Async: *"In a hurry?"*](../../async.md#in-a-hurry){.internal-link target=_blank} section about `async` and `await` in the docs.
+If you don't know, check the [Async: *"In a hurry?"*](../../async.md#in-a-hurry) section about `async` and `await` in the docs.
///
diff --git a/docs/en/docs/tutorial/encoder.md b/docs/en/docs/tutorial/encoder.md
index 17982e9d79..c8f8bca8c9 100644
--- a/docs/en/docs/tutorial/encoder.md
+++ b/docs/en/docs/tutorial/encoder.md
@@ -12,7 +12,7 @@ Let's imagine that you have a database `fake_db` that only receives JSON compati
For example, it doesn't receive `datetime` objects, as those are not compatible with JSON.
-So, a `datetime` object would have to be converted to a `str` containing the data in
ISO format.
+So, a `datetime` object would have to be converted to a `str` containing the data in [ISO format](https://en.wikipedia.org/wiki/ISO_8601).
The same way, this database wouldn't receive a Pydantic model (an object with attributes), only a `dict`.
@@ -24,7 +24,7 @@ It receives an object, like a Pydantic model, and returns a JSON compatible vers
In this example, it would convert the Pydantic model to a `dict`, and the `datetime` to a `str`.
-The result of calling it is something that can be encoded with the Python standard
`json.dumps()`.
+The result of calling it is something that can be encoded with the Python standard [`json.dumps()`](https://docs.python.org/3/library/json.html#json.dumps).
It doesn't return a large `str` containing the data in JSON format (as a string). It returns a Python standard data structure (e.g. a `dict`) with values and sub-values that are all compatible with JSON.
diff --git a/docs/en/docs/tutorial/extra-data-types.md b/docs/en/docs/tutorial/extra-data-types.md
index a41f7c5fc4..611aa9b9ee 100644
--- a/docs/en/docs/tutorial/extra-data-types.md
+++ b/docs/en/docs/tutorial/extra-data-types.md
@@ -36,7 +36,7 @@ Here are some of the additional data types you can use:
* `datetime.timedelta`:
* A Python `datetime.timedelta`.
* In requests and responses will be represented as a `float` of total seconds.
- * Pydantic also allows representing it as a "ISO 8601 time diff encoding",
see the docs for more info.
+ * Pydantic also allows representing it as a "ISO 8601 time diff encoding", [see the docs for more info](https://docs.pydantic.dev/latest/concepts/serialization/#custom-serializers).
* `frozenset`:
* In requests and responses, treated the same as a `set`:
* In requests, a list will be read, eliminating duplicates and converting it to a `set`.
@@ -49,7 +49,7 @@ Here are some of the additional data types you can use:
* `Decimal`:
* Standard Python `Decimal`.
* In requests and responses, handled the same as a `float`.
-* You can check all the valid Pydantic data types here:
Pydantic data types.
+* You can check all the valid Pydantic data types here: [Pydantic data types](https://docs.pydantic.dev/latest/usage/types/types/).
## Example { #example }
diff --git a/docs/en/docs/tutorial/extra-models.md b/docs/en/docs/tutorial/extra-models.md
index 849f7feb0a..f186cdca51 100644
--- a/docs/en/docs/tutorial/extra-models.md
+++ b/docs/en/docs/tutorial/extra-models.md
@@ -12,7 +12,7 @@ This is especially the case for user models, because:
Never store user's plaintext passwords. Always store a "secure hash" that you can then verify.
-If you don't know, you will learn what a "password hash" is in the [security chapters](security/simple-oauth2.md#password-hashing){.internal-link target=_blank}.
+If you don't know, you will learn what a "password hash" is in the [security chapters](security/simple-oauth2.md#password-hashing).
///
diff --git a/docs/en/docs/tutorial/first-steps.md b/docs/en/docs/tutorial/first-steps.md
index 84751d9d82..3355079900 100644
--- a/docs/en/docs/tutorial/first-steps.md
+++ b/docs/en/docs/tutorial/first-steps.md
@@ -11,7 +11,7 @@ Run the live server:
```console
-$
fastapi dev
main.py
+$
fastapi dev
FastAPI Starting development server 🚀
@@ -58,7 +58,7 @@ That line shows the URL where your app is being served on your local machine.
### Check it { #check-it }
-Open your browser at
http://127.0.0.1:8000.
+Open your browser at [http://127.0.0.1:8000](http://127.0.0.1:8000).
You will see the JSON response as:
@@ -68,17 +68,17 @@ You will see the JSON response as:
### Interactive API docs { #interactive-api-docs }
-Now go to
http://127.0.0.1:8000/docs.
+Now go to [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs).
-You will see the automatic interactive API documentation (provided by
Swagger UI):
+You will see the automatic interactive API documentation (provided by [Swagger UI](https://github.com/swagger-api/swagger-ui)):

### Alternative API docs { #alternative-api-docs }
-And now, go to
http://127.0.0.1:8000/redoc.
+And now, go to [http://127.0.0.1:8000/redoc](http://127.0.0.1:8000/redoc).
-You will see the alternative automatic documentation (provided by
ReDoc):
+You will see the alternative automatic documentation (provided by [ReDoc](https://github.com/Rebilly/ReDoc)):

@@ -92,7 +92,7 @@ A "schema" is a definition or description of something. Not the code that implem
#### API "schema" { #api-schema }
-In this case,
OpenAPI is a specification that dictates how to define a schema of your API.
+In this case, [OpenAPI](https://github.com/OAI/OpenAPI-Specification) is a specification that dictates how to define a schema of your API.
This schema definition includes your API paths, the possible parameters they take, etc.
@@ -110,7 +110,7 @@ OpenAPI defines an API schema for your API. And that schema includes definitions
If you are curious about how the raw OpenAPI schema looks like, FastAPI automatically generates a JSON (schema) with the descriptions of all your API.
-You can see it directly at:
http://127.0.0.1:8000/openapi.json.
+You can see it directly at: [http://127.0.0.1:8000/openapi.json](http://127.0.0.1:8000/openapi.json).
It will show a JSON starting with something like:
@@ -143,9 +143,58 @@ And there are dozens of alternatives, all based on OpenAPI. You could easily add
You could also use it to generate code automatically, for clients that communicate with your API. For example, frontend, mobile or IoT applications.
+### Configure the app `entrypoint` in `pyproject.toml` { #configure-the-app-entrypoint-in-pyproject-toml }
+
+You can configure where your app is located in a `pyproject.toml` file like:
+
+```toml
+[tool.fastapi]
+entrypoint = "main:app"
+```
+
+That `entrypoint` will tell the `fastapi` command that it should import the app like:
+
+```python
+from main import app
+```
+
+If your code was structured like:
+
+```
+.
+├── backend
+│ ├── main.py
+│ ├── __init__.py
+```
+
+Then you would set the `entrypoint` as:
+
+```toml
+[tool.fastapi]
+entrypoint = "backend.main:app"
+```
+
+which would be equivalent to:
+
+```python
+from backend.main import app
+```
+
+### `fastapi dev` with path { #fastapi-dev-with-path }
+
+You can also pass the file path to the `fastapi dev` command, and it will guess the FastAPI app object to use:
+
+```console
+$ fastapi dev main.py
+```
+
+But you would have to remember to pass the correct path every time you call the `fastapi` command.
+
+Additionally, other tools might not be able to find it, for example the [VS Code Extension](../editor-support.md) or [FastAPI Cloud](https://fastapicloud.com), so it is recommended to use the `entrypoint` in `pyproject.toml`.
+
### Deploy your app (optional) { #deploy-your-app-optional }
-You can optionally deploy your FastAPI app to
FastAPI Cloud, go and join the waiting list if you haven't. 🚀
+You can optionally deploy your FastAPI app to [FastAPI Cloud](https://fastapicloud.com), go and join the waiting list if you haven't. 🚀
If you already have a **FastAPI Cloud** account (we invited you from the waiting list 😉), you can deploy your application with one command.
@@ -191,7 +240,7 @@ That's it! Now you can access your app at that URL. ✨
`FastAPI` is a class that inherits directly from `Starlette`.
-You can use all the
Starlette functionality with `FastAPI` too.
+You can use all the [Starlette](https://www.starlette.dev/) functionality with `FastAPI` too.
///
@@ -336,7 +385,7 @@ You could also define it as a normal function instead of `async def`:
/// note
-If you don't know the difference, check the [Async: *"In a hurry?"*](../async.md#in-a-hurry){.internal-link target=_blank}.
+If you don't know the difference, check the [Async: *"In a hurry?"*](../async.md#in-a-hurry).
///
@@ -352,11 +401,11 @@ There are many other objects and models that will be automatically converted to
### Step 6: Deploy it { #step-6-deploy-it }
-Deploy your app to **
FastAPI Cloud** with one command: `fastapi deploy`. 🎉
+Deploy your app to **[FastAPI Cloud](https://fastapicloud.com)** with one command: `fastapi deploy`. 🎉
#### About FastAPI Cloud { #about-fastapi-cloud }
-**
FastAPI Cloud** is built by the same author and team behind **FastAPI**.
+**[FastAPI Cloud](https://fastapicloud.com)** is built by the same author and team behind **FastAPI**.
It streamlines the process of **building**, **deploying**, and **accessing** an API with minimal effort.
diff --git a/docs/en/docs/tutorial/handling-errors.md b/docs/en/docs/tutorial/handling-errors.md
index f1db17bb2e..78a5f1f20a 100644
--- a/docs/en/docs/tutorial/handling-errors.md
+++ b/docs/en/docs/tutorial/handling-errors.md
@@ -81,7 +81,7 @@ But in case you needed it for an advanced scenario, you can add custom headers:
## Install custom exception handlers { #install-custom-exception-handlers }
-You can add custom exception handlers with
the same exception utilities from Starlette.
+You can add custom exception handlers with [the same exception utilities from Starlette](https://www.starlette.dev/exceptions/).
Let's say you have a custom exception `UnicornException` that you (or a library you use) might `raise`.
diff --git a/docs/en/docs/tutorial/index.md b/docs/en/docs/tutorial/index.md
index 7212a0c4a9..8a37756c70 100644
--- a/docs/en/docs/tutorial/index.md
+++ b/docs/en/docs/tutorial/index.md
@@ -10,12 +10,12 @@ It is also built to work as a future reference so you can come back and see exac
All the code blocks can be copied and used directly (they are actually tested Python files).
-To run any of the examples, copy the code to a file `main.py`, and start `fastapi dev` with:
+To run any of the examples, copy the code to a file `main.py`, and start `fastapi dev`:
```console
-$
fastapi dev
main.py
+$
fastapi dev
FastAPI Starting development server 🚀
@@ -62,7 +62,7 @@ Using it in your editor is what really shows you the benefits of FastAPI, seeing
The first step is to install FastAPI.
-Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and then **install FastAPI**:
+Make sure you create a [virtual environment](../virtual-environments.md), activate it, and then **install FastAPI**:
@@ -76,7 +76,7 @@ $ pip install "fastapi[standard]"
/// note
-When you install with `pip install "fastapi[standard]"` it comes with some default optional standard dependencies, including `fastapi-cloud-cli`, which allows you to deploy to
FastAPI Cloud.
+When you install with `pip install "fastapi[standard]"` it comes with some default optional standard dependencies, including `fastapi-cloud-cli`, which allows you to deploy to [FastAPI Cloud](https://fastapicloud.com).
If you don't want to have those optional dependencies, you can instead install `pip install fastapi`.
@@ -84,6 +84,12 @@ If you want to install the standard dependencies but without the `fastapi-cloud-
///
+/// tip
+
+FastAPI has an [official extension for VS Code](https://marketplace.visualstudio.com/items?itemName=FastAPILabs.fastapi-vscode) (and Cursor), which provides a lot of features, including a path operation explorer, path operation search, CodeLens navigation in tests (jump to definition from tests), and FastAPI Cloud deployment and logs, all from your editor.
+
+///
+
## Advanced User Guide { #advanced-user-guide }
There is also an **Advanced User Guide** that you can read later after this **Tutorial - User guide**.
diff --git a/docs/en/docs/tutorial/metadata.md b/docs/en/docs/tutorial/metadata.md
index 5cf0dfca01..2abf0a3421 100644
--- a/docs/en/docs/tutorial/metadata.md
+++ b/docs/en/docs/tutorial/metadata.md
@@ -14,7 +14,7 @@ You can set the following fields that are used in the OpenAPI specification and
| `version` | `string` | The version of the API. This is the version of your own application, not of OpenAPI. For example `2.5.0`. |
| `terms_of_service` | `str` | A URL to the Terms of Service for the API. If provided, this has to be a URL. |
| `contact` | `dict` | The contact information for the exposed API. It can contain several fields.
contact fields
| Parameter | Type | Description |
|---|
name | str | The identifying name of the contact person/organization. |
url | str | The URL pointing to the contact information. MUST be in the format of a URL. |
email | str | The email address of the contact person/organization. MUST be in the format of an email address. |
|
-| `license_info` | `dict` | The license information for the exposed API. It can contain several fields.
license_info fields
| Parameter | Type | Description |
|---|
name | str | REQUIRED (if a license_info is set). The license name used for the API. |
identifier | str | An SPDX license expression for the API. The identifier field is mutually exclusive of the url field. Available since OpenAPI 3.1.0, FastAPI 0.99.0. |
url | str | A URL to the license used for the API. MUST be in the format of a URL. |
|
+| `license_info` | `dict` | The license information for the exposed API. It can contain several fields.
license_info fields
| Parameter | Type | Description |
|---|
name | str | REQUIRED (if a license_info is set). The license name used for the API. |
identifier | str | An [SPDX](https://spdx.org/licenses/) license expression for the API. The identifier field is mutually exclusive of the url field. Available since OpenAPI 3.1.0, FastAPI 0.99.0. |
url | str | A URL to the license used for the API. MUST be in the format of a URL. |
|
You can set them as follows:
@@ -76,7 +76,7 @@ Use the `tags` parameter with your *path operations* (and `APIRouter`s) to assig
/// info
-Read more about tags in [Path Operation Configuration](path-operation-configuration.md#tags){.internal-link target=_blank}.
+Read more about tags in [Path Operation Configuration](path-operation-configuration.md#tags).
///
diff --git a/docs/en/docs/tutorial/middleware.md b/docs/en/docs/tutorial/middleware.md
index 123ce3a683..5da549cb7e 100644
--- a/docs/en/docs/tutorial/middleware.md
+++ b/docs/en/docs/tutorial/middleware.md
@@ -15,7 +15,7 @@ A "middleware" is a function that works with every **request** before it is proc
If you have dependencies with `yield`, the exit code will run *after* the middleware.
-If there were any background tasks (covered in the [Background Tasks](background-tasks.md){.internal-link target=_blank} section, you will see it later), they will run *after* all the middleware.
+If there were any background tasks (covered in the [Background Tasks](background-tasks.md) section, you will see it later), they will run *after* all the middleware.
///
@@ -35,9 +35,9 @@ The middleware function receives:
/// tip
-Keep in mind that custom proprietary headers can be added
using the `X-` prefix.
+Keep in mind that custom proprietary headers can be added [using the `X-` prefix](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers).
-But if you have custom headers that you want a client in a browser to be able to see, you need to add them to your CORS configurations ([CORS (Cross-Origin Resource Sharing)](cors.md){.internal-link target=_blank}) using the parameter `expose_headers` documented in
Starlette's CORS docs.
+But if you have custom headers that you want a client in a browser to be able to see, you need to add them to your CORS configurations ([CORS (Cross-Origin Resource Sharing)](cors.md)) using the parameter `expose_headers` documented in [Starlette's CORS docs](https://www.starlette.dev/middleware/#corsmiddleware).
///
@@ -61,7 +61,7 @@ For example, you could add a custom header `X-Process-Time` containing the time
/// tip
-Here we use
`time.perf_counter()` instead of `time.time()` because it can be more precise for these use cases. 🤓
+Here we use [`time.perf_counter()`](https://docs.python.org/3/library/time.html#time.perf_counter) instead of `time.time()` because it can be more precise for these use cases. 🤓
///
@@ -90,6 +90,6 @@ This stacking behavior ensures that middlewares are executed in a predictable an
## Other middlewares { #other-middlewares }
-You can later read more about other middlewares in the [Advanced User Guide: Advanced Middleware](../advanced/middleware.md){.internal-link target=_blank}.
+You can later read more about other middlewares in the [Advanced User Guide: Advanced Middleware](../advanced/middleware.md).
You will read about how to handle
CORS with a middleware in the next section.
diff --git a/docs/en/docs/tutorial/path-operation-configuration.md b/docs/en/docs/tutorial/path-operation-configuration.md
index 2c545dc1a9..e350f7683f 100644
--- a/docs/en/docs/tutorial/path-operation-configuration.md
+++ b/docs/en/docs/tutorial/path-operation-configuration.md
@@ -58,7 +58,7 @@ You can add a `summary` and `description`:
As descriptions tend to be long and cover multiple lines, you can declare the *path operation* description in the function
docstring and **FastAPI** will read it from there.
-You can write
Markdown in the docstring, it will be interpreted and displayed correctly (taking into account docstring indentation).
+You can write [Markdown](https://en.wikipedia.org/wiki/Markdown) in the docstring, it will be interpreted and displayed correctly (taking into account docstring indentation).
{* ../../docs_src/path_operation_configuration/tutorial004_py310.py hl[17:25] *}
diff --git a/docs/en/docs/tutorial/path-params-numeric-validations.md b/docs/en/docs/tutorial/path-params-numeric-validations.md
index de63a51f59..2ba40e92fe 100644
--- a/docs/en/docs/tutorial/path-params-numeric-validations.md
+++ b/docs/en/docs/tutorial/path-params-numeric-validations.md
@@ -14,7 +14,7 @@ FastAPI added support for `Annotated` (and started recommending it) in version 0
If you have an older version, you would get errors when trying to use `Annotated`.
-Make sure you [Upgrade the FastAPI version](../deployment/versions.md#upgrading-the-fastapi-versions){.internal-link target=_blank} to at least 0.95.1 before using `Annotated`.
+Make sure you [Upgrade the FastAPI version](../deployment/versions.md#upgrading-the-fastapi-versions) to at least 0.95.1 before using `Annotated`.
///
@@ -122,7 +122,7 @@ And the same for
lt.
## Recap { #recap }
-With `Query`, `Path` (and others you haven't seen yet) you can declare metadata and string validations in the same ways as with [Query Parameters and String Validations](query-params-str-validations.md){.internal-link target=_blank}.
+With `Query`, `Path` (and others you haven't seen yet) you can declare metadata and string validations in the same ways as with [Query Parameters and String Validations](query-params-str-validations.md).
And you can also declare numeric validations:
diff --git a/docs/en/docs/tutorial/path-params.md b/docs/en/docs/tutorial/path-params.md
index 8adbbcfa1b..6614dfdcb7 100644
--- a/docs/en/docs/tutorial/path-params.md
+++ b/docs/en/docs/tutorial/path-params.md
@@ -6,7 +6,7 @@ You can declare path "parameters" or "variables" with the same syntax used by Py
The value of the path parameter `item_id` will be passed to your function as the argument `item_id`.
-So, if you run this example and go to
http://127.0.0.1:8000/items/foo, you will see a response of:
+So, if you run this example and go to [http://127.0.0.1:8000/items/foo](http://127.0.0.1:8000/items/foo), you will see a response of:
```JSON
{"item_id":"foo"}
@@ -28,7 +28,7 @@ This will give you editor support inside of your function, with error checks, co
## Data
conversion { #data-conversion }
-If you run this example and open your browser at
http://127.0.0.1:8000/items/3, you will see a response of:
+If you run this example and open your browser at [http://127.0.0.1:8000/items/3](http://127.0.0.1:8000/items/3), you will see a response of:
```JSON
{"item_id":3}
@@ -44,7 +44,7 @@ So, with that type declaration, **FastAPI** gives you automatic request
http://127.0.0.1:8000/items/foo, you will see a nice HTTP error of:
+But if you go to the browser at [http://127.0.0.1:8000/items/foo](http://127.0.0.1:8000/items/foo), you will see a nice HTTP error of:
```JSON
{
@@ -64,7 +64,7 @@ But if you go to the browser at http://127.0.0.1:8000/items/4.2
+The same error would appear if you provided a `float` instead of an `int`, as in: [http://127.0.0.1:8000/items/4.2](http://127.0.0.1:8000/items/4.2)
/// check
@@ -78,7 +78,7 @@ This is incredibly helpful while developing and debugging code that interacts wi
## Documentation { #documentation }
-And when you open your browser at http://127.0.0.1:8000/docs, you will see an automatic, interactive, API documentation like:
+And when you open your browser at [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs), you will see an automatic, interactive, API documentation like:
@@ -92,9 +92,9 @@ Notice that the path parameter is declared to be an integer.
## Standards-based benefits, alternative documentation { #standards-based-benefits-alternative-documentation }
-And because the generated schema is from the OpenAPI standard, there are many compatible tools.
+And because the generated schema is from the [OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md) standard, there are many compatible tools.
-Because of this, **FastAPI** itself provides an alternative API documentation (using ReDoc), which you can access at http://127.0.0.1:8000/redoc:
+Because of this, **FastAPI** itself provides an alternative API documentation (using ReDoc), which you can access at [http://127.0.0.1:8000/redoc](http://127.0.0.1:8000/redoc):
@@ -102,7 +102,7 @@ The same way, there are many compatible tools. Including code generation tools f
## Pydantic { #pydantic }
-All the data validation is performed under the hood by Pydantic, so you get all the benefits from it. And you know you are in good hands.
+All the data validation is performed under the hood by [Pydantic](https://docs.pydantic.dev/), so you get all the benefits from it. And you know you are in good hands.
You can use the same type declarations with `str`, `float`, `bool` and many other complex data types.
diff --git a/docs/en/docs/tutorial/query-params-str-validations.md b/docs/en/docs/tutorial/query-params-str-validations.md
index 7ae94fb0a8..4765b36cbe 100644
--- a/docs/en/docs/tutorial/query-params-str-validations.md
+++ b/docs/en/docs/tutorial/query-params-str-validations.md
@@ -35,13 +35,13 @@ FastAPI added support for `Annotated` (and started recommending it) in version 0
If you have an older version, you would get errors when trying to use `Annotated`.
-Make sure you [Upgrade the FastAPI version](../deployment/versions.md#upgrading-the-fastapi-versions){.internal-link target=_blank} to at least 0.95.1 before using `Annotated`.
+Make sure you [Upgrade the FastAPI version](../deployment/versions.md#upgrading-the-fastapi-versions) to at least 0.95.1 before using `Annotated`.
///
## Use `Annotated` in the type for the `q` parameter { #use-annotated-in-the-type-for-the-q-parameter }
-Remember I told you before that `Annotated` can be used to add metadata to your parameters in the [Python Types Intro](../python-types.md#type-hints-with-metadata-annotations){.internal-link target=_blank}?
+Remember I told you before that `Annotated` can be used to add metadata to your parameters in the [Python Types Intro](../python-types.md#type-hints-with-metadata-annotations)?
Now it's the time to use it with FastAPI. 🚀
@@ -158,7 +158,7 @@ You could **call** that same function in **other places** without FastAPI, and i
When you don't use `Annotated` and instead use the **(old) default value style**, if you call that function without FastAPI in **other places**, you have to **remember** to pass the arguments to the function for it to work correctly, otherwise the values will be different from what you expect (e.g. `QueryInfo` or something similar instead of `str`). And your editor won't complain, and Python won't complain running that function, only when the operations inside error out.
-Because `Annotated` can have more than one metadata annotation, you could now even use the same function with other tools, like Typer. 🚀
+Because `Annotated` can have more than one metadata annotation, you could now even use the same function with other tools, like [Typer](https://typer.tiangolo.com/). 🚀
## Add more validations { #add-more-validations }
@@ -370,11 +370,11 @@ There could be cases where you need to do some **custom validation** that can't
In those cases, you can use a **custom validator function** that is applied after the normal validation (e.g. after validating that the value is a `str`).
-You can achieve that using Pydantic's `AfterValidator` inside of `Annotated`.
+You can achieve that using [Pydantic's `AfterValidator`](https://docs.pydantic.dev/latest/concepts/validators/#field-after-validator) inside of `Annotated`.
/// tip
-Pydantic also has `BeforeValidator` and others. 🤓
+Pydantic also has [`BeforeValidator`](https://docs.pydantic.dev/latest/concepts/validators/#field-before-validator) and others. 🤓
///
diff --git a/docs/en/docs/tutorial/query-params.md b/docs/en/docs/tutorial/query-params.md
index 9408168cf1..efe2c6d7a0 100644
--- a/docs/en/docs/tutorial/query-params.md
+++ b/docs/en/docs/tutorial/query-params.md
@@ -183,6 +183,6 @@ In this case, there are 3 query parameters:
/// tip
-You could also use `Enum`s the same way as with [Path Parameters](path-params.md#predefined-values){.internal-link target=_blank}.
+You could also use `Enum`s the same way as with [Path Parameters](path-params.md#predefined-values).
///
diff --git a/docs/en/docs/tutorial/request-files.md b/docs/en/docs/tutorial/request-files.md
index 93c27df3fe..ae3d6a119d 100644
--- a/docs/en/docs/tutorial/request-files.md
+++ b/docs/en/docs/tutorial/request-files.md
@@ -4,9 +4,9 @@ You can define files to be uploaded by the client using `File`.
/// info
-To receive uploaded files, first install `python-multipart`.
+To receive uploaded files, first install [`python-multipart`](https://github.com/Kludex/python-multipart).
-Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and then install it, for example:
+Make sure you create a [virtual environment](../virtual-environments.md), activate it, and then install it, for example:
```console
$ pip install python-multipart
@@ -63,8 +63,8 @@ Using `UploadFile` has several advantages over `bytes`:
* A file stored in memory up to a maximum size limit, and after passing this limit it will be stored in disk.
* This means that it will work well for large files like images, videos, large binaries, etc. without consuming all the memory.
* You can get metadata from the uploaded file.
-* It has a file-like `async` interface.
-* It exposes an actual Python `SpooledTemporaryFile` object that you can pass directly to other libraries that expect a file-like object.
+* It has a [file-like](https://docs.python.org/3/glossary.html#term-file-like-object) `async` interface.
+* It exposes an actual Python [`SpooledTemporaryFile`](https://docs.python.org/3/library/tempfile.html#tempfile.SpooledTemporaryFile) object that you can pass directly to other libraries that expect a file-like object.
### `UploadFile` { #uploadfile }
@@ -72,7 +72,7 @@ Using `UploadFile` has several advantages over `bytes`:
* `filename`: A `str` with the original file name that was uploaded (e.g. `myimage.jpg`).
* `content_type`: A `str` with the content type (MIME type / media type) (e.g. `image/jpeg`).
-* `file`: A `SpooledTemporaryFile` (a file-like object). This is the actual Python file object that you can pass directly to other functions or libraries that expect a "file-like" object.
+* `file`: A [`SpooledTemporaryFile`](https://docs.python.org/3/library/tempfile.html#tempfile.SpooledTemporaryFile) (a [file-like](https://docs.python.org/3/glossary.html#term-file-like-object) object). This is the actual Python file object that you can pass directly to other functions or libraries that expect a "file-like" object.
`UploadFile` has the following `async` methods. They all call the corresponding file methods underneath (using the internal `SpooledTemporaryFile`).
@@ -121,7 +121,7 @@ Data from forms is normally encoded using the "media type" `application/x-www-fo
But when the form includes files, it is encoded as `multipart/form-data`. If you use `File`, **FastAPI** will know it has to get the files from the correct part of the body.
-If you want to read more about these encodings and form fields, head to the MDN web docs for POST.
+If you want to read more about these encodings and form fields, head to the [MDN web docs for `POST`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST).
///
diff --git a/docs/en/docs/tutorial/request-form-models.md b/docs/en/docs/tutorial/request-form-models.md
index 37e764c136..2e0f463294 100644
--- a/docs/en/docs/tutorial/request-form-models.md
+++ b/docs/en/docs/tutorial/request-form-models.md
@@ -4,9 +4,9 @@ You can use **Pydantic models** to declare **form fields** in FastAPI.
/// info
-To use forms, first install `python-multipart`.
+To use forms, first install [`python-multipart`](https://github.com/Kludex/python-multipart).
-Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and then install it, for example:
+Make sure you create a [virtual environment](../virtual-environments.md), activate it, and then install it, for example:
```console
$ pip install python-multipart
diff --git a/docs/en/docs/tutorial/request-forms-and-files.md b/docs/en/docs/tutorial/request-forms-and-files.md
index 75f30bd2a9..1443004120 100644
--- a/docs/en/docs/tutorial/request-forms-and-files.md
+++ b/docs/en/docs/tutorial/request-forms-and-files.md
@@ -4,9 +4,9 @@ You can define files and form fields at the same time using `File` and `Form`.
/// info
-To receive uploaded files and/or form data, first install `python-multipart`.
+To receive uploaded files and/or form data, first install [`python-multipart`](https://github.com/Kludex/python-multipart).
-Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and then install it, for example:
+Make sure you create a [virtual environment](../virtual-environments.md), activate it, and then install it, for example:
```console
$ pip install python-multipart
diff --git a/docs/en/docs/tutorial/request-forms.md b/docs/en/docs/tutorial/request-forms.md
index 3f160504f6..8c4b32d850 100644
--- a/docs/en/docs/tutorial/request-forms.md
+++ b/docs/en/docs/tutorial/request-forms.md
@@ -4,9 +4,9 @@ When you need to receive form fields instead of JSON, you can use `Form`.
/// info
-To use forms, first install `python-multipart`.
+To use forms, first install [`python-multipart`](https://github.com/Kludex/python-multipart).
-Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and then install it, for example:
+Make sure you create a [virtual environment](../virtual-environments.md), activate it, and then install it, for example:
```console
$ pip install python-multipart
@@ -56,7 +56,7 @@ Data from forms is normally encoded using the "media type" `application/x-www-fo
But when the form includes files, it is encoded as `multipart/form-data`. You'll read about handling files in the next chapter.
-If you want to read more about these encodings and form fields, head to the MDN web docs for POST.
+If you want to read more about these encodings and form fields, head to the [MDN web docs for `POST`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST).
///
diff --git a/docs/en/docs/tutorial/response-model.md b/docs/en/docs/tutorial/response-model.md
index 51492722ae..d628167ddb 100644
--- a/docs/en/docs/tutorial/response-model.md
+++ b/docs/en/docs/tutorial/response-model.md
@@ -13,6 +13,7 @@ FastAPI will use this return type to:
* Add a **JSON Schema** for the response, in the OpenAPI *path operation*.
* This will be used by the **automatic docs**.
* It will also be used by automatic client code generation tools.
+* **Serialize** the returned data to JSON using Pydantic, which is written in **Rust**, so it will be **much faster**.
But most importantly:
@@ -73,9 +74,9 @@ Here we are declaring a `UserIn` model, it will contain a plaintext password:
/// info
-To use `EmailStr`, first install `email-validator`.
+To use `EmailStr`, first install [`email-validator`](https://github.com/JoshData/python-email-validator).
-Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and then install it, for example:
+Make sure you create a [virtual environment](../virtual-environments.md), activate it, and then install it, for example:
```console
$ pip install email-validator
@@ -181,7 +182,7 @@ There might be cases where you return something that is not a valid Pydantic fie
### Return a Response Directly { #return-a-response-directly }
-The most common case would be [returning a Response directly as explained later in the advanced docs](../advanced/response-directly.md){.internal-link target=_blank}.
+The most common case would be [returning a Response directly as explained later in the advanced docs](../advanced/response-directly.md).
{* ../../docs_src/response_model/tutorial003_02_py310.py hl[8,10:11] *}
@@ -257,7 +258,7 @@ You can also use:
* `response_model_exclude_defaults=True`
* `response_model_exclude_none=True`
-as described in the Pydantic docs for `exclude_defaults` and `exclude_none`.
+as described in [the Pydantic docs](https://docs.pydantic.dev/1.10/usage/exporting_models/#modeldict) for `exclude_defaults` and `exclude_none`.
///
diff --git a/docs/en/docs/tutorial/response-status-code.md b/docs/en/docs/tutorial/response-status-code.md
index dcb35dff54..dcadaa36d8 100644
--- a/docs/en/docs/tutorial/response-status-code.md
+++ b/docs/en/docs/tutorial/response-status-code.md
@@ -20,7 +20,7 @@ The `status_code` parameter receives a number with the HTTP status code.
/// info
-`status_code` can alternatively also receive an `IntEnum`, such as Python's `http.HTTPStatus`.
+`status_code` can alternatively also receive an `IntEnum`, such as Python's [`http.HTTPStatus`](https://docs.python.org/3/library/http.html#http.HTTPStatus).
///
@@ -66,7 +66,7 @@ In short:
/// tip
-To know more about each status code and which code is for what, check the MDN documentation about HTTP status codes.
+To know more about each status code and which code is for what, check the [MDN documentation about HTTP status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status).
///
@@ -98,4 +98,4 @@ You could also use `from starlette import status`.
## Changing the default { #changing-the-default }
-Later, in the [Advanced User Guide](../advanced/response-change-status-code.md){.internal-link target=_blank}, you will see how to return a different status code than the default you are declaring here.
+Later, in the [Advanced User Guide](../advanced/response-change-status-code.md), you will see how to return a different status code than the default you are declaring here.
diff --git a/docs/en/docs/tutorial/schema-extra-example.md b/docs/en/docs/tutorial/schema-extra-example.md
index 432f58b1e3..2b5fe11c0b 100644
--- a/docs/en/docs/tutorial/schema-extra-example.md
+++ b/docs/en/docs/tutorial/schema-extra-example.md
@@ -12,7 +12,7 @@ You can declare `examples` for a Pydantic model that will be added to the genera
That extra info will be added as-is to the output **JSON Schema** for that model, and it will be used in the API docs.
-You can use the attribute `model_config` that takes a `dict` as described in Pydantic's docs: Configuration.
+You can use the attribute `model_config` that takes a `dict` as described in [Pydantic's docs: Configuration](https://docs.pydantic.dev/latest/api/config/).
You can set `"json_schema_extra"` with a `dict` containing any additional data you would like to show up in the generated JSON Schema, including `examples`.
@@ -145,12 +145,12 @@ JSON Schema didn't have `examples`, so OpenAPI added its own `example` field to
OpenAPI also added `example` and `examples` fields to other parts of the specification:
-* `Parameter Object` (in the specification) that was used by FastAPI's:
+* [`Parameter Object` (in the specification)](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object) that was used by FastAPI's:
* `Path()`
* `Query()`
* `Header()`
* `Cookie()`
-* `Request Body Object`, in the field `content`, on the `Media Type Object` (in the specification) that was used by FastAPI's:
+* [`Request Body Object`, in the field `content`, on the `Media Type Object` (in the specification)](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#media-type-object) that was used by FastAPI's:
* `Body()`
* `File()`
* `Form()`
@@ -163,7 +163,7 @@ This old OpenAPI-specific `examples` parameter is now `openapi_examples` since F
### JSON Schema's `examples` field { #json-schemas-examples-field }
-But then JSON Schema added an `examples` field to a new version of the specification.
+But then JSON Schema added an [`examples`](https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9.5) field to a new version of the specification.
And then the new OpenAPI 3.1.0 was based on the latest version (JSON Schema 2020-12) that included this new field `examples`.
diff --git a/docs/en/docs/tutorial/security/first-steps.md b/docs/en/docs/tutorial/security/first-steps.md
index 4fbb5e0903..cf19f7dbdc 100644
--- a/docs/en/docs/tutorial/security/first-steps.md
+++ b/docs/en/docs/tutorial/security/first-steps.md
@@ -26,11 +26,11 @@ Copy the example in a file `main.py`:
/// info
-The `python-multipart` package is automatically installed with **FastAPI** when you run the `pip install "fastapi[standard]"` command.
+The [`python-multipart`](https://github.com/Kludex/python-multipart) package is automatically installed with **FastAPI** when you run the `pip install "fastapi[standard]"` command.
However, if you use the `pip install fastapi` command, the `python-multipart` package is not included by default.
-To install it manually, make sure you create a [virtual environment](../../virtual-environments.md){.internal-link target=_blank}, activate it, and then install it with:
+To install it manually, make sure you create a [virtual environment](../../virtual-environments.md), activate it, and then install it with:
```console
$ pip install python-multipart
@@ -45,7 +45,7 @@ Run the example with:
```console
-$ fastapi dev main.py
+$ fastapi dev
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
@@ -54,7 +54,7 @@ $ fastapi dev main.py
## Check it { #check-it }
-Go to the interactive docs at:
http://127.0.0.1:8000/docs.
+Go to the interactive docs at: [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs).
You will see something like this:
@@ -140,7 +140,7 @@ Here `tokenUrl="token"` refers to a relative URL `token` that we haven't created
Because we are using a relative URL, if your API was located at `https://example.com/`, then it would refer to `https://example.com/token`. But if your API was located at `https://example.com/api/v1/`, then it would refer to `https://example.com/api/v1/token`.
-Using a relative URL is important to make sure your application keeps working even in an advanced use case like [Behind a Proxy](../../advanced/behind-a-proxy.md){.internal-link target=_blank}.
+Using a relative URL is important to make sure your application keeps working even in an advanced use case like [Behind a Proxy](../../advanced/behind-a-proxy.md).
///
diff --git a/docs/en/docs/tutorial/security/oauth2-jwt.md b/docs/en/docs/tutorial/security/oauth2-jwt.md
index 26894ab287..fabdd06a6b 100644
--- a/docs/en/docs/tutorial/security/oauth2-jwt.md
+++ b/docs/en/docs/tutorial/security/oauth2-jwt.md
@@ -24,13 +24,13 @@ That way, you can create a token with an expiration of, let's say, 1 week. And t
After a week, the token will be expired and the user will not be authorized and will have to sign in again to get a new token. And if the user (or a third party) tried to modify the token to change the expiration, you would be able to discover it, because the signatures would not match.
-If you want to play with JWT tokens and see how they work, check
https://jwt.io.
+If you want to play with JWT tokens and see how they work, check [https://jwt.io](https://jwt.io/).
## Install `PyJWT` { #install-pyjwt }
We need to install `PyJWT` to generate and verify the JWT tokens in Python.
-Make sure you create a [virtual environment](../../virtual-environments.md){.internal-link target=_blank}, activate it, and then install `pyjwt`:
+Make sure you create a [virtual environment](../../virtual-environments.md), activate it, and then install `pyjwt`:
@@ -46,7 +46,7 @@ $ pip install pyjwt
If you are planning to use digital signature algorithms like RSA or ECDSA, you should install the cryptography library dependency `pyjwt[crypto]`.
-You can read more about it in the
PyJWT Installation docs.
+You can read more about it in the [PyJWT Installation docs](https://pyjwt.readthedocs.io/en/latest/installation.html).
///
@@ -72,7 +72,7 @@ It supports many secure hashing algorithms and utilities to work with them.
The recommended algorithm is "Argon2".
-Make sure you create a [virtual environment](../../virtual-environments.md){.internal-link target=_blank}, activate it, and then install pwdlib with Argon2:
+Make sure you create a [virtual environment](../../virtual-environments.md), activate it, and then install pwdlib with Argon2:
@@ -200,7 +200,7 @@ The important thing to keep in mind is that the `sub` key should have a unique i
## Check it { #check-it }
-Run the server and go to the docs:
http://127.0.0.1:8000/docs.
+Run the server and go to the docs: [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs).
You'll see the user interface like:
diff --git a/docs/en/docs/tutorial/security/simple-oauth2.md b/docs/en/docs/tutorial/security/simple-oauth2.md
index 296e0e2950..a98112d765 100644
--- a/docs/en/docs/tutorial/security/simple-oauth2.md
+++ b/docs/en/docs/tutorial/security/simple-oauth2.md
@@ -146,7 +146,7 @@ UserInDB(
/// info
-For a more complete explanation of `**user_dict` check back in [the documentation for **Extra Models**](../extra-models.md#about-user-in-dict){.internal-link target=_blank}.
+For a more complete explanation of `**user_dict` check back in [the documentation for **Extra Models**](../extra-models.md#about-user-in-dict).
///
@@ -216,7 +216,7 @@ That's the benefit of standards...
## See it in action { #see-it-in-action }
-Open the interactive docs:
http://127.0.0.1:8000/docs.
+Open the interactive docs: [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs).
### Authenticate { #authenticate }
diff --git a/docs/en/docs/tutorial/server-sent-events.md b/docs/en/docs/tutorial/server-sent-events.md
new file mode 100644
index 0000000000..d264f8536f
--- /dev/null
+++ b/docs/en/docs/tutorial/server-sent-events.md
@@ -0,0 +1,120 @@
+# Server-Sent Events (SSE) { #server-sent-events-sse }
+
+You can stream data to the client using **Server-Sent Events** (SSE).
+
+This is similar to [Stream JSON Lines](stream-json-lines.md), but uses the `text/event-stream` format, which is supported natively by browsers with the [`EventSource` API](https://developer.mozilla.org/en-US/docs/Web/API/EventSource).
+
+/// info
+
+Added in FastAPI 0.135.0.
+
+///
+
+## What are Server-Sent Events? { #what-are-server-sent-events }
+
+SSE is a standard for streaming data from the server to the client over HTTP.
+
+Each event is a small text block with "fields" like `data`, `event`, `id`, and `retry`, separated by blank lines.
+
+It looks like this:
+
+```
+data: {"name": "Portal Gun", "price": 999.99}
+
+data: {"name": "Plumbus", "price": 32.99}
+
+```
+
+SSE is commonly used for AI chat streaming, live notifications, logs and observability, and other cases where the server pushes updates to the client.
+
+/// tip
+
+If you want to stream binary data, for example video or audio, check the advanced guide: [Stream Data](../advanced/stream-data.md).
+
+///
+
+## Stream SSE with FastAPI { #stream-sse-with-fastapi }
+
+To stream SSE with FastAPI, use `yield` in your *path operation function* and set `response_class=EventSourceResponse`.
+
+Import `EventSourceResponse` from `fastapi.sse`:
+
+{* ../../docs_src/server_sent_events/tutorial001_py310.py ln[1:25] hl[4,22] *}
+
+Each yielded item is encoded as JSON and sent in the `data:` field of an SSE event.
+
+If you declare the return type as `AsyncIterable[Item]`, FastAPI will use it to **validate**, **document**, and **serialize** the data using Pydantic.
+
+{* ../../docs_src/server_sent_events/tutorial001_py310.py ln[1:25] hl[10:12,23] *}
+
+/// tip
+
+As Pydantic will serialize it in the **Rust** side, you will get much higher **performance** than if you don't declare a return type.
+
+///
+
+### Non-async *path operation functions* { #non-async-path-operation-functions }
+
+You can also use regular `def` functions (without `async`), and use `yield` the same way.
+
+FastAPI will make sure it's run correctly so that it doesn't block the event loop.
+
+As in this case the function is not async, the right return type would be `Iterable[Item]`:
+
+{* ../../docs_src/server_sent_events/tutorial001_py310.py ln[28:31] hl[29] *}
+
+### No Return Type { #no-return-type }
+
+You can also omit the return type. FastAPI will use the [`jsonable_encoder`](./encoder.md) to convert the data and send it.
+
+{* ../../docs_src/server_sent_events/tutorial001_py310.py ln[34:37] hl[35] *}
+
+## `ServerSentEvent` { #serversentevent }
+
+If you need to set SSE fields like `event`, `id`, `retry`, or `comment`, you can yield `ServerSentEvent` objects instead of plain data.
+
+Import `ServerSentEvent` from `fastapi.sse`:
+
+{* ../../docs_src/server_sent_events/tutorial002_py310.py hl[4,26] *}
+
+The `data` field is always encoded as JSON. You can pass any value that can be serialized as JSON, including Pydantic models.
+
+## Raw Data { #raw-data }
+
+If you need to send data **without** JSON encoding, use `raw_data` instead of `data`.
+
+This is useful for sending pre-formatted text, log lines, or special
"sentinel" values like `[DONE]`.
+
+{* ../../docs_src/server_sent_events/tutorial003_py310.py hl[17] *}
+
+/// note
+
+`data` and `raw_data` are mutually exclusive. You can only set one of them on each `ServerSentEvent`.
+
+///
+
+## Resuming with `Last-Event-ID` { #resuming-with-last-event-id }
+
+When a browser reconnects after a connection drop, it sends the last received `id` in the `Last-Event-ID` header.
+
+You can read it as a header parameter and use it to resume the stream from where the client left off:
+
+{* ../../docs_src/server_sent_events/tutorial004_py310.py hl[25,27,31] *}
+
+## SSE with POST { #sse-with-post }
+
+SSE works with **any HTTP method**, not just `GET`.
+
+This is useful for protocols like [MCP](https://modelcontextprotocol.io) that stream SSE over `POST`:
+
+{* ../../docs_src/server_sent_events/tutorial005_py310.py hl[14] *}
+
+## Technical Details { #technical-details }
+
+FastAPI implements some SSE best practices out of the box.
+
+* Send a **"keep alive" `ping` comment** every 15 seconds when there hasn't been any message, to prevent some proxies from closing the connection, as suggested in the [HTML specification: Server-Sent Events](https://html.spec.whatwg.org/multipage/server-sent-events.html#authoring-notes).
+* Set the `Cache-Control: no-cache` header to **prevent caching** of the stream.
+* Set a special header `X-Accel-Buffering: no` to **prevent buffering** in some proxies like Nginx.
+
+You don't have to do anything about it, it works out of the box. 🤓
diff --git a/docs/en/docs/tutorial/sql-databases.md b/docs/en/docs/tutorial/sql-databases.md
index b42e9ba2f2..b8cbac295b 100644
--- a/docs/en/docs/tutorial/sql-databases.md
+++ b/docs/en/docs/tutorial/sql-databases.md
@@ -2,9 +2,9 @@
**FastAPI** doesn't require you to use a SQL (relational) database. But you can use **any database** that you want.
-Here we'll see an example using
SQLModel.
+Here we'll see an example using [SQLModel](https://sqlmodel.tiangolo.com/).
-**SQLModel** is built on top of
SQLAlchemy and Pydantic. It was made by the same author of **FastAPI** to be the perfect match for FastAPI applications that need to use **SQL databases**.
+**SQLModel** is built on top of [SQLAlchemy](https://www.sqlalchemy.org/) and Pydantic. It was made by the same author of **FastAPI** to be the perfect match for FastAPI applications that need to use **SQL databases**.
/// tip
@@ -26,15 +26,15 @@ Later, for your production application, you might want to use a database server
/// tip
-There is an official project generator with **FastAPI** and **PostgreSQL** including a frontend and more tools:
https://github.com/fastapi/full-stack-fastapi-template
+There is an official project generator with **FastAPI** and **PostgreSQL** including a frontend and more tools: [https://github.com/fastapi/full-stack-fastapi-template](https://github.com/fastapi/full-stack-fastapi-template)
///
-This is a very simple and short tutorial, if you want to learn about databases in general, about SQL, or more advanced features, go to the
SQLModel docs.
+This is a very simple and short tutorial, if you want to learn about databases in general, about SQL, or more advanced features, go to the [SQLModel docs](https://sqlmodel.tiangolo.com/).
## Install `SQLModel` { #install-sqlmodel }
-First, make sure you create your [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and then install `sqlmodel`:
+First, make sure you create your [virtual environment](../virtual-environments.md), activate it, and then install `sqlmodel`:
@@ -65,7 +65,7 @@ There are a few differences:
* `Field(primary_key=True)` tells SQLModel that the `id` is the **primary key** in the SQL database (you can learn more about SQL primary keys in the SQLModel docs).
- **Note:** We use `int | None` for the primary key field so that in Python code we can *create an object without an `id`* (`id=None`), assuming the database will *generate it when saving*. SQLModel understands that the database will provide the `id` and *defines the column as a non-null `INTEGER`* in the database schema. See
SQLModel docs on primary keys for details.
+ **Note:** We use `int | None` for the primary key field so that in Python code we can *create an object without an `id`* (`id=None`), assuming the database will *generate it when saving*. SQLModel understands that the database will provide the `id` and *defines the column as a non-null `INTEGER`* in the database schema. See [SQLModel docs on primary keys](https://sqlmodel.tiangolo.com/tutorial/create-db-and-table/#primary-key-id) for details.
* `Field(index=True)` tells SQLModel that it should create a **SQL index** for this column, that would allow faster lookups in the database when reading data filtered by this column.
@@ -111,7 +111,7 @@ For production you would probably use a migration script that runs before you st
/// tip
-SQLModel will have migration utilities wrapping Alembic, but for now, you can use
Alembic directly.
+SQLModel will have migration utilities wrapping Alembic, but for now, you can use [Alembic](https://alembic.sqlalchemy.org/en/latest/) directly.
///
@@ -152,7 +152,7 @@ You can run the app:
```console
-$ fastapi dev main.py
+$ fastapi dev
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
@@ -337,7 +337,7 @@ You can run the app again:
```console
-$ fastapi dev main.py
+$ fastapi dev
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
@@ -352,6 +352,6 @@ If you go to the `/docs` API UI, you will see that it is now updated, and it won
## Recap { #recap }
-You can use
**SQLModel** to interact with a SQL database and simplify the code with *data models* and *table models*.
+You can use [**SQLModel**](https://sqlmodel.tiangolo.com/) to interact with a SQL database and simplify the code with *data models* and *table models*.
-You can learn a lot more at the **SQLModel** docs, there's a longer mini
tutorial on using SQLModel with **FastAPI**. 🚀
+You can learn a lot more at the **SQLModel** docs, there's a longer mini [tutorial on using SQLModel with **FastAPI**](https://sqlmodel.tiangolo.com/tutorial/fastapi/). 🚀
diff --git a/docs/en/docs/tutorial/static-files.md b/docs/en/docs/tutorial/static-files.md
index 8fd65a0d7f..38c2ef2485 100644
--- a/docs/en/docs/tutorial/static-files.md
+++ b/docs/en/docs/tutorial/static-files.md
@@ -23,7 +23,7 @@ You could also use `from starlette.staticfiles import StaticFiles`.
This is different from using an `APIRouter` as a mounted application is completely independent. The OpenAPI and docs from your main application won't include anything from the mounted application, etc.
-You can read more about this in the [Advanced User Guide](../advanced/index.md){.internal-link target=_blank}.
+You can read more about this in the [Advanced User Guide](../advanced/index.md).
## Details { #details }
@@ -37,4 +37,4 @@ All these parameters can be different than "`static`", adjust them with the need
## More info { #more-info }
-For more details and options check
Starlette's docs about Static Files.
+For more details and options check [Starlette's docs about Static Files](https://www.starlette.dev/staticfiles/).
diff --git a/docs/en/docs/tutorial/stream-json-lines.md b/docs/en/docs/tutorial/stream-json-lines.md
new file mode 100644
index 0000000000..3006636362
--- /dev/null
+++ b/docs/en/docs/tutorial/stream-json-lines.md
@@ -0,0 +1,111 @@
+# Stream JSON Lines { #stream-json-lines }
+
+You could have a sequence of data that you would like to send in a "**stream**", you could do it with **JSON Lines**.
+
+/// info
+
+Added in FastAPI 0.134.0.
+
+///
+
+## What is a Stream? { #what-is-a-stream }
+
+"**Streaming**" data means that your app will start sending data items to the client without waiting for the entire sequence of items to be ready.
+
+So, it will send the first item, the client will receive and start processing it, and you might still be producing the next item.
+
+```mermaid
+sequenceDiagram
+ participant App
+ participant Client
+
+ App->>App: Produce Item 1
+ App->>Client: Send Item 1
+ App->>App: Produce Item 2
+ Client->>Client: Process Item 1
+ App->>Client: Send Item 2
+ App->>App: Produce Item 3
+ Client->>Client: Process Item 2
+ App->>Client: Send Item 3
+ Client->>Client: Process Item 3
+ Note over App: Keeps producing...
+ Note over Client: Keeps consuming...
+```
+
+It could even be an infinite stream, where you keep sending data.
+
+## JSON Lines { #json-lines }
+
+In these cases, it's common to send "**JSON Lines**", which is a format where you send one JSON object per line.
+
+A response would have a content type of `application/jsonl` (instead of `application/json`) and the body would be something like:
+
+```json
+{"name": "Plumbus", "description": "A multi-purpose household device."}
+{"name": "Portal Gun", "description": "A portal opening device."}
+{"name": "Meeseeks Box", "description": "A box that summons a Meeseeks."}
+```
+
+It's very similar to a JSON array (equivalent of a Python list), but instead of being wrapped in `[]` and having `,` between the items, it has **one JSON object per line**, they are separated by a new line character.
+
+/// info
+
+The important point is that your app will be able to produce each line in turn, while the client consumes the previous lines.
+
+///
+
+/// note | Technical Details
+
+Because each JSON object will be separated by a new line, they can't contain literal new line characters in their content, but they can contain escaped new lines (`\n`), which is part of the JSON standard.
+
+But normally you won't have to worry about it, it's done automatically, continue reading. 🤓
+
+///
+
+## Use Cases { #use-cases }
+
+You could use this to stream data from an **AI LLM** service, from **logs** or **telemetry**, or from other types of data that can be structured in **JSON** items.
+
+/// tip
+
+If you want to stream binary data, for example video or audio, check the advanced guide: [Stream Data](../advanced/stream-data.md).
+
+///
+
+## Stream JSON Lines with FastAPI { #stream-json-lines-with-fastapi }
+
+To stream JSON Lines with FastAPI you can, instead of using `return` in your *path operation function*, use `yield` to produce each item in turn.
+
+{* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[1:24] hl[24] *}
+
+If each JSON item you want to send back is of type `Item` (a Pydantic model) and it's an async function, you can declare the return type as `AsyncIterable[Item]`:
+
+{* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[1:24] hl[9:11,22] *}
+
+If you declare the return type, FastAPI will use it to **validate** the data, **document** it in OpenAPI, **filter** it, and **serialize** it using Pydantic.
+
+/// tip
+
+As Pydantic will serialize it in the **Rust** side, you will get much higher **performance** than if you don't declare a return type.
+
+///
+
+### Non-async *path operation functions* { #non-async-path-operation-functions }
+
+You can also use regular `def` functions (without `async`), and use `yield` the same way.
+
+FastAPI will make sure it's run correctly so that it doesn't block the event loop.
+
+As in this case the function is not async, the right return type would be `Iterable[Item]`:
+
+{* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[27:30] hl[28] *}
+
+### No Return Type { #no-return-type }
+
+You can also omit the return type. FastAPI will then use the [`jsonable_encoder`](./encoder.md) to convert the data to something that can be serialized to JSON and then send it as JSON Lines.
+
+{* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[33:36] hl[34] *}
+
+## Server-Sent Events (SSE) { #server-sent-events-sse }
+
+FastAPI also has first-class support for Server-Sent Events (SSE), which are quite similar but with a couple of extra details. You can learn about them in the next chapter: [Server-Sent Events (SSE)](server-sent-events.md). 🤓
diff --git a/docs/en/docs/tutorial/testing.md b/docs/en/docs/tutorial/testing.md
index 14c1b35668..5b8fbba07c 100644
--- a/docs/en/docs/tutorial/testing.md
+++ b/docs/en/docs/tutorial/testing.md
@@ -1,18 +1,18 @@
# Testing { #testing }
-Thanks to
Starlette, testing **FastAPI** applications is easy and enjoyable.
+Thanks to [Starlette](https://www.starlette.dev/testclient/), testing **FastAPI** applications is easy and enjoyable.
-It is based on
HTTPX, which in turn is designed based on Requests, so it's very familiar and intuitive.
+It is based on [HTTPX](https://www.python-httpx.org), which in turn is designed based on Requests, so it's very familiar and intuitive.
-With it, you can use
pytest directly with **FastAPI**.
+With it, you can use [pytest](https://docs.pytest.org/) directly with **FastAPI**.
## Using `TestClient` { #using-testclient }
/// info
-To use `TestClient`, first install
`httpx`.
+To use `TestClient`, first install [`httpx`](https://www.python-httpx.org).
-Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and then install it, for example:
+Make sure you create a [virtual environment](../virtual-environments.md), activate it, and then install it, for example:
```console
$ pip install httpx
@@ -52,7 +52,7 @@ You could also use `from starlette.testclient import TestClient`.
/// tip
-If you want to call `async` functions in your tests apart from sending requests to your FastAPI application (e.g. asynchronous database functions), have a look at the [Async Tests](../advanced/async-tests.md){.internal-link target=_blank} in the advanced tutorial.
+If you want to call `async` functions in your tests apart from sending requests to your FastAPI application (e.g. asynchronous database functions), have a look at the [Async Tests](../advanced/async-tests.md) in the advanced tutorial.
///
@@ -64,7 +64,7 @@ And your **FastAPI** application might also be composed of several files/modules
### **FastAPI** app file { #fastapi-app-file }
-Let's say you have a file structure as described in [Bigger Applications](bigger-applications.md){.internal-link target=_blank}:
+Let's say you have a file structure as described in [Bigger Applications](bigger-applications.md):
```
.
@@ -142,13 +142,13 @@ E.g.:
* To pass *headers*, use a `dict` in the `headers` parameter.
* For *cookies*, a `dict` in the `cookies` parameter.
-For more information about how to pass data to the backend (using `httpx` or the `TestClient`) check the
HTTPX documentation.
+For more information about how to pass data to the backend (using `httpx` or the `TestClient`) check the [HTTPX documentation](https://www.python-httpx.org).
/// info
Note that the `TestClient` receives data that can be converted to JSON, not Pydantic models.
-If you have a Pydantic model in your test and you want to send its data to the application during testing, you can use the `jsonable_encoder` described in [JSON Compatible Encoder](encoder.md){.internal-link target=_blank}.
+If you have a Pydantic model in your test and you want to send its data to the application during testing, you can use the `jsonable_encoder` described in [JSON Compatible Encoder](encoder.md).
///
@@ -156,7 +156,7 @@ If you have a Pydantic model in your test and you want to send its data to the a
After that, you just need to install `pytest`.
-Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and then install it, for example:
+Make sure you create a [virtual environment](../virtual-environments.md), activate it, and then install it, for example:
diff --git a/docs/en/docs/virtual-environments.md b/docs/en/docs/virtual-environments.md
index 615d7949f9..bd46eb820d 100644
--- a/docs/en/docs/virtual-environments.md
+++ b/docs/en/docs/virtual-environments.md
@@ -22,7 +22,7 @@ A **virtual environment** is a directory with some files in it.
This page will teach you how to use **virtual environments** and how they work.
-If you are ready to adopt a **tool that manages everything** for you (including installing Python), try
uv.
+If you are ready to adopt a **tool that manages everything** for you (including installing Python), try [uv](https://github.com/astral-sh/uv).
///
@@ -86,7 +86,7 @@ $ python -m venv .venv
//// tab | `uv`
-If you have
`uv` installed, you can use it to create a virtual environment.
+If you have [`uv`](https://github.com/astral-sh/uv) installed, you can use it to create a virtual environment.
@@ -150,7 +150,7 @@ $ .venv\Scripts\Activate.ps1
//// tab | Windows Bash
-Or if you use Bash for Windows (e.g.
Git Bash):
+Or if you use Bash for Windows (e.g. [Git Bash](https://gitforwindows.org/)):
@@ -216,7 +216,7 @@ If it shows the `python` binary at `.venv\Scripts\python`, inside of your projec
/// tip
-If you use
`uv` you would use it to install things instead of `pip`, so you don't need to upgrade `pip`. 😎
+If you use [`uv`](https://github.com/astral-sh/uv) you would use it to install things instead of `pip`, so you don't need to upgrade `pip`. 😎
///
@@ -268,7 +268,7 @@ If you are using **Git** (you should), add a `.gitignore` file to exclude everyt
/// tip
-If you used
`uv` to create the virtual environment, it already did this for you, you can skip this step. 😎
+If you used [`uv`](https://github.com/astral-sh/uv) to create the virtual environment, it already did this for you, you can skip this step. 😎
///
@@ -340,7 +340,7 @@ $ pip install "fastapi[standard]"
//// tab | `uv`
-If you have
`uv`:
+If you have [`uv`](https://github.com/astral-sh/uv):
@@ -372,7 +372,7 @@ $ pip install -r requirements.txt
//// tab | `uv`
-If you have
`uv`:
+If you have [`uv`](https://github.com/astral-sh/uv):
@@ -416,8 +416,8 @@ You would probably use an editor, make sure you configure it to use the same vir
For example:
-*
VS Code
-*
PyCharm
+* [VS Code](https://code.visualstudio.com/docs/python/environments#_select-and-activate-an-environment)
+* [PyCharm](https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html)
/// tip
@@ -455,7 +455,7 @@ Continue reading. 👇🤓
## Why Virtual Environments { #why-virtual-environments }
-To work with FastAPI you need to install
Python.
+To work with FastAPI you need to install [Python](https://www.python.org/).
After that, you would need to **install** FastAPI and any other **packages** you want to use.
@@ -564,7 +564,7 @@ $ pip install "fastapi[standard]"
-That will download a compressed file with the FastAPI code, normally from
PyPI.
+That will download a compressed file with the FastAPI code, normally from [PyPI](https://pypi.org/project/fastapi/).
It will also **download** files for other packages that FastAPI depends on.
@@ -627,7 +627,7 @@ $ .venv\Scripts\Activate.ps1
//// tab | Windows Bash
-Or if you use Bash for Windows (e.g.
Git Bash):
+Or if you use Bash for Windows (e.g. [Git Bash](https://gitforwindows.org/)):
@@ -639,13 +639,13 @@ $ source .venv/Scripts/activate
////
-That command will create or modify some [environment variables](environment-variables.md){.internal-link target=_blank} that will be available for the next commands.
+That command will create or modify some [environment variables](environment-variables.md) that will be available for the next commands.
One of those variables is the `PATH` variable.
/// tip
-You can learn more about the `PATH` environment variable in the [Environment Variables](environment-variables.md#path-environment-variable){.internal-link target=_blank} section.
+You can learn more about the `PATH` environment variable in the [Environment Variables](environment-variables.md#path-environment-variable) section.
///
@@ -846,7 +846,7 @@ This is a simple guide to get you started and teach you how everything works **u
There are many **alternatives** to managing virtual environments, package dependencies (requirements), projects.
-Once you are ready and want to use a tool to **manage the entire project**, packages dependencies, virtual environments, etc. I would suggest you try
uv.
+Once you are ready and want to use a tool to **manage the entire project**, packages dependencies, virtual environments, etc. I would suggest you try [uv](https://github.com/astral-sh/uv).
`uv` can do a lot of things, it can:
diff --git a/docs/en/mkdocs.yml b/docs/en/mkdocs.yml
index 96ed3d5869..0db3e7a95b 100644
--- a/docs/en/mkdocs.yml
+++ b/docs/en/mkdocs.yml
@@ -154,6 +154,8 @@ nav:
- tutorial/cors.md
- tutorial/sql-databases.md
- tutorial/bigger-applications.md
+ - tutorial/stream-json-lines.md
+ - tutorial/server-sent-events.md
- tutorial/background-tasks.md
- tutorial/metadata.md
- tutorial/static-files.md
@@ -161,6 +163,7 @@ nav:
- tutorial/debugging.md
- Advanced User Guide:
- advanced/index.md
+ - advanced/stream-data.md
- advanced/path-operation-advanced-configuration.md
- advanced/additional-status-codes.md
- advanced/response-directly.md
@@ -192,7 +195,10 @@ nav:
- advanced/wsgi.md
- advanced/generate-clients.md
- advanced/advanced-python-types.md
+ - advanced/json-base64-bytes.md
+ - advanced/strict-content-type.md
- fastapi-cli.md
+ - editor-support.md
- Deployment:
- deployment/index.md
- deployment/versions.md
diff --git a/docs/es/docs/advanced/websockets.md b/docs/es/docs/advanced/websockets.md
index 2a7fed6c59..e9391c36ca 100644
--- a/docs/es/docs/advanced/websockets.md
+++ b/docs/es/docs/advanced/websockets.md
@@ -38,13 +38,13 @@ En producción tendrías una de las opciones anteriores.
Pero es la forma más sencilla de enfocarse en el lado del servidor de WebSockets y tener un ejemplo funcional:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[2,6:38,41:43] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[2,6:38,41:43] *}
## Crear un `websocket` { #create-a-websocket }
En tu aplicación de **FastAPI**, crea un `websocket`:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[1,46:47] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[1,46:47] *}
/// note | Detalles Técnicos
@@ -58,7 +58,7 @@ También podrías usar `from starlette.websockets import WebSocket`.
En tu ruta de WebSocket puedes `await` para recibir mensajes y enviar mensajes.
-{* ../../docs_src/websockets/tutorial001_py310.py hl[48:52] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:52] *}
Puedes recibir y enviar datos binarios, de texto y JSON.
@@ -109,7 +109,7 @@ En endpoints de WebSocket puedes importar desde `fastapi` y usar:
Funcionan de la misma manera que para otros endpoints de FastAPI/*path operations*:
-{* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
+{* ../../docs_src/websockets_/tutorial002_an_py310.py hl[68:69,82] *}
/// info | Información
@@ -154,7 +154,7 @@ Con eso puedes conectar el WebSocket y luego enviar y recibir mensajes:
Cuando una conexión de WebSocket se cierra, el `await websocket.receive_text()` lanzará una excepción `WebSocketDisconnect`, que puedes capturar y manejar como en este ejemplo.
-{* ../../docs_src/websockets/tutorial003_py310.py hl[79:81] *}
+{* ../../docs_src/websockets_/tutorial003_py310.py hl[79:81] *}
Para probarlo:
diff --git a/docs/fr/docs/advanced/websockets.md b/docs/fr/docs/advanced/websockets.md
index 6f5c3e7033..d78f89c374 100644
--- a/docs/fr/docs/advanced/websockets.md
+++ b/docs/fr/docs/advanced/websockets.md
@@ -38,13 +38,13 @@ En production, vous auriez l'une des options ci-dessus.
Mais c'est la façon la plus simple de se concentrer sur la partie serveur des WebSockets et d'avoir un exemple fonctionnel :
-{* ../../docs_src/websockets/tutorial001_py310.py hl[2,6:38,41:43] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[2,6:38,41:43] *}
## Créer un `websocket` { #create-a-websocket }
Dans votre application **FastAPI**, créez un `websocket` :
-{* ../../docs_src/websockets/tutorial001_py310.py hl[1,46:47] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[1,46:47] *}
/// note | Détails techniques
@@ -58,7 +58,7 @@ Vous pourriez aussi utiliser `from starlette.websockets import WebSocket`.
Dans votre route WebSocket, vous pouvez `await` des messages et envoyer des messages.
-{* ../../docs_src/websockets/tutorial001_py310.py hl[48:52] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:52] *}
Vous pouvez recevoir et envoyer des données binaires, texte et JSON.
@@ -109,7 +109,7 @@ Dans les endpoints WebSocket, vous pouvez importer depuis `fastapi` et utiliser
Ils fonctionnent de la même manière que pour les autres endpoints/*chemins d'accès* FastAPI :
-{* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
+{* ../../docs_src/websockets_/tutorial002_an_py310.py hl[68:69,82] *}
/// info
@@ -154,7 +154,7 @@ Avec cela, vous pouvez connecter le WebSocket puis envoyer et recevoir des messa
Lorsqu'une connexion WebSocket est fermée, l'instruction `await websocket.receive_text()` lèvera une exception `WebSocketDisconnect`, que vous pouvez ensuite intercepter et gérer comme dans cet exemple.
-{* ../../docs_src/websockets/tutorial003_py310.py hl[79:81] *}
+{* ../../docs_src/websockets_/tutorial003_py310.py hl[79:81] *}
Pour l'essayer :
diff --git a/docs/ja/docs/advanced/websockets.md b/docs/ja/docs/advanced/websockets.md
index cb5e376de6..efc02079bb 100644
--- a/docs/ja/docs/advanced/websockets.md
+++ b/docs/ja/docs/advanced/websockets.md
@@ -38,13 +38,13 @@ $ pip install websockets
しかし、これはWebSocketsのサーバーサイドに焦点を当て、動作する例を示す最も簡単な方法です。
-{* ../../docs_src/websockets/tutorial001_py310.py hl[2,6:38,41:43] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[2,6:38,41:43] *}
## `websocket` を作成する { #create-a-websocket }
**FastAPI** アプリケーションで、`websocket` を作成します。
-{* ../../docs_src/websockets/tutorial001_py310.py hl[1,46:47] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[1,46:47] *}
/// note | 技術詳細
@@ -58,7 +58,7 @@ $ pip install websockets
WebSocketルートでは、メッセージを待機して送信するために `await` を使用できます。
-{* ../../docs_src/websockets/tutorial001_py310.py hl[48:52] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:52] *}
バイナリやテキストデータ、JSONデータを送受信できます。
@@ -109,7 +109,7 @@ WebSocketエンドポイントでは、`fastapi` から以下をインポート
これらは、他のFastAPI エンドポイント/*path operations* の場合と同じように機能します。
-{* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
+{* ../../docs_src/websockets_/tutorial002_an_py310.py hl[68:69,82] *}
/// info | 情報
@@ -154,7 +154,7 @@ $ fastapi dev main.py
WebSocket接続が閉じられると、 `await websocket.receive_text()` は例外 `WebSocketDisconnect` を発生させ、この例のようにキャッチして処理することができます。
-{* ../../docs_src/websockets/tutorial003_py310.py hl[79:81] *}
+{* ../../docs_src/websockets_/tutorial003_py310.py hl[79:81] *}
試してみるには、
diff --git a/docs/ko/docs/advanced/websockets.md b/docs/ko/docs/advanced/websockets.md
index 384f93952b..cb59097f6e 100644
--- a/docs/ko/docs/advanced/websockets.md
+++ b/docs/ko/docs/advanced/websockets.md
@@ -38,13 +38,13 @@ $ pip install websockets
그러나 이는 WebSockets의 서버 측에 집중하고 동작하는 예제를 제공하는 가장 간단한 방법입니다:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[2,6:38,41:43] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[2,6:38,41:43] *}
## `websocket` 생성하기 { #create-a-websocket }
**FastAPI** 애플리케이션에서 `websocket`을 생성합니다:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[1,46:47] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[1,46:47] *}
/// note | 기술 세부사항
@@ -58,7 +58,7 @@ $ pip install websockets
WebSocket 경로에서 메시지를 대기(`await`)하고 전송할 수 있습니다.
-{* ../../docs_src/websockets/tutorial001_py310.py hl[48:52] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:52] *}
여러분은 이진 데이터, 텍스트, JSON 데이터를 받을 수 있고 전송할 수 있습니다.
@@ -109,7 +109,7 @@ WebSocket 엔드포인트에서 `fastapi`에서 다음을 가져와 사용할
이들은 다른 FastAPI 엔드포인트/*경로 처리*와 동일하게 동작합니다:
-{* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
+{* ../../docs_src/websockets_/tutorial002_an_py310.py hl[68:69,82] *}
/// info | 정보
@@ -154,7 +154,7 @@ $ fastapi dev main.py
WebSocket 연결이 닫히면, `await websocket.receive_text()`가 `WebSocketDisconnect` 예외를 발생시킵니다. 그러면 이 예제처럼 이를 잡아 처리할 수 있습니다.
-{* ../../docs_src/websockets/tutorial003_py310.py hl[79:81] *}
+{* ../../docs_src/websockets_/tutorial003_py310.py hl[79:81] *}
테스트해보기:
diff --git a/docs/pt/docs/advanced/websockets.md b/docs/pt/docs/advanced/websockets.md
index c294b7603e..f148defd4c 100644
--- a/docs/pt/docs/advanced/websockets.md
+++ b/docs/pt/docs/advanced/websockets.md
@@ -38,13 +38,13 @@ Na produção, você teria uma das opções acima.
Mas é a maneira mais simples de focar no lado do servidor de WebSockets e ter um exemplo funcional:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[2,6:38,41:43] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[2,6:38,41:43] *}
## Crie um `websocket` { #create-a-websocket }
Em sua aplicação **FastAPI**, crie um `websocket`:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[1,46:47] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[1,46:47] *}
/// note | Detalhes Técnicos
@@ -58,7 +58,7 @@ A **FastAPI** fornece o mesmo `WebSocket` diretamente apenas como uma conveniên
Em sua rota WebSocket você pode esperar (`await`) por mensagens e enviar mensagens.
-{* ../../docs_src/websockets/tutorial001_py310.py hl[48:52] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:52] *}
Você pode receber e enviar dados binários, de texto e JSON.
@@ -109,7 +109,7 @@ Nos endpoints WebSocket você pode importar do `fastapi` e usar:
Eles funcionam da mesma forma que para outros endpoints FastAPI/*operações de rota*:
-{* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
+{* ../../docs_src/websockets_/tutorial002_an_py310.py hl[68:69,82] *}
/// info | Informação
@@ -154,7 +154,7 @@ Com isso você pode conectar o WebSocket e então enviar e receber mensagens:
Quando uma conexão WebSocket é fechada, o `await websocket.receive_text()` levantará uma exceção `WebSocketDisconnect`, que você pode então capturar e lidar como neste exemplo.
-{* ../../docs_src/websockets/tutorial003_py310.py hl[79:81] *}
+{* ../../docs_src/websockets_/tutorial003_py310.py hl[79:81] *}
Para testar:
diff --git a/docs/ru/docs/advanced/middleware.md b/docs/ru/docs/advanced/middleware.md
index 034feae7eb..1f1a160604 100644
--- a/docs/ru/docs/advanced/middleware.md
+++ b/docs/ru/docs/advanced/middleware.md
@@ -83,7 +83,7 @@ app.add_middleware(UnicornMiddleware, some_config="rainbow")
Поддерживаются следующие аргументы:
- `minimum_size` — не сжимать GZip‑ом ответы, размер которых меньше этого минимального значения в байтах. По умолчанию — `500`.
-- `compresslevel` — уровень GZip‑сжатия. Целое число от 1 до 9. По умолчанию — `9`. Более низкое значение — быстреее сжатие, но больший размер файла; более высокое значение — более медленное сжатие, но меньший размер файла.
+- `compresslevel` — уровень GZip‑сжатия. Целое число от 1 до 9. По умолчанию — `9`. Более низкое значение — быстрее сжатие, но больший размер файла; более высокое значение — более медленное сжатие, но меньший размер файла.
## Другие middleware { #other-middlewares }
diff --git a/docs/ru/docs/advanced/websockets.md b/docs/ru/docs/advanced/websockets.md
index 446cc2505e..d565d507bc 100644
--- a/docs/ru/docs/advanced/websockets.md
+++ b/docs/ru/docs/advanced/websockets.md
@@ -38,13 +38,13 @@ $ pip install websockets
Для примера нам нужен наиболее простой способ, который позволит сосредоточиться на серверной части веб‑сокетов и получить рабочий код:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[2,6:38,41:43] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[2,6:38,41:43] *}
## Создание `websocket` { #create-a-websocket }
Создайте `websocket` в своем **FastAPI** приложении:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[1,46:47] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[1,46:47] *}
/// note | Технические детали
@@ -58,7 +58,7 @@ $ pip install websockets
Через эндпоинт веб-сокета вы можете получать и отправлять сообщения.
-{* ../../docs_src/websockets/tutorial001_py310.py hl[48:52] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:52] *}
Вы можете получать и отправлять двоичные, текстовые и JSON данные.
@@ -109,7 +109,7 @@ $ fastapi dev main.py
Они работают так же, как и в других FastAPI эндпоинтах/*операциях пути*:
-{* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
+{* ../../docs_src/websockets_/tutorial002_an_py310.py hl[68:69,82] *}
/// info | Примечание
@@ -154,7 +154,7 @@ $ fastapi dev main.py
Если веб-сокет соединение закрыто, то `await websocket.receive_text()` вызовет исключение `WebSocketDisconnect`, которое можно поймать и обработать как в этом примере:
-{* ../../docs_src/websockets/tutorial003_py310.py hl[79:81] *}
+{* ../../docs_src/websockets_/tutorial003_py310.py hl[79:81] *}
Чтобы воспроизвести пример:
diff --git a/docs/ru/docs/deployment/docker.md b/docs/ru/docs/deployment/docker.md
index 791057fe56..5dfa211599 100644
--- a/docs/ru/docs/deployment/docker.md
+++ b/docs/ru/docs/deployment/docker.md
@@ -214,7 +214,7 @@ CMD ["fastapi", "run", "app/main.py", "--port", "80"]
5. Копируем директорию `./app` внутрь директории `/code`.
- Так как здесь весь код, который **меняется чаще всего**, кэш Docker **вряд ли** будет использоваться для этого шагa или **последующих шагов**.
+ Так как здесь весь код, который **меняется чаще всего**, кэш Docker **вряд ли** будет использоваться для этого шага или **последующих шагов**.
Поэтому важно разместить этот шаг **ближе к концу** `Dockerfile`, чтобы оптимизировать время сборки образа контейнера.
diff --git a/docs/ru/docs/history-design-future.md b/docs/ru/docs/history-design-future.md
index e2395fe8b9..5019157600 100644
--- a/docs/ru/docs/history-design-future.md
+++ b/docs/ru/docs/history-design-future.md
@@ -76,4 +76,4 @@
У **FastAPI** великое будущее.
-И [ваш вклад в это](help-fastapi.md){.internal-link target=_blank} - очень ценнен.
+И [ваш вклад в это](help-fastapi.md){.internal-link target=_blank} - очень ценен.
diff --git a/docs/ru/docs/tutorial/security/oauth2-jwt.md b/docs/ru/docs/tutorial/security/oauth2-jwt.md
index 7838b07df4..f7853d48f7 100644
--- a/docs/ru/docs/tutorial/security/oauth2-jwt.md
+++ b/docs/ru/docs/tutorial/security/oauth2-jwt.md
@@ -20,7 +20,7 @@ eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4
Но он подписан. Следовательно, когда вы получаете токен, который вы эмитировали (выдавали), вы можете убедиться, что это именно вы его эмитировали.
-Таким образом, можно создать токен со сроком действия, скажем, 1 неделя. А когда пользователь вернется на следующий день с тем же токеном, вы будете знать, что он все еще авторизирован в вашей системе.
+Таким образом, можно создать токен со сроком действия, скажем, 1 неделя. А когда пользователь вернется на следующий день с тем же токеном, вы будете знать, что он все еще авторизован в вашей системе.
Через неделю срок действия токена истечет, пользователь не будет авторизован и ему придется заново входить в систему, чтобы получить новый токен. А если пользователь (или третье лицо) попытается модифицировать токен, чтобы изменить срок действия, вы сможете это обнаружить, поскольку подписи не будут совпадать.
diff --git a/docs/tr/docs/advanced/websockets.md b/docs/tr/docs/advanced/websockets.md
index 16b4be7e8d..a5ab27597e 100644
--- a/docs/tr/docs/advanced/websockets.md
+++ b/docs/tr/docs/advanced/websockets.md
@@ -38,13 +38,13 @@ Production'da yukarıdaki seçeneklerden birini kullanırsınız.
Ama WebSockets'in server tarafına odaklanmak ve çalışan bir örnek görmek için en basit yol bu:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[2,6:38,41:43] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[2,6:38,41:43] *}
## Bir `websocket` Oluşturun { #create-a-websocket }
**FastAPI** uygulamanızda bir `websocket` oluşturun:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[1,46:47] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[1,46:47] *}
/// note | Teknik Detaylar
@@ -58,7 +58,7 @@ Ama WebSockets'in server tarafına odaklanmak ve çalışan bir örnek görmek i
WebSocket route'unuzda mesajları `await` edebilir ve mesaj gönderebilirsiniz.
-{* ../../docs_src/websockets/tutorial001_py310.py hl[48:52] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:52] *}
Binary, text ve JSON verisi alıp gönderebilirsiniz.
@@ -109,7 +109,7 @@ WebSocket endpoint'lerinde `fastapi` içinden import edip şunları kullanabilir
Diğer FastAPI endpoint'leri/*path operations* ile aynı şekilde çalışırlar:
-{* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
+{* ../../docs_src/websockets_/tutorial002_an_py310.py hl[68:69,82] *}
/// info | Bilgi
@@ -154,7 +154,7 @@ Bununla WebSocket'e bağlanabilir, ardından mesaj gönderip alabilirsiniz:
Bir WebSocket bağlantısı kapandığında, `await websocket.receive_text()` bir `WebSocketDisconnect` exception'ı raise eder; ardından bunu bu örnekteki gibi yakalayıp (catch) yönetebilirsiniz.
-{* ../../docs_src/websockets/tutorial003_py310.py hl[79:81] *}
+{* ../../docs_src/websockets_/tutorial003_py310.py hl[79:81] *}
Denemek için:
diff --git a/docs/uk/docs/advanced/websockets.md b/docs/uk/docs/advanced/websockets.md
index 21bb61d7e9..bb06ac00b7 100644
--- a/docs/uk/docs/advanced/websockets.md
+++ b/docs/uk/docs/advanced/websockets.md
@@ -38,13 +38,13 @@ $ pip install websockets
Але це найпростіший спосіб зосередитися на серверній частині WebSockets і мати робочий приклад:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[2,6:38,41:43] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[2,6:38,41:43] *}
## Створіть `websocket` { #create-a-websocket }
У вашому застосунку **FastAPI** створіть `websocket`:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[1,46:47] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[1,46:47] *}
/// note | Технічні деталі
@@ -58,7 +58,7 @@ $ pip install websockets
У вашому маршруті WebSocket ви можете `await` повідомлення і надсилати повідомлення.
-{* ../../docs_src/websockets/tutorial001_py310.py hl[48:52] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:52] *}
Ви можете отримувати та надсилати бінарні, текстові та JSON-дані.
@@ -109,7 +109,7 @@ $ fastapi dev main.py
Вони працюють так само, як для інших ендпойнтів FastAPI/*операцій шляху*:
-{* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
+{* ../../docs_src/websockets_/tutorial002_an_py310.py hl[68:69,82] *}
/// info
@@ -154,7 +154,7 @@ $ fastapi dev main.py
Коли з'єднання WebSocket закривається, `await websocket.receive_text()` підніме виняток `WebSocketDisconnect`, який ви можете перехопити й обробити, як у цьому прикладі.
-{* ../../docs_src/websockets/tutorial003_py310.py hl[79:81] *}
+{* ../../docs_src/websockets_/tutorial003_py310.py hl[79:81] *}
Щоб спробувати:
diff --git a/docs/zh-hant/docs/advanced/websockets.md b/docs/zh-hant/docs/advanced/websockets.md
index c4e904f6f6..22e3fdcb9e 100644
--- a/docs/zh-hant/docs/advanced/websockets.md
+++ b/docs/zh-hant/docs/advanced/websockets.md
@@ -38,13 +38,13 @@ $ pip install websockets
但這是能讓我們專注於 WebSocket 伺服端並跑起一個可運作範例的最簡單方式:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[2,6:38,41:43] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[2,6:38,41:43] *}
## 建立一個 `websocket` { #create-a-websocket }
在你的 **FastAPI** 應用中,建立一個 `websocket`:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[1,46:47] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[1,46:47] *}
/// note | 技術細節
@@ -58,7 +58,7 @@ $ pip install websockets
在你的 WebSocket 路由中,你可以 `await` 接收訊息並傳送訊息。
-{* ../../docs_src/websockets/tutorial001_py310.py hl[48:52] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:52] *}
你可以接收與傳送二進位、文字與 JSON 資料。
@@ -109,7 +109,7 @@ $ fastapi dev main.py
它們的運作方式與其他 FastAPI 端點/*路徑操作* 相同:
-{* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
+{* ../../docs_src/websockets_/tutorial002_an_py310.py hl[68:69,82] *}
/// info
@@ -154,7 +154,7 @@ $ fastapi dev main.py
當 WebSocket 連線關閉時,`await websocket.receive_text()` 會拋出 `WebSocketDisconnect` 例外,你可以像範例中那樣捕捉並處理。
-{* ../../docs_src/websockets/tutorial003_py310.py hl[79:81] *}
+{* ../../docs_src/websockets_/tutorial003_py310.py hl[79:81] *}
試用方式:
diff --git a/docs/zh/docs/advanced/websockets.md b/docs/zh/docs/advanced/websockets.md
index 513e1aaecd..a4cdae3a22 100644
--- a/docs/zh/docs/advanced/websockets.md
+++ b/docs/zh/docs/advanced/websockets.md
@@ -38,13 +38,13 @@ $ pip install websockets
但这是一种专注于 WebSockets 的服务器端并提供一个工作示例的最简单方式:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[2,6:38,41:43] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[2,6:38,41:43] *}
## 创建 `websocket` { #create-a-websocket }
在您的 **FastAPI** 应用程序中,创建一个 `websocket`:
-{* ../../docs_src/websockets/tutorial001_py310.py hl[1,46:47] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[1,46:47] *}
/// note | 技术细节
@@ -58,7 +58,7 @@ $ pip install websockets
在您的 WebSocket 路由中,您可以使用 `await` 等待消息并发送消息。
-{* ../../docs_src/websockets/tutorial001_py310.py hl[48:52] *}
+{* ../../docs_src/websockets_/tutorial001_py310.py hl[48:52] *}
您可以接收和发送二进制、文本和 JSON 数据。
@@ -109,7 +109,7 @@ $ fastapi dev main.py
它们的工作方式与其他 FastAPI 端点/*路径操作* 相同:
-{* ../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82] *}
+{* ../../docs_src/websockets_/tutorial002_an_py310.py hl[68:69,82] *}
/// info
@@ -154,7 +154,7 @@ $ fastapi dev main.py
当 WebSocket 连接关闭时,`await websocket.receive_text()` 将引发 `WebSocketDisconnect` 异常,您可以捕获并处理该异常,就像本示例中的示例一样。
-{* ../../docs_src/websockets/tutorial003_py310.py hl[79:81] *}
+{* ../../docs_src/websockets_/tutorial003_py310.py hl[79:81] *}
尝试以下操作:
diff --git a/docs_src/custom_response/tutorial007_py310.py b/docs_src/custom_response/tutorial007_py310.py
index e2a53a2119..f8dd9f895d 100644
--- a/docs_src/custom_response/tutorial007_py310.py
+++ b/docs_src/custom_response/tutorial007_py310.py
@@ -1,3 +1,4 @@
+import anyio
from fastapi import FastAPI
from fastapi.responses import StreamingResponse
@@ -7,6 +8,7 @@ app = FastAPI()
async def fake_video_streamer():
for i in range(10):
yield b"some fake video bytes"
+ await anyio.sleep(0)
@app.get("/")
diff --git a/docs_src/custom_response/tutorial010_py310.py b/docs_src/custom_response/tutorial010_py310.py
index 57cb062604..d5bc783aa0 100644
--- a/docs_src/custom_response/tutorial010_py310.py
+++ b/docs_src/custom_response/tutorial010_py310.py
@@ -1,9 +1,9 @@
from fastapi import FastAPI
-from fastapi.responses import ORJSONResponse
+from fastapi.responses import HTMLResponse
-app = FastAPI(default_response_class=ORJSONResponse)
+app = FastAPI(default_response_class=HTMLResponse)
@app.get("/items/")
async def read_items():
- return [{"item_id": "Foo"}]
+ return "
Items
This is a list of items.
"
diff --git a/docs_src/websockets/__init__.py b/docs_src/json_base64_bytes/__init__.py
similarity index 100%
rename from docs_src/websockets/__init__.py
rename to docs_src/json_base64_bytes/__init__.py
diff --git a/docs_src/json_base64_bytes/tutorial001_py310.py b/docs_src/json_base64_bytes/tutorial001_py310.py
new file mode 100644
index 0000000000..3262ffb7f0
--- /dev/null
+++ b/docs_src/json_base64_bytes/tutorial001_py310.py
@@ -0,0 +1,46 @@
+from fastapi import FastAPI
+from pydantic import BaseModel
+
+
+class DataInput(BaseModel):
+ description: str
+ data: bytes
+
+ model_config = {"val_json_bytes": "base64"}
+
+
+class DataOutput(BaseModel):
+ description: str
+ data: bytes
+
+ model_config = {"ser_json_bytes": "base64"}
+
+
+class DataInputOutput(BaseModel):
+ description: str
+ data: bytes
+
+ model_config = {
+ "val_json_bytes": "base64",
+ "ser_json_bytes": "base64",
+ }
+
+
+app = FastAPI()
+
+
+@app.post("/data")
+def post_data(body: DataInput):
+ content = body.data.decode("utf-8")
+ return {"description": body.description, "content": content}
+
+
+@app.get("/data")
+def get_data() -> DataOutput:
+ data = "hello".encode("utf-8")
+ return DataOutput(description="A plumbus", data=data)
+
+
+@app.post("/data-in-out")
+def post_data_in_out(body: DataInputOutput) -> DataInputOutput:
+ return body
diff --git a/docs_src/python_types/tutorial005_py39.py b/docs_src/python_types/tutorial005_py39.py
deleted file mode 100644
index 6c8edb0ec4..0000000000
--- a/docs_src/python_types/tutorial005_py39.py
+++ /dev/null
@@ -1,2 +0,0 @@
-def get_items(item_a: str, item_b: int, item_c: float, item_d: bool, item_e: bytes):
- return item_a, item_b, item_c, item_d, item_e
diff --git a/docs_src/server_sent_events/__init__.py b/docs_src/server_sent_events/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/docs_src/server_sent_events/tutorial001_py310.py b/docs_src/server_sent_events/tutorial001_py310.py
new file mode 100644
index 0000000000..8fa470da50
--- /dev/null
+++ b/docs_src/server_sent_events/tutorial001_py310.py
@@ -0,0 +1,43 @@
+from collections.abc import AsyncIterable, Iterable
+
+from fastapi import FastAPI
+from fastapi.sse import EventSourceResponse
+from pydantic import BaseModel
+
+app = FastAPI()
+
+
+class Item(BaseModel):
+ name: str
+ description: str | None
+
+
+items = [
+ Item(name="Plumbus", description="A multi-purpose household device."),
+ Item(name="Portal Gun", description="A portal opening device."),
+ Item(name="Meeseeks Box", description="A box that summons a Meeseeks."),
+]
+
+
+@app.get("/items/stream", response_class=EventSourceResponse)
+async def sse_items() -> AsyncIterable[Item]:
+ for item in items:
+ yield item
+
+
+@app.get("/items/stream-no-async", response_class=EventSourceResponse)
+def sse_items_no_async() -> Iterable[Item]:
+ for item in items:
+ yield item
+
+
+@app.get("/items/stream-no-annotation", response_class=EventSourceResponse)
+async def sse_items_no_annotation():
+ for item in items:
+ yield item
+
+
+@app.get("/items/stream-no-async-no-annotation", response_class=EventSourceResponse)
+def sse_items_no_async_no_annotation():
+ for item in items:
+ yield item
diff --git a/docs_src/server_sent_events/tutorial002_py310.py b/docs_src/server_sent_events/tutorial002_py310.py
new file mode 100644
index 0000000000..0f6136f4fd
--- /dev/null
+++ b/docs_src/server_sent_events/tutorial002_py310.py
@@ -0,0 +1,26 @@
+from collections.abc import AsyncIterable
+
+from fastapi import FastAPI
+from fastapi.sse import EventSourceResponse, ServerSentEvent
+from pydantic import BaseModel
+
+app = FastAPI()
+
+
+class Item(BaseModel):
+ name: str
+ price: float
+
+
+items = [
+ Item(name="Plumbus", price=32.99),
+ Item(name="Portal Gun", price=999.99),
+ Item(name="Meeseeks Box", price=49.99),
+]
+
+
+@app.get("/items/stream", response_class=EventSourceResponse)
+async def stream_items() -> AsyncIterable[ServerSentEvent]:
+ yield ServerSentEvent(comment="stream of item updates")
+ for i, item in enumerate(items):
+ yield ServerSentEvent(data=item, event="item_update", id=str(i + 1), retry=5000)
diff --git a/docs_src/server_sent_events/tutorial003_py310.py b/docs_src/server_sent_events/tutorial003_py310.py
new file mode 100644
index 0000000000..3006deb86d
--- /dev/null
+++ b/docs_src/server_sent_events/tutorial003_py310.py
@@ -0,0 +1,17 @@
+from collections.abc import AsyncIterable
+
+from fastapi import FastAPI
+from fastapi.sse import EventSourceResponse, ServerSentEvent
+
+app = FastAPI()
+
+
+@app.get("/logs/stream", response_class=EventSourceResponse)
+async def stream_logs() -> AsyncIterable[ServerSentEvent]:
+ logs = [
+ "2025-01-01 INFO Application started",
+ "2025-01-01 DEBUG Connected to database",
+ "2025-01-01 WARN High memory usage detected",
+ ]
+ for log_line in logs:
+ yield ServerSentEvent(raw_data=log_line)
diff --git a/docs_src/server_sent_events/tutorial004_py310.py b/docs_src/server_sent_events/tutorial004_py310.py
new file mode 100644
index 0000000000..3e8f8d113f
--- /dev/null
+++ b/docs_src/server_sent_events/tutorial004_py310.py
@@ -0,0 +1,31 @@
+from collections.abc import AsyncIterable
+from typing import Annotated
+
+from fastapi import FastAPI, Header
+from fastapi.sse import EventSourceResponse, ServerSentEvent
+from pydantic import BaseModel
+
+app = FastAPI()
+
+
+class Item(BaseModel):
+ name: str
+ price: float
+
+
+items = [
+ Item(name="Plumbus", price=32.99),
+ Item(name="Portal Gun", price=999.99),
+ Item(name="Meeseeks Box", price=49.99),
+]
+
+
+@app.get("/items/stream", response_class=EventSourceResponse)
+async def stream_items(
+ last_event_id: Annotated[int | None, Header()] = None,
+) -> AsyncIterable[ServerSentEvent]:
+ start = last_event_id + 1 if last_event_id is not None else 0
+ for i, item in enumerate(items):
+ if i < start:
+ continue
+ yield ServerSentEvent(data=item, id=str(i))
diff --git a/docs_src/server_sent_events/tutorial005_py310.py b/docs_src/server_sent_events/tutorial005_py310.py
new file mode 100644
index 0000000000..4e6730e5aa
--- /dev/null
+++ b/docs_src/server_sent_events/tutorial005_py310.py
@@ -0,0 +1,19 @@
+from collections.abc import AsyncIterable
+
+from fastapi import FastAPI
+from fastapi.sse import EventSourceResponse, ServerSentEvent
+from pydantic import BaseModel
+
+app = FastAPI()
+
+
+class Prompt(BaseModel):
+ text: str
+
+
+@app.post("/chat/stream", response_class=EventSourceResponse)
+async def stream_chat(prompt: Prompt) -> AsyncIterable[ServerSentEvent]:
+ words = prompt.text.split()
+ for word in words:
+ yield ServerSentEvent(data=word, event="token")
+ yield ServerSentEvent(raw_data="[DONE]", event="done")
diff --git a/docs_src/stream_data/__init__.py b/docs_src/stream_data/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/docs_src/stream_data/tutorial001_py310.py b/docs_src/stream_data/tutorial001_py310.py
new file mode 100644
index 0000000000..2e91ec9ac9
--- /dev/null
+++ b/docs_src/stream_data/tutorial001_py310.py
@@ -0,0 +1,65 @@
+from collections.abc import AsyncIterable, Iterable
+
+from fastapi import FastAPI
+from fastapi.responses import StreamingResponse
+
+app = FastAPI()
+
+
+message = """
+Rick: (stumbles in drunkenly, and turns on the lights) Morty! You gotta come on. You got--... you gotta come with me.
+Morty: (rubs his eyes) What, Rick? What's going on?
+Rick: I got a surprise for you, Morty.
+Morty: It's the middle of the night. What are you talking about?
+Rick: (spills alcohol on Morty's bed) Come on, I got a surprise for you. (drags Morty by the ankle) Come on, hurry up. (pulls Morty out of his bed and into the hall)
+Morty: Ow! Ow! You're tugging me too hard!
+Rick: We gotta go, gotta get outta here, come on. Got a surprise for you Morty.
+"""
+
+
+@app.get("/story/stream", response_class=StreamingResponse)
+async def stream_story() -> AsyncIterable[str]:
+ for line in message.splitlines():
+ yield line
+
+
+@app.get("/story/stream-no-async", response_class=StreamingResponse)
+def stream_story_no_async() -> Iterable[str]:
+ for line in message.splitlines():
+ yield line
+
+
+@app.get("/story/stream-no-annotation", response_class=StreamingResponse)
+async def stream_story_no_annotation():
+ for line in message.splitlines():
+ yield line
+
+
+@app.get("/story/stream-no-async-no-annotation", response_class=StreamingResponse)
+def stream_story_no_async_no_annotation():
+ for line in message.splitlines():
+ yield line
+
+
+@app.get("/story/stream-bytes", response_class=StreamingResponse)
+async def stream_story_bytes() -> AsyncIterable[bytes]:
+ for line in message.splitlines():
+ yield line.encode("utf-8")
+
+
+@app.get("/story/stream-no-async-bytes", response_class=StreamingResponse)
+def stream_story_no_async_bytes() -> Iterable[bytes]:
+ for line in message.splitlines():
+ yield line.encode("utf-8")
+
+
+@app.get("/story/stream-no-annotation-bytes", response_class=StreamingResponse)
+async def stream_story_no_annotation_bytes():
+ for line in message.splitlines():
+ yield line.encode("utf-8")
+
+
+@app.get("/story/stream-no-async-no-annotation-bytes", response_class=StreamingResponse)
+def stream_story_no_async_no_annotation_bytes():
+ for line in message.splitlines():
+ yield line.encode("utf-8")
diff --git a/docs_src/stream_data/tutorial002_py310.py b/docs_src/stream_data/tutorial002_py310.py
new file mode 100644
index 0000000000..aa8bcee3a9
--- /dev/null
+++ b/docs_src/stream_data/tutorial002_py310.py
@@ -0,0 +1,54 @@
+import base64
+from collections.abc import AsyncIterable, Iterable
+from io import BytesIO
+
+from fastapi import FastAPI
+from fastapi.responses import StreamingResponse
+
+image_base64 = "iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAAbnpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjadYzRDYAwCET/mcIRDoq0jGOiJm7g+NJK0vjhS4DjIEfHfZ20DKqSrrWZmyFQV5ctRMOLACxglNCcXk7zVqFzJzF8kV6R5vOJ97yVH78HjfYAtg0ged033ZgAAAoCaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/Pgo8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJYTVAgQ29yZSA0LjQuMC1FeGl2MiI+CiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyIKICAgIHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIgogICBleGlmOlBpeGVsWERpbWVuc2lvbj0iMjkiCiAgIGV4aWY6UGl4ZWxZRGltZW5zaW9uPSIyOSIKICAgdGlmZjpJbWFnZVdpZHRoPSIyOSIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMjkiCiAgIHRpZmY6T3JpZW50YXRpb249IjEiLz4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PnQkBZAAAAAEc0JJVAgICAh8CGSIAAABoklEQVRIx8VXwY7FIAjE5iXWU+P/f6RHPNW9LIaOoHYP+0yMShVkwNGG1lqjfy4HfaF0oyEEt+oSQqBaa//m9Wd6PlqhhbRMDiEQM3e59FNKw5qZHpnQfuPaW6lazsztvu/eElFj5j63lNLlMz2ttbZtVMu1MTGo5Sujn93gMzOllKiUQjHGB9QxxneZhJ5iwZ1rL2fwenoGeL0q3wVGhBPHMz0PeFccIfASEeWcO8xEROd50q6eAV6s1s5XXoncas1EKqVQznnwUBdJJmm1l3hmmdlOMrGO8Vl5gZ56Y0y8IZF0BuqkQWM4B6HXrRCKa1SEqyzEo7KK59RT/VHDjX3ZvSefeW3CO6O6vsiA1NrwVkxxAcYTCcHyTjZmJd00pugBQoTnzjvn+kzLBh9GtRDjhleZFwbx3kugP3GvFzdkqRlbDYw0u/HxKjuOw2QxZCGL5V5f4l7cd6qsffUa1DcLM9N1XcTMvep5ul1e4jNPtZfWGIkE6dI8MquXg/dS2CGVJQ2ushd5GmlxFdOw+1tRa32MY4zDQ9yaZ60J3/iX+QG4U3qGrFHmswAAAABJRU5ErkJggg=="
+binary_image = base64.b64decode(image_base64)
+
+
+def read_image() -> BytesIO:
+ return BytesIO(binary_image)
+
+
+app = FastAPI()
+
+
+class PNGStreamingResponse(StreamingResponse):
+ media_type = "image/png"
+
+
+@app.get("/image/stream", response_class=PNGStreamingResponse)
+async def stream_image() -> AsyncIterable[bytes]:
+ with read_image() as image_file:
+ for chunk in image_file:
+ yield chunk
+
+
+@app.get("/image/stream-no-async", response_class=PNGStreamingResponse)
+def stream_image_no_async() -> Iterable[bytes]:
+ with read_image() as image_file:
+ for chunk in image_file:
+ yield chunk
+
+
+@app.get("/image/stream-no-async-yield-from", response_class=PNGStreamingResponse)
+def stream_image_no_async_yield_from() -> Iterable[bytes]:
+ with read_image() as image_file:
+ yield from image_file
+
+
+@app.get("/image/stream-no-annotation", response_class=PNGStreamingResponse)
+async def stream_image_no_annotation():
+ with read_image() as image_file:
+ for chunk in image_file:
+ yield chunk
+
+
+@app.get("/image/stream-no-async-no-annotation", response_class=PNGStreamingResponse)
+def stream_image_no_async_no_annotation():
+ with read_image() as image_file:
+ for chunk in image_file:
+ yield chunk
diff --git a/docs_src/stream_json_lines/__init__.py b/docs_src/stream_json_lines/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/docs_src/stream_json_lines/tutorial001_py310.py b/docs_src/stream_json_lines/tutorial001_py310.py
new file mode 100644
index 0000000000..4fbe7c69cc
--- /dev/null
+++ b/docs_src/stream_json_lines/tutorial001_py310.py
@@ -0,0 +1,42 @@
+from collections.abc import AsyncIterable, Iterable
+
+from fastapi import FastAPI
+from pydantic import BaseModel
+
+app = FastAPI()
+
+
+class Item(BaseModel):
+ name: str
+ description: str | None
+
+
+items = [
+ Item(name="Plumbus", description="A multi-purpose household device."),
+ Item(name="Portal Gun", description="A portal opening device."),
+ Item(name="Meeseeks Box", description="A box that summons a Meeseeks."),
+]
+
+
+@app.get("/items/stream")
+async def stream_items() -> AsyncIterable[Item]:
+ for item in items:
+ yield item
+
+
+@app.get("/items/stream-no-async")
+def stream_items_no_async() -> Iterable[Item]:
+ for item in items:
+ yield item
+
+
+@app.get("/items/stream-no-annotation")
+async def stream_items_no_annotation():
+ for item in items:
+ yield item
+
+
+@app.get("/items/stream-no-async-no-annotation")
+def stream_items_no_async_no_annotation():
+ for item in items:
+ yield item
diff --git a/docs_src/strict_content_type/__init__.py b/docs_src/strict_content_type/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/docs_src/strict_content_type/tutorial001_py310.py b/docs_src/strict_content_type/tutorial001_py310.py
new file mode 100644
index 0000000000..a44f4b1386
--- /dev/null
+++ b/docs_src/strict_content_type/tutorial001_py310.py
@@ -0,0 +1,14 @@
+from fastapi import FastAPI
+from pydantic import BaseModel
+
+app = FastAPI(strict_content_type=False)
+
+
+class Item(BaseModel):
+ name: str
+ price: float
+
+
+@app.post("/items/")
+async def create_item(item: Item):
+ return item
diff --git a/docs_src/websockets_/__init__.py b/docs_src/websockets_/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/docs_src/websockets/tutorial001_py310.py b/docs_src/websockets_/tutorial001_py310.py
similarity index 100%
rename from docs_src/websockets/tutorial001_py310.py
rename to docs_src/websockets_/tutorial001_py310.py
diff --git a/docs_src/websockets/tutorial002_an_py310.py b/docs_src/websockets_/tutorial002_an_py310.py
similarity index 100%
rename from docs_src/websockets/tutorial002_an_py310.py
rename to docs_src/websockets_/tutorial002_an_py310.py
diff --git a/docs_src/websockets/tutorial002_py310.py b/docs_src/websockets_/tutorial002_py310.py
similarity index 100%
rename from docs_src/websockets/tutorial002_py310.py
rename to docs_src/websockets_/tutorial002_py310.py
diff --git a/docs_src/websockets/tutorial003_py310.py b/docs_src/websockets_/tutorial003_py310.py
similarity index 100%
rename from docs_src/websockets/tutorial003_py310.py
rename to docs_src/websockets_/tutorial003_py310.py
diff --git a/fastapi/.agents/skills/fastapi/SKILL.md b/fastapi/.agents/skills/fastapi/SKILL.md
new file mode 100644
index 0000000000..48cfdabb87
--- /dev/null
+++ b/fastapi/.agents/skills/fastapi/SKILL.md
@@ -0,0 +1,436 @@
+---
+name: fastapi
+description: FastAPI best practices and conventions. Use when working with FastAPI APIs and Pydantic models for them. Keeps FastAPI code clean and up to date with the latest features and patterns, updated with new versions. Write new code or refactor and update old code.
+---
+
+# FastAPI
+
+Official FastAPI skill to write code with best practices, keeping up to date with new versions and features.
+
+## Use the `fastapi` CLI
+
+Run the development server on localhost with reload:
+
+```bash
+fastapi dev
+```
+
+
+Run the production server:
+
+```bash
+fastapi run
+```
+
+### Add an entrypoint in `pyproject.toml`
+
+FastAPI CLI will read the entrypoint in `pyproject.toml` to know where the FastAPI app is declared.
+
+```toml
+[tool.fastapi]
+entrypoint = "my_app.main:app"
+```
+
+### Use `fastapi` with a path
+
+When adding the entrypoint to `pyproject.toml` is not possible, or the user explicitly asks not to, or it's running an independent small app, you can pass the app file path to the `fastapi` command:
+
+```bash
+fastapi dev my_app/main.py
+```
+
+Prefer to set the entrypoint in `pyproject.toml` when possible.
+
+## Use `Annotated`
+
+Always prefer the `Annotated` style for parameter and dependency declarations.
+
+It keeps the function signatures working in other contexts, respects the types, allows reusability.
+
+### In Parameter Declarations
+
+Use `Annotated` for parameter declarations, including `Path`, `Query`, `Header`, etc.:
+
+```python
+from typing import Annotated
+
+from fastapi import FastAPI, Path, Query
+
+app = FastAPI()
+
+
+@app.get("/items/{item_id}")
+async def read_item(
+ item_id: Annotated[int, Path(ge=1, description="The item ID")],
+ q: Annotated[str | None, Query(max_length=50)] = None,
+):
+ return {"message": "Hello World"}
+```
+
+instead of:
+
+```python
+# DO NOT DO THIS
+@app.get("/items/{item_id}")
+async def read_item(
+ item_id: int = Path(ge=1, description="The item ID"),
+ q: str | None = Query(default=None, max_length=50),
+):
+ return {"message": "Hello World"}
+```
+
+### For Dependencies
+
+Use `Annotated` for dependencies with `Depends()`.
+
+Unless asked not to, create a new type alias for the dependency to allow re-using it.
+
+```python
+from typing import Annotated
+
+from fastapi import Depends, FastAPI
+
+app = FastAPI()
+
+
+def get_current_user():
+ return {"username": "johndoe"}
+
+
+CurrentUserDep = Annotated[dict, Depends(get_current_user)]
+
+
+@app.get("/items/")
+async def read_item(current_user: CurrentUserDep):
+ return {"message": "Hello World"}
+```
+
+instead of:
+
+```python
+# DO NOT DO THIS
+@app.get("/items/")
+async def read_item(current_user: dict = Depends(get_current_user)):
+ return {"message": "Hello World"}
+```
+
+## Do not use Ellipsis for *path operations* or Pydantic models
+
+Do not use `...` as a default value for required parameters, it's not needed and not recommended.
+
+Do this, without Ellipsis (`...`):
+
+```python
+from typing import Annotated
+
+from fastapi import FastAPI, Query
+from pydantic import BaseModel, Field
+
+
+class Item(BaseModel):
+ name: str
+ description: str | None = None
+ price: float = Field(gt=0)
+
+
+app = FastAPI()
+
+
+@app.post("/items/")
+async def create_item(item: Item, project_id: Annotated[int, Query()]): ...
+```
+
+instead of this:
+
+```python
+# DO NOT DO THIS
+class Item(BaseModel):
+ name: str = ...
+ description: str | None = None
+ price: float = Field(..., gt=0)
+
+
+app = FastAPI()
+
+
+@app.post("/items/")
+async def create_item(item: Item, project_id: Annotated[int, Query(...)]): ...
+```
+
+## Return Type or Response Model
+
+When possible, include a return type. It will be used to validate, filter, document, and serialize the response.
+
+```python
+from fastapi import FastAPI
+from pydantic import BaseModel
+
+app = FastAPI()
+
+
+class Item(BaseModel):
+ name: str
+ description: str | None = None
+
+
+@app.get("/items/me")
+async def get_item() -> Item:
+ return Item(name="Plumbus", description="All-purpose home device")
+```
+
+**Important**: Return types or response models are what filter data ensuring no sensitive information is exposed. And they are used to serialize data with Pydantic (in Rust), this is the main idea that can increase response performance.
+
+The return type doesn't have to be a Pydantic model, it could be a different type, like a list of integers, or a dict, etc.
+
+### When to use `response_model` instead
+
+If the return type is not the same as the type that you want to use to validate, filter, or serialize, use the `response_model` parameter on the decorator instead.
+
+```python
+from typing import Any
+
+from fastapi import FastAPI
+from pydantic import BaseModel
+
+app = FastAPI()
+
+
+class Item(BaseModel):
+ name: str
+ description: str | None = None
+
+
+@app.get("/items/me", response_model=Item)
+async def get_item() -> Any:
+ return {"name": "Foo", "description": "A very nice Item"}
+```
+
+This can be particularly useful when filtering data to expose only the public fields and avoid exposing sensitive information.
+
+```python
+from typing import Any
+
+from fastapi import FastAPI
+from pydantic import BaseModel
+
+app = FastAPI()
+
+
+class InternalItem(BaseModel):
+ name: str
+ description: str | None = None
+ secret_key: str
+
+
+class Item(BaseModel):
+ name: str
+ description: str | None = None
+
+
+@app.get("/items/me", response_model=Item)
+async def get_item() -> Any:
+ item = InternalItem(
+ name="Foo", description="A very nice Item", secret_key="supersecret"
+ )
+ return item
+```
+
+## Performance
+
+Do not use `ORJSONResponse` or `UJSONResponse`, they are deprecated.
+
+Instead, declare a return type or response model. Pydantic will handle the data serialization on the Rust side.
+
+## Including Routers
+
+When declaring routers, prefer to add router level parameters like prefix, tags, etc. to the router itself, instead of in `include_router()`.
+
+Do this:
+
+```python
+from fastapi import APIRouter, FastAPI
+
+app = FastAPI()
+
+router = APIRouter(prefix="/items", tags=["items"])
+
+
+@router.get("/")
+async def list_items():
+ return []
+
+
+# In main.py
+app.include_router(router)
+```
+
+instead of this:
+
+```python
+# DO NOT DO THIS
+from fastapi import APIRouter, FastAPI
+
+app = FastAPI()
+
+router = APIRouter()
+
+
+@router.get("/")
+async def list_items():
+ return []
+
+
+# In main.py
+app.include_router(router, prefix="/items", tags=["items"])
+```
+
+There could be exceptions, but try to follow this convention.
+
+Apply shared dependencies at the router level via `dependencies=[Depends(...)]`.
+
+## Dependency Injection
+
+See [the dependency injection reference](references/dependencies.md) for detailed patterns including `yield` with `scope`, and class dependencies.
+
+Use dependencies when the logic can't be declared in Pydantic validation, depends on external resources, needs cleanup (with `yield`), or is shared across endpoints.
+
+Apply shared dependencies at the router level via `dependencies=[Depends(...)]`.
+
+## Async vs Sync *path operations*
+
+Use `async` *path operations* only when fully certain that the logic called inside is compatible with async and await (it's called with `await`) or that doesn't block.
+
+```python
+from fastapi import FastAPI
+
+app = FastAPI()
+
+
+# Use async def when calling async code
+@app.get("/async-items/")
+async def read_async_items():
+ data = await some_async_library.fetch_items()
+ return data
+
+
+# Use plain def when calling blocking/sync code or when in doubt
+@app.get("/items/")
+def read_items():
+ data = some_blocking_library.fetch_items()
+ return data
+```
+
+In case of doubt, or by default, use regular `def` functions, those will be run in a threadpool so they don't block the event loop.
+
+The same rules apply to dependencies.
+
+Make sure blocking code is not run inside of `async` functions. The logic will work, but will damage the performance heavily.
+
+When needing to mix blocking and async code, see Asyncer in [the other tools reference](references/other-tools.md).
+
+## Streaming (JSON Lines, SSE, bytes)
+
+See [the streaming reference](references/streaming.md) for JSON Lines, Server-Sent Events (`EventSourceResponse`, `ServerSentEvent`), and byte streaming (`StreamingResponse`) patterns.
+
+## Tooling
+
+See [the other tools reference](references/other-tools.md) for details on uv, Ruff, ty for package management, linting, type checking, formatting, etc.
+
+## Other Libraries
+
+See [the other tools reference](references/other-tools.md) for details on other libraries:
+
+* Asyncer for handling async and await, concurrency, mixing async and blocking code, prefer it over AnyIO or asyncio.
+* SQLModel for working with SQL databases, prefer it over SQLAlchemy.
+* HTTPX for interacting with HTTP (other APIs), prefer it over Requests.
+
+## Do not use Pydantic RootModels
+
+Do not use Pydantic `RootModel`, instead use regular type annotations with `Annotated` and Pydantic validation utilities.
+
+For example, for a list with validations you could do:
+
+```python
+from typing import Annotated
+
+from fastapi import Body, FastAPI
+from pydantic import Field
+
+app = FastAPI()
+
+
+@app.post("/items/")
+async def create_items(items: Annotated[list[int], Field(min_length=1), Body()]):
+ return items
+```
+
+instead of:
+
+```python
+# DO NOT DO THIS
+from typing import Annotated
+
+from fastapi import FastAPI
+from pydantic import Field, RootModel
+
+app = FastAPI()
+
+
+class ItemList(RootModel[Annotated[list[int], Field(min_length=1)]]):
+ pass
+
+
+@app.post("/items/")
+async def create_items(items: ItemList):
+ return items
+
+```
+
+FastAPI supports these type annotations and will create a Pydantic `TypeAdapter` for them, so that types can work as normally and there's no need for the custom logic and types in RootModels.
+
+## Use one HTTP operation per function
+
+Don't mix HTTP operations in a single function, having one function per HTTP operation helps separate concerns and organize the code.
+
+Do this:
+
+```python
+from fastapi import FastAPI
+from pydantic import BaseModel
+
+app = FastAPI()
+
+
+class Item(BaseModel):
+ name: str
+
+
+@app.get("/items/")
+async def list_items():
+ return []
+
+
+@app.post("/items/")
+async def create_item(item: Item):
+ return item
+```
+
+instead of this:
+
+```python
+# DO NOT DO THIS
+from fastapi import FastAPI, Request
+from pydantic import BaseModel
+
+app = FastAPI()
+
+
+class Item(BaseModel):
+ name: str
+
+
+@app.api_route("/items/", methods=["GET", "POST"])
+async def handle_items(request: Request):
+ if request.method == "GET":
+ return []
+```
diff --git a/fastapi/.agents/skills/fastapi/references/dependencies.md b/fastapi/.agents/skills/fastapi/references/dependencies.md
new file mode 100644
index 0000000000..ca709096e6
--- /dev/null
+++ b/fastapi/.agents/skills/fastapi/references/dependencies.md
@@ -0,0 +1,142 @@
+# Dependency Injection
+
+Use dependencies when:
+
+* They can't be declared in Pydantic validation and require additional logic
+* The logic depends on external resources or could block in any other way
+* Other dependencies need their results (it's a sub-dependency)
+* The logic can be shared by multiple endpoints to do things like error early, authentication, etc.
+* They need to handle cleanup (e.g., DB sessions, file handles), using dependencies with `yield`
+* Their logic needs input data from the request, like headers, query parameters, etc.
+
+## Dependencies with `yield` and `scope`
+
+When using dependencies with `yield`, they can have a `scope` that defines when the exit code is run.
+
+Use the default scope `"request"` to run the exit code after the response is sent back.
+
+```python
+from typing import Annotated
+
+from fastapi import Depends, FastAPI
+
+app = FastAPI()
+
+
+def get_db():
+ db = DBSession()
+ try:
+ yield db
+ finally:
+ db.close()
+
+
+DBDep = Annotated[DBSession, Depends(get_db)]
+
+
+@app.get("/items/")
+async def read_items(db: DBDep):
+ return db.query(Item).all()
+```
+
+Use the scope `"function"` when they should run the exit code after the response data is generated but before the response is sent back to the client.
+
+```python
+from typing import Annotated
+
+from fastapi import Depends, FastAPI
+
+app = FastAPI()
+
+
+def get_username():
+ try:
+ yield "Rick"
+ finally:
+ print("Cleanup up before response is sent")
+
+UserNameDep = Annotated[str, Depends(get_username, scope="function")]
+
+@app.get("/users/me")
+def get_user_me(username: UserNameDep):
+ return username
+```
+
+## Class Dependencies
+
+Avoid creating class dependencies when possible.
+
+If a class is needed, instead create a regular function dependency that returns a class instance.
+
+Do this:
+
+```python
+from dataclasses import dataclass
+from typing import Annotated
+
+from fastapi import Depends, FastAPI
+
+app = FastAPI()
+
+
+@dataclass
+class DatabasePaginator:
+ offset: int = 0
+ limit: int = 100
+ q: str | None = None
+
+ def get_page(self) -> dict:
+ # Simulate a page of data
+ return {
+ "offset": self.offset,
+ "limit": self.limit,
+ "q": self.q,
+ "items": [],
+ }
+
+
+def get_db_paginator(
+ offset: int = 0, limit: int = 100, q: str | None = None
+) -> DatabasePaginator:
+ return DatabasePaginator(offset=offset, limit=limit, q=q)
+
+
+PaginatorDep = Annotated[DatabasePaginator, Depends(get_db_paginator)]
+
+
+@app.get("/items/")
+async def read_items(paginator: PaginatorDep):
+ return paginator.get_page()
+```
+
+instead of this:
+
+```python
+# DO NOT DO THIS
+from typing import Annotated
+
+from fastapi import Depends, FastAPI
+
+app = FastAPI()
+
+
+class DatabasePaginator:
+ def __init__(self, offset: int = 0, limit: int = 100, q: str | None = None):
+ self.offset = offset
+ self.limit = limit
+ self.q = q
+
+ def get_page(self) -> dict:
+ # Simulate a page of data
+ return {
+ "offset": self.offset,
+ "limit": self.limit,
+ "q": self.q,
+ "items": [],
+ }
+
+
+@app.get("/items/")
+async def read_items(paginator: Annotated[DatabasePaginator, Depends()]):
+ return paginator.get_page()
+```
diff --git a/fastapi/.agents/skills/fastapi/references/other-tools.md b/fastapi/.agents/skills/fastapi/references/other-tools.md
new file mode 100644
index 0000000000..58b19d0966
--- /dev/null
+++ b/fastapi/.agents/skills/fastapi/references/other-tools.md
@@ -0,0 +1,76 @@
+# Other Tools
+
+## uv
+
+If uv is available, use it to manage dependencies.
+
+## Ruff
+
+If Ruff is available, use it to lint and format the code. Consider enabling the FastAPI rules.
+
+## ty
+
+If ty is available, use it to check types.
+
+## Asyncer
+
+When needing to run blocking code inside of async functions, or async code inside of blocking functions, suggest using Asyncer.
+
+Prefer it over AnyIO or asyncio.
+
+Install:
+
+```bash
+uv add asyncer
+```
+
+Run blocking sync code inside of async with `asyncify()`:
+
+```python
+from asyncer import asyncify
+from fastapi import FastAPI
+
+app = FastAPI()
+
+
+def do_blocking_work(name: str) -> str:
+ # Some blocking I/O operation
+ return f"Hello {name}"
+
+
+@app.get("/items/")
+async def read_items():
+ result = await asyncify(do_blocking_work)(name="World")
+ return {"message": result}
+```
+
+And run async code inside of blocking sync code with `syncify()`:
+
+```python
+from asyncer import syncify
+from fastapi import FastAPI
+
+app = FastAPI()
+
+
+async def do_async_work(name: str) -> str:
+ return f"Hello {name}"
+
+
+@app.get("/items/")
+def read_items():
+ result = syncify(do_async_work)(name="World")
+ return {"message": result}
+```
+
+## SQLModel for SQL databases
+
+When working with SQL databases, prefer using SQLModel as it is integrated with Pydantic and will allow declaring data validation with the same models.
+
+Prefer it over SQLAlchemy.
+
+## HTTPX
+
+Use HTTPX for handling HTTP communication (e.g. with other APIs). It support sync and async usage.
+
+Prefer it over Requests.
diff --git a/fastapi/.agents/skills/fastapi/references/streaming.md b/fastapi/.agents/skills/fastapi/references/streaming.md
new file mode 100644
index 0000000000..0832eedcb9
--- /dev/null
+++ b/fastapi/.agents/skills/fastapi/references/streaming.md
@@ -0,0 +1,105 @@
+# Streaming
+
+## Stream JSON Lines
+
+To stream JSON Lines, declare the return type and use `yield` to return the data.
+
+```python
+@app.get("/items/stream")
+async def stream_items() -> AsyncIterable[Item]:
+ for item in items:
+ yield item
+```
+
+## Server-Sent Events (SSE)
+
+To stream Server-Sent Events, use `response_class=EventSourceResponse` and `yield` items from the endpoint.
+
+Plain objects are automatically JSON-serialized as `data:` fields, declare the return type so the serialization is done by Pydantic:
+
+```python
+from collections.abc import AsyncIterable
+
+from fastapi import FastAPI
+from fastapi.sse import EventSourceResponse
+from pydantic import BaseModel
+
+app = FastAPI()
+
+
+class Item(BaseModel):
+ name: str
+ price: float
+
+
+@app.get("/items/stream", response_class=EventSourceResponse)
+async def stream_items() -> AsyncIterable[Item]:
+ yield Item(name="Plumbus", price=32.99)
+ yield Item(name="Portal Gun", price=999.99)
+```
+
+For full control over SSE fields (`event`, `id`, `retry`, `comment`), yield `ServerSentEvent` instances:
+
+```python
+from collections.abc import AsyncIterable
+
+from fastapi import FastAPI
+from fastapi.sse import EventSourceResponse, ServerSentEvent
+
+app = FastAPI()
+
+
+@app.get("/events", response_class=EventSourceResponse)
+async def stream_events() -> AsyncIterable[ServerSentEvent]:
+ yield ServerSentEvent(data={"status": "started"}, event="status", id="1")
+ yield ServerSentEvent(data={"progress": 50}, event="progress", id="2")
+```
+
+Use `raw_data` instead of `data` to send pre-formatted strings without JSON encoding:
+
+```python
+yield ServerSentEvent(raw_data="plain text line", event="log")
+```
+
+## Stream bytes
+
+To stream bytes, declare a `response_class=` of `StreamingResponse` or a sub-class, and use `yield` to return the data.
+
+```python
+from fastapi import FastAPI
+from fastapi.responses import StreamingResponse
+from app.utils import read_image
+
+app = FastAPI()
+
+
+class PNGStreamingResponse(StreamingResponse):
+ media_type = "image/png"
+
+@app.get("/image", response_class=PNGStreamingResponse)
+def stream_image_no_async_no_annotation():
+ with read_image() as image_file:
+ yield from image_file
+```
+
+prefer this over returning a `StreamingResponse` directly:
+
+```python
+# DO NOT DO THIS
+
+import anyio
+from fastapi import FastAPI
+from fastapi.responses import StreamingResponse
+from app.utils import read_image
+
+app = FastAPI()
+
+
+class PNGStreamingResponse(StreamingResponse):
+ media_type = "image/png"
+
+
+@app.get("/")
+async def main():
+ return PNGStreamingResponse(read_image())
+```
diff --git a/fastapi/__init__.py b/fastapi/__init__.py
index de5a0be382..06dacbd9dc 100644
--- a/fastapi/__init__.py
+++ b/fastapi/__init__.py
@@ -1,6 +1,6 @@
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
-__version__ = "0.129.0"
+__version__ = "0.135.1"
from starlette import status as status
diff --git a/fastapi/_compat/v2.py b/fastapi/_compat/v2.py
index b83bc1b55b..79fba93188 100644
--- a/fastapi/_compat/v2.py
+++ b/fastapi/_compat/v2.py
@@ -27,7 +27,7 @@ from pydantic._internal._schema_generation_shared import ( # type: ignore[attr-
)
from pydantic._internal._typing_extra import eval_type_lenient
from pydantic.fields import FieldInfo as FieldInfo
-from pydantic.json_schema import GenerateJsonSchema as GenerateJsonSchema
+from pydantic.json_schema import GenerateJsonSchema as _GenerateJsonSchema
from pydantic.json_schema import JsonSchemaValue as JsonSchemaValue
from pydantic_core import CoreSchema as CoreSchema
from pydantic_core import PydanticUndefined
@@ -40,6 +40,23 @@ RequiredParam = PydanticUndefined
Undefined = PydanticUndefined
evaluate_forwardref = eval_type_lenient
+
+class GenerateJsonSchema(_GenerateJsonSchema):
+ # TODO: remove when this is merged (or equivalent): https://github.com/pydantic/pydantic/pull/12841
+ # and dropping support for any version of Pydantic before that one (so, in a very long time)
+ def bytes_schema(self, schema: CoreSchema) -> JsonSchemaValue:
+ json_schema = {"type": "string", "contentMediaType": "application/octet-stream"}
+ bytes_mode = (
+ self._config.ser_json_bytes
+ if self.mode == "serialization"
+ else self._config.val_json_bytes
+ )
+ if bytes_mode == "base64":
+ json_schema["contentEncoding"] = "base64"
+ self.update_with_validations(json_schema, schema, self.ValidationsMapping.bytes)
+ return json_schema
+
+
# TODO: remove when dropping support for Pydantic < v2.12.3
_Attrs = {
"default": ...,
@@ -182,6 +199,32 @@ class ModelField:
exclude_none=exclude_none,
)
+ def serialize_json(
+ self,
+ value: Any,
+ *,
+ include: IncEx | None = None,
+ exclude: IncEx | None = None,
+ by_alias: bool = True,
+ exclude_unset: bool = False,
+ exclude_defaults: bool = False,
+ exclude_none: bool = False,
+ ) -> bytes:
+ # What calls this code passes a value that already called
+ # self._type_adapter.validate_python(value)
+ # This uses Pydantic's dump_json() which serializes directly to JSON
+ # bytes in one pass (via Rust), avoiding the intermediate Python dict
+ # step of dump_python(mode="json") + json.dumps().
+ return self._type_adapter.dump_json(
+ value,
+ include=include,
+ exclude=exclude,
+ by_alias=by_alias,
+ exclude_unset=exclude_unset,
+ exclude_defaults=exclude_defaults,
+ exclude_none=exclude_none,
+ )
+
def __hash__(self) -> int:
# Each ModelField is unique for our purposes, to allow making a dict from
# ModelField to its JSON Schema.
diff --git a/fastapi/applications.py b/fastapi/applications.py
index 41d86143ec..e7e816c2e9 100644
--- a/fastapi/applications.py
+++ b/fastapi/applications.py
@@ -840,6 +840,29 @@ class FastAPI(Starlette):
"""
),
] = None,
+ strict_content_type: Annotated[
+ bool,
+ Doc(
+ """
+ Enable strict checking for request Content-Type headers.
+
+ When `True` (the default), requests with a body that do not include
+ a `Content-Type` header will **not** be parsed as JSON.
+
+ This prevents potential cross-site request forgery (CSRF) attacks
+ that exploit the browser's ability to send requests without a
+ Content-Type header, bypassing CORS preflight checks. In particular
+ applicable for apps that need to be run locally (in localhost).
+
+ When `False`, requests without a `Content-Type` header will have
+ their body parsed as JSON, which maintains compatibility with
+ certain clients that don't send `Content-Type` headers.
+
+ Read more about it in the
+ [FastAPI docs for Strict Content-Type](https://fastapi.tiangolo.com/advanced/strict-content-type/).
+ """
+ ),
+ ] = True,
**extra: Annotated[
Any,
Doc(
@@ -974,6 +997,7 @@ class FastAPI(Starlette):
include_in_schema=include_in_schema,
responses=responses,
generate_unique_id_function=generate_unique_id_function,
+ strict_content_type=strict_content_type,
)
self.exception_handlers: dict[
Any, Callable[[Request, Any], Response | Awaitable[Response]]
@@ -1077,16 +1101,18 @@ class FastAPI(Starlette):
def setup(self) -> None:
if self.openapi_url:
- urls = (server_data.get("url") for server_data in self.servers)
- server_urls = {url for url in urls if url}
async def openapi(req: Request) -> JSONResponse:
root_path = req.scope.get("root_path", "").rstrip("/")
- if root_path not in server_urls:
- if root_path and self.root_path_in_servers:
- self.servers.insert(0, {"url": root_path})
- server_urls.add(root_path)
- return JSONResponse(self.openapi())
+ schema = self.openapi()
+ if root_path and self.root_path_in_servers:
+ server_urls = {s.get("url") for s in schema.get("servers", [])}
+ if root_path not in server_urls:
+ schema = dict(schema)
+ schema["servers"] = [{"url": root_path}] + schema.get(
+ "servers", []
+ )
+ return JSONResponse(schema)
self.add_route(self.openapi_url, openapi, include_in_schema=False)
if self.openapi_url and self.docs_url:
diff --git a/fastapi/datastructures.py b/fastapi/datastructures.py
index c04b5f0f39..479e1a7c3b 100644
--- a/fastapi/datastructures.py
+++ b/fastapi/datastructures.py
@@ -139,7 +139,7 @@ class UploadFile(StarletteUploadFile):
def __get_pydantic_json_schema__(
cls, core_schema: Mapping[str, Any], handler: GetJsonSchemaHandler
) -> dict[str, Any]:
- return {"type": "string", "format": "binary"}
+ return {"type": "string", "contentMediaType": "application/octet-stream"}
@classmethod
def __get_pydantic_core_schema__(
diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py
index ab18ec2db6..8fcf1a5b3c 100644
--- a/fastapi/dependencies/utils.py
+++ b/fastapi/dependencies/utils.py
@@ -1,7 +1,17 @@
import dataclasses
import inspect
import sys
-from collections.abc import Callable, Mapping, Sequence
+from collections.abc import (
+ AsyncGenerator,
+ AsyncIterable,
+ AsyncIterator,
+ Callable,
+ Generator,
+ Iterable,
+ Iterator,
+ Mapping,
+ Sequence,
+)
from contextlib import AsyncExitStack, contextmanager
from copy import copy, deepcopy
from dataclasses import dataclass
@@ -251,6 +261,26 @@ def get_typed_return_annotation(call: Callable[..., Any]) -> Any:
return get_typed_annotation(annotation, globalns)
+_STREAM_ORIGINS = {
+ AsyncIterable,
+ AsyncIterator,
+ AsyncGenerator,
+ Iterable,
+ Iterator,
+ Generator,
+}
+
+
+def get_stream_item_type(annotation: Any) -> Any | None:
+ origin = get_origin(annotation)
+ if origin is not None and origin in _STREAM_ORIGINS:
+ type_args = get_args(annotation)
+ if type_args:
+ return type_args[0]
+ return Any
+ return None
+
+
def get_dependant(
*,
path: str,
diff --git a/fastapi/openapi/docs.py b/fastapi/openapi/docs.py
index b845f87c1c..0d9242f9fa 100644
--- a/fastapi/openapi/docs.py
+++ b/fastapi/openapi/docs.py
@@ -5,6 +5,20 @@ from annotated_doc import Doc
from fastapi.encoders import jsonable_encoder
from starlette.responses import HTMLResponse
+
+def _html_safe_json(value: Any) -> str:
+ """Serialize a value to JSON with HTML special characters escaped.
+
+ This prevents injection when the JSON is embedded inside a "
+ html = get_swagger_ui_html(
+ openapi_url="/openapi.json",
+ title="Test",
+ init_oauth={"appName": xss_payload},
+ )
+ body = html.body.decode()
+
+ assert "