Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
7ff5da8
edit middleware docs code sample to use perf_counter as a timer
domdent Aug 6, 2024
ead4f8c
Merge branch 'master' into docs/edit-timer-in-middleware
tiangolo Aug 7, 2024
866c698
Merge branch 'master' into docs/edit-timer-in-middleware
estebanx64 Aug 22, 2024
6ca7b8c
Merge branch 'master' into docs/edit-timer-in-middleware
estebanx64 Aug 31, 2024
1b5984b
Merge pull request #11957 from domdent/docs/edit-timer-in-middleware
estebanx64 Aug 31, 2024
5827b92
📝 Update release notes
invalid-email-address Aug 31, 2024
c37f2c9
📝 Add note about `time.perf_counter()` in middlewares (#12095)
tiangolo Aug 31, 2024
6c8a205
📝 Update release notes
invalid-email-address Aug 31, 2024
0077af9
🔧 Update labeler config to handle sponsorships data (#12096)
tiangolo Aug 31, 2024
83422b1
📝 Update release notes
invalid-email-address Aug 31, 2024
eebc6c3
🔧 Update sponsors link: Coherence (#12097)
tiangolo Aug 31, 2024
47b3351
📝 Update release notes
invalid-email-address Aug 31, 2024
581aacc
♻️ Refactor and simplify dependencies data structures with dataclasse…
tiangolo Aug 31, 2024
75c4e7f
📝 Update release notes
invalid-email-address Aug 31, 2024
08547e1
♻️ Refactor and simplify internal `analyze_param()` to structure data…
tiangolo Aug 31, 2024
8d7d89e
📝 Update release notes
invalid-email-address Aug 31, 2024
5b7fa39
♻️ Refactor and simplify internal data from `solve_dependencies()` us…
tiangolo Aug 31, 2024
3660c7a
📝 Update release notes
invalid-email-address Aug 31, 2024
d08b95e
♻️ Rename internal `create_response_field()` to `create_model_field()…
tiangolo Aug 31, 2024
d5c6cf8
📝 Update release notes
invalid-email-address Aug 31, 2024
23bda0f
♻️ Refactor internal `check_file_field()`, rename to `ensure_multipar…
tiangolo Sep 1, 2024
b203d7a
📝 Update release notes
invalid-email-address Sep 1, 2024
92bdfbc
⬆ Bump pypa/gh-action-pypi-publish from 1.9.0 to 1.10.0 (#12112)
dependabot[bot] Sep 2, 2024
17f1f7b
📝 Update release notes
invalid-email-address Sep 2, 2024
b63b418
💚 Set `include-hidden-files` to `True` when using the `upload-artifac…
svlandeg Sep 2, 2024
a6ad088
📝 Update release notes
invalid-email-address Sep 2, 2024
6b3d1c6
⬆ Bump pillow from 10.3.0 to 10.4.0 (#12105)
dependabot[bot] Sep 3, 2024
7537bac
📝 Update release notes
invalid-email-address Sep 3, 2024
c1c5733
🌐 Add Portuguese translation for `docs/pt/docs/advanced/security/inde…
ceb10n Sep 3, 2024
e26229e
🌐 Add Portuguese translation for `docs/pt/docs/advanced/testing-event…
ceb10n Sep 3, 2024
56cfecc
📝 Update release notes
invalid-email-address Sep 3, 2024
7d69943
📝 Update release notes
invalid-email-address Sep 3, 2024
7eae925
⬆ Bump pypa/gh-action-pypi-publish from 1.10.0 to 1.10.1 (#12120)
dependabot[bot] Sep 3, 2024
560c432
📝 Update release notes
invalid-email-address Sep 3, 2024
3feed9d
🌐 Add Dutch translation for `docs/nl/docs/features.md` (#12101)
maxscheijen Sep 3, 2024
cbdc58b
📝 Update release notes
invalid-email-address Sep 3, 2024
f42fd9a
📝 Add External Link: Techniques and applications of SQLAlchemy global…
TheShubhendra Sep 3, 2024
9b2a933
📝 Update release notes
invalid-email-address Sep 3, 2024
1f64a1b
⬆ [pre-commit.ci] pre-commit autoupdate (#12115)
pre-commit-ci[bot] Sep 5, 2024
68e5ef6
📝 Update release notes
invalid-email-address Sep 5, 2024
7213d42
🔖 Release version 0.112.3
tiangolo Sep 5, 2024
aa21814
♻️ Refactor deciding if `embed` body fields, do not overwrite fields,…
tiangolo Sep 5, 2024
832e634
📝 Update release notes
invalid-email-address Sep 5, 2024
0f3e65b
✨ Add support for Pydantic models in `Form` parameters (#12127)
tiangolo Sep 5, 2024
ccb19c4
📝 Update release notes
invalid-email-address Sep 5, 2024
8e6cf9e
⏪️ Temporarily revert "✨ Add support for Pydantic models in `Form` pa…
tiangolo Sep 5, 2024
b69e8b2
📝 Update release notes
invalid-email-address Sep 5, 2024
8224add
📝 Update release notes
tiangolo Sep 5, 2024
96c7e7e
📝 Update release notes
tiangolo Sep 5, 2024
999eeb6
🔖 Release version 0.112.4
tiangolo Sep 5, 2024
965fc83
📝 Update release notes
tiangolo Sep 5, 2024
7bad7c0
✨ Add support for Pydantic models in `Form` parameters (#12129)
tiangolo Sep 5, 2024
e787f85
📝 Update release notes
invalid-email-address Sep 5, 2024
afdda4e
🔧 Update sponsors: Coherence link (#12130)
tiangolo Sep 5, 2024
179f838
📝 Update release notes
invalid-email-address Sep 5, 2024
d86f660
🔖 Release version 0.113.0
tiangolo Sep 5, 2024
c411b81
✅ Update internal tests for latest Pydantic, including CI tweaks to i…
tiangolo Sep 6, 2024
1b06b53
📝 Update release notes
invalid-email-address Sep 6, 2024
4633b1b
✨ Add support for forbidding extra form fields with Pydantic models (…
tiangolo Sep 6, 2024
a11e392
📝 Update release notes
invalid-email-address Sep 6, 2024
4ff22a0
📝 Update docs, Form Models section title, to match config name (#12152)
tiangolo Sep 6, 2024
e68d8c6
📝 Update release notes
invalid-email-address Sep 6, 2024
74842f0
📝 Update release notes
tiangolo Sep 6, 2024
bde12fa
🔖 Release version 0.114.0
tiangolo Sep 6, 2024
b60d36e
✏️ Fix typo in `fastapi/params.py` (#12143)
surreal30 Sep 6, 2024
4b9e5b3
📝 Update release notes
invalid-email-address Sep 6, 2024
edb5841
👷 Update `issue-manager.yml` (#12159)
tiangolo Sep 7, 2024
b501fc6
📝 Update release notes
invalid-email-address Sep 7, 2024
ec2a508
🌐 Add Korean translation for `docs/ko/docs/project-generation.md` (#1…
BORA040126 Sep 7, 2024
3a4431b
📝 Update release notes
invalid-email-address Sep 7, 2024
270aef7
📝 Remove duplicate line in docs for `docs/en/docs/environment-variabl…
prometek Sep 8, 2024
c49c4e7
📝 Update release notes
invalid-email-address Sep 8, 2024
a67167d
⬆ [pre-commit.ci] pre-commit autoupdate (#12176)
pre-commit-ci[bot] Sep 9, 2024
da4670c
📝 Update release notes
invalid-email-address Sep 9, 2024
fc601bc
⬆ Bump tiangolo/issue-manager from 0.5.0 to 0.5.1 (#12173)
dependabot[bot] Sep 10, 2024
bc715d5
📝 Update release notes
invalid-email-address Sep 10, 2024
80e2cd1
🌐 Add Portuguese translation for `docs/pt/docs/tutorial/debugging.md`…
marcelomarkus Sep 10, 2024
73d4f34
📝 Update release notes
invalid-email-address Sep 10, 2024
a4a7925
🌐 Add Portuguese translation for `docs/pt/docs/tutorial/testing.md` (…
marcelomarkus Sep 10, 2024
e69ba26
🌐 Add Portuguese translation for `docs/pt/docs/environment-variables.…
marcelomarkus Sep 10, 2024
944b6e5
🌐 Add Portuguese translation for `docs/pt/docs/virtual-environments.m…
marcelomarkus Sep 10, 2024
eb45bad
📝 Update release notes
invalid-email-address Sep 10, 2024
a4c5f7f
📝 Update release notes
invalid-email-address Sep 10, 2024
7445118
📝 Update release notes
invalid-email-address Sep 10, 2024
b0eedbb
⚡️ Improve performance in request body parsing with a cache for inter…
tiangolo Sep 11, 2024
8dc882f
📝 Update release notes
invalid-email-address Sep 11, 2024
212fd5e
🔖 Release version 0.114.1
tiangolo Sep 11, 2024
24b8f26
➕ Add inline-snapshot for tests (#12189)
tiangolo Sep 11, 2024
ba0bb62
📝 Update release notes
invalid-email-address Sep 11, 2024
c8e644d
🌐 Add Dutch translation for `docs/nl/docs/python-types.md` (#12158)
maxscheijen Sep 12, 2024
492943f
📝 Update release notes
invalid-email-address Sep 12, 2024
4a94fe3
🌐 Add Chinese translation for `docs/zh/docs/project-generation.md` (#…
waketzheng Sep 12, 2024
93e50e3
📝 Update release notes
invalid-email-address Sep 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ docs:
- all-globs-to-all-files:
- '!fastapi/**'
- '!pyproject.toml'
- '!docs/en/data/sponsors.yml'
- '!docs/en/overrides/main.html'

lang-all:
- all:
Expand All @@ -28,6 +30,8 @@ internal:
- .pre-commit-config.yaml
- pdm_build.py
- requirements*.txt
- docs/en/data/sponsors.yml
- docs/en/overrides/main.html
- all-globs-to-all-files:
- '!docs/*/docs/**'
- '!fastapi/**'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ jobs:
with:
name: docs-site-${{ matrix.lang }}
path: ./site/**
include-hidden-files: true

# https://github.com/marketplace/actions/alls-green#why
docs-all-green: # This job does nothing and is only used for the branch protection
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/issue-manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Issue Manager

on:
schedule:
- cron: "10 3 * * *"
- cron: "13 22 * * *"
issue_comment:
types:
- created
Expand All @@ -16,6 +16,7 @@ on:

permissions:
issues: write
pull-requests: write

jobs:
issue-manager:
Expand All @@ -26,7 +27,7 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: tiangolo/issue-manager@0.5.0
- uses: tiangolo/issue-manager@0.5.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
config: >
Expand All @@ -35,8 +36,8 @@ jobs:
"delay": 864000,
"message": "Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs."
},
"changes-requested": {
"waiting": {
"delay": 2628000,
"message": "As this PR had requested changes to be applied but has been inactive for a while, it's now going to be closed. But if there's anyone interested, feel free to create a new PR."
"message": "As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR."
}
}
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
run: python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.9.0
uses: pypa/gh-action-pypi-publish@v1.10.1
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: pip install -r requirements-tests.txt
- name: Install Pydantic v2
run: pip install "pydantic>=2.0.2,<3.0.0"
run: pip install --upgrade "pydantic>=2.0.2,<3.0.0"
- name: Lint
run: bash scripts/lint.sh

Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
run: pip install "pydantic>=1.10.0,<2.0.0"
- name: Install Pydantic v2
if: matrix.pydantic-version == 'pydantic-v2'
run: pip install "pydantic>=2.0.2,<3.0.0"
run: pip install --upgrade "pydantic>=2.0.2,<3.0.0"
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh
Expand All @@ -91,6 +91,7 @@ jobs:
with:
name: coverage-${{ matrix.python-version }}-${{ matrix.pydantic-version }}
path: coverage
include-hidden-files: true

coverage-combine:
needs: [test]
Expand Down Expand Up @@ -123,6 +124,7 @@ jobs:
with:
name: coverage-html
path: htmlcov
include-hidden-files: true

# https://github.com/marketplace/actions/alls-green#why
check: # This job does nothing and is only used for the branch protection
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
rev: v0.6.4
hooks:
- id: ruff
args:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The key features are:
<a href="https://bump.sh/fastapi?utm_source=fastapi&utm_medium=referral&utm_campaign=sponsor" target="_blank" title="Automate FastAPI documentation generation with Bump.sh"><img src="https://fastapi.tiangolo.com/img/sponsors/bump-sh.svg"></a>
<a href="https://github.com/scalar/scalar/?utm_source=fastapi&utm_medium=website&utm_campaign=main-badge" target="_blank" title="Scalar: Beautiful Open-Source API References from Swagger/OpenAPI files"><img src="https://fastapi.tiangolo.com/img/sponsors/scalar.svg"></a>
<a href="https://www.propelauth.com/?utm_source=fastapi&utm_campaign=1223&utm_medium=mainbadge" target="_blank" title="Auth, user management and more for your B2B product"><img src="https://fastapi.tiangolo.com/img/sponsors/propelauth.png"></a>
<a href="https://docs.withcoherence.com/coherence-templates/full-stack-template/#fastapi?utm_medium=advertising&utm_source=fastapi&utm_campaign=docs" target="_blank" title="Coherence"><img src="https://fastapi.tiangolo.com/img/sponsors/coherence.png"></a>
<a href="https://www.withcoherence.com/?utm_medium=advertising&utm_source=fastapi&utm_campaign=website" target="_blank" title="Coherence"><img src="https://fastapi.tiangolo.com/img/sponsors/coherence.png"></a>
<a href="https://www.mongodb.com/developer/languages/python/python-quickstart-fastapi/?utm_campaign=fastapi_framework&utm_source=fastapi_sponsorship&utm_medium=web_referral" target="_blank" title="Simplify Full Stack Development with FastAPI & MongoDB"><img src="https://fastapi.tiangolo.com/img/sponsors/mongodb.png"></a>
<a href="https://zuplo.link/fastapi-gh" target="_blank" title="Zuplo: Scale, Protect, Document, and Monetize your FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/zuplo.png"></a>
<a href="https://fine.dev?ref=fastapibadge" target="_blank" title="Fine's AI FastAPI Workflow: Effortlessly Deploy and Integrate FastAPI into Your Project"><img src="https://fastapi.tiangolo.com/img/sponsors/fine.png"></a>
Expand Down
8 changes: 8 additions & 0 deletions docs/en/data/external_links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ Articles:
author_link: https://devonray.com
link: https://devonray.com/blog/deploying-a-fastapi-project-using-aws-lambda-aurora-cdk
title: Deployment using Docker, Lambda, Aurora, CDK & GH Actions
- author: Shubhendra Kushwaha
author_link: https://www.linkedin.com/in/theshubhendra/
link: https://theshubhendra.medium.com/mastering-soft-delete-advanced-sqlalchemy-techniques-4678f4738947
title: 'Mastering Soft Delete: Advanced SQLAlchemy Techniques'
- author: Shubhendra Kushwaha
author_link: https://www.linkedin.com/in/theshubhendra/
link: https://theshubhendra.medium.com/role-based-row-filtering-advanced-sqlalchemy-techniques-733e6b1328f6
title: 'Role based row filtering: Advanced SQLAlchemy Techniques'
German:
- author: Marcel Sander (actidoo)
author_link: https://www.actidoo.com
Expand Down
2 changes: 1 addition & 1 deletion docs/en/data/sponsors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ gold:
- url: https://www.propelauth.com/?utm_source=fastapi&utm_campaign=1223&utm_medium=mainbadge
title: Auth, user management and more for your B2B product
img: https://fastapi.tiangolo.com/img/sponsors/propelauth.png
- url: https://docs.withcoherence.com/coherence-templates/full-stack-template/#fastapi?utm_medium=advertising&utm_source=fastapi&utm_campaign=docs
- url: https://www.withcoherence.com/?utm_medium=advertising&utm_source=fastapi&utm_campaign=website
title: Coherence
img: https://fastapi.tiangolo.com/img/sponsors/coherence.png
- url: https://www.mongodb.com/developer/languages/python/python-quickstart-fastapi/?utm_campaign=fastapi_framework&utm_source=fastapi_sponsorship&utm_medium=web_referral
Expand Down
2 changes: 1 addition & 1 deletion docs/en/docs/deployment/cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ You might want to try their services and follow their guides:

* <a href="https://docs.platform.sh/languages/python.html?utm_source=fastapi-signup&utm_medium=banner&utm_campaign=FastAPI-signup-June-2023" class="external-link" target="_blank">Platform.sh</a>
* <a href="https://docs.porter.run/language-specific-guides/fastapi" class="external-link" target="_blank">Porter</a>
* <a href="https://docs.withcoherence.com/coherence-templates/full-stack-template/#fastapi?utm_medium=advertising&utm_source=fastapi&utm_campaign=docs" class="external-link" target="_blank">Coherence</a>
* <a href="https://www.withcoherence.com/?utm_medium=advertising&utm_source=fastapi&utm_campaign=website" class="external-link" target="_blank">Coherence</a>
2 changes: 0 additions & 2 deletions docs/en/docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ This way, when you type `python` in the terminal, the system will find the Pytho

////

This way, when you type `python` in the terminal, the system will find the Python program in `/opt/custompython/bin` (the last directory) and use that one.

So, if you type:

<div class="termy">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
145 changes: 145 additions & 0 deletions docs/en/docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,143 @@ hide:

## Latest Changes

### Translations

* 🌐 Add Chinese translation for `docs/zh/docs/project-generation.md`. PR [#12170](https://github.com/fastapi/fastapi/pull/12170) by [@waketzheng](https://github.com/waketzheng).
* 🌐 Add Dutch translation for `docs/nl/docs/python-types.md`. PR [#12158](https://github.com/fastapi/fastapi/pull/12158) by [@maxscheijen](https://github.com/maxscheijen).

### Internal

* ➕ Add inline-snapshot for tests. PR [#12189](https://github.com/fastapi/fastapi/pull/12189) by [@tiangolo](https://github.com/tiangolo).

## 0.114.1

### Refactors

* ⚡️ Improve performance in request body parsing with a cache for internal model fields. PR [#12184](https://github.com/fastapi/fastapi/pull/12184) by [@tiangolo](https://github.com/tiangolo).

### Docs

* 📝 Remove duplicate line in docs for `docs/en/docs/environment-variables.md`. PR [#12169](https://github.com/fastapi/fastapi/pull/12169) by [@prometek](https://github.com/prometek).

### Translations

* 🌐 Add Portuguese translation for `docs/pt/docs/virtual-environments.md`. PR [#12163](https://github.com/fastapi/fastapi/pull/12163) by [@marcelomarkus](https://github.com/marcelomarkus).
* 🌐 Add Portuguese translation for `docs/pt/docs/environment-variables.md`. PR [#12162](https://github.com/fastapi/fastapi/pull/12162) by [@marcelomarkus](https://github.com/marcelomarkus).
* 🌐 Add Portuguese translation for `docs/pt/docs/tutorial/testing.md`. PR [#12164](https://github.com/fastapi/fastapi/pull/12164) by [@marcelomarkus](https://github.com/marcelomarkus).
* 🌐 Add Portuguese translation for `docs/pt/docs/tutorial/debugging.md`. PR [#12165](https://github.com/fastapi/fastapi/pull/12165) by [@marcelomarkus](https://github.com/marcelomarkus).
* 🌐 Add Korean translation for `docs/ko/docs/project-generation.md`. PR [#12157](https://github.com/fastapi/fastapi/pull/12157) by [@BORA040126](https://github.com/BORA040126).

### Internal

* ⬆ Bump tiangolo/issue-manager from 0.5.0 to 0.5.1. PR [#12173](https://github.com/fastapi/fastapi/pull/12173) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#12176](https://github.com/fastapi/fastapi/pull/12176) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* 👷 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

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"}`:

```python
from typing import Annotated

from fastapi import FastAPI, Form
from pydantic import BaseModel

app = FastAPI()


class FormData(BaseModel):
username: str
password: str
model_config = {"extra": "forbid"}


@app.post("/login/")
async def login(data: Annotated[FormData, Form()]):
return data
```

Read the new docs: [Form Models - Forbid Extra Form Fields](https://fastapi.tiangolo.com/tutorial/request-form-models/#forbid-extra-form-fields).

### Features

* ✨ Add support for forbidding extra form fields with Pydantic models. PR [#12134](https://github.com/fastapi/fastapi/pull/12134) by [@tiangolo](https://github.com/tiangolo).

### Docs

* 📝 Update docs, Form Models section title, to match config name. PR [#12152](https://github.com/fastapi/fastapi/pull/12152) by [@tiangolo](https://github.com/tiangolo).

### Internal

* ✅ 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

Now you can declare form fields with Pydantic models:

```python
from typing import Annotated

from fastapi import FastAPI, Form
from pydantic import BaseModel

app = FastAPI()


class FormData(BaseModel):
username: str
password: str


@app.post("/login/")
async def login(data: Annotated[FormData, Form()]):
return data
```

Read the new docs: [Form Models](https://fastapi.tiangolo.com/tutorial/request-form-models/).

### Features

* ✨ Add support for Pydantic models in `Form` parameters. PR [#12129](https://github.com/fastapi/fastapi/pull/12129) by [@tiangolo](https://github.com/tiangolo).

### Internal

* 🔧 Update sponsors: Coherence link. PR [#12130](https://github.com/fastapi/fastapi/pull/12130) by [@tiangolo](https://github.com/tiangolo).

## 0.112.4

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.

This release shouldn't affect apps using FastAPI in any way. You don't even have to upgrade to this version yet. It's just a checkpoint. 🤓

### Refactors

* ♻️ Refactor deciding if `embed` body fields, do not overwrite fields, compute once per router, refactor internals in preparation for Pydantic models in `Form`, `Query` and others. PR [#12117](https://github.com/fastapi/fastapi/pull/12117) by [@tiangolo](https://github.com/tiangolo).

### Internal

* ⏪️ 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

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. 🚀

### Refactors

* ♻️ Refactor internal `check_file_field()`, rename to `ensure_multipart_is_installed()` to clarify its purpose. PR [#12106](https://github.com/fastapi/fastapi/pull/12106) by [@tiangolo](https://github.com/tiangolo).
* ♻️ Rename internal `create_response_field()` to `create_model_field()` as it's used for more than response models. PR [#12103](https://github.com/fastapi/fastapi/pull/12103) by [@tiangolo](https://github.com/tiangolo).
* ♻️ Refactor and simplify internal data from `solve_dependencies()` using dataclasses. PR [#12100](https://github.com/fastapi/fastapi/pull/12100) by [@tiangolo](https://github.com/tiangolo).
* ♻️ Refactor and simplify internal `analyze_param()` to structure data with dataclasses instead of tuple. PR [#12099](https://github.com/fastapi/fastapi/pull/12099) by [@tiangolo](https://github.com/tiangolo).
* ♻️ Refactor and simplify dependencies data structures with dataclasses. PR [#12098](https://github.com/fastapi/fastapi/pull/12098) by [@tiangolo](https://github.com/tiangolo).

### Docs

* 📝 Add External Link: Techniques and applications of SQLAlchemy global filters in FastAPI. PR [#12109](https://github.com/fastapi/fastapi/pull/12109) by [@TheShubhendra](https://github.com/TheShubhendra).
* 📝 Add note about `time.perf_counter()` in middlewares. PR [#12095](https://github.com/fastapi/fastapi/pull/12095) by [@tiangolo](https://github.com/tiangolo).
* 📝 Tweak middleware code sample `time.time()` to `time.perf_counter()`. PR [#11957](https://github.com/fastapi/fastapi/pull/11957) by [@domdent](https://github.com/domdent).
* 🔧 Update sponsors: Coherence. PR [#12093](https://github.com/fastapi/fastapi/pull/12093) by [@tiangolo](https://github.com/tiangolo).
* 📝 Fix async test example not to trigger DeprecationWarning. PR [#12084](https://github.com/fastapi/fastapi/pull/12084) by [@marcinsulikowski](https://github.com/marcinsulikowski).
* 📝 Update `docs_src/path_params_numeric_validations/tutorial006.py`. PR [#11478](https://github.com/fastapi/fastapi/pull/11478) by [@MuhammadAshiqAmeer](https://github.com/MuhammadAshiqAmeer).
Expand All @@ -20,11 +155,21 @@ hide:

### Translations

* 🌐 Add Dutch translation for `docs/nl/docs/features.md`. PR [#12101](https://github.com/fastapi/fastapi/pull/12101) by [@maxscheijen](https://github.com/maxscheijen).
* 🌐 Add Portuguese translation for `docs/pt/docs/advanced/testing-events.md`. PR [#12108](https://github.com/fastapi/fastapi/pull/12108) by [@ceb10n](https://github.com/ceb10n).
* 🌐 Add Portuguese translation for `docs/pt/docs/advanced/security/index.md`. PR [#12114](https://github.com/fastapi/fastapi/pull/12114) by [@ceb10n](https://github.com/ceb10n).
* 🌐 Add Dutch translation for `docs/nl/docs/index.md`. PR [#12042](https://github.com/fastapi/fastapi/pull/12042) by [@svlandeg](https://github.com/svlandeg).
* 🌐 Update Chinese translation for `docs/zh/docs/how-to/index.md`. PR [#12070](https://github.com/fastapi/fastapi/pull/12070) by [@synthpop123](https://github.com/synthpop123).

### Internal

* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [#12115](https://github.com/fastapi/fastapi/pull/12115) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
* ⬆ Bump pypa/gh-action-pypi-publish from 1.10.0 to 1.10.1. PR [#12120](https://github.com/fastapi/fastapi/pull/12120) by [@dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump pillow from 10.3.0 to 10.4.0. PR [#12105](https://github.com/fastapi/fastapi/pull/12105) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 💚 Set `include-hidden-files` to `True` when using the `upload-artifact` GH action. PR [#12118](https://github.com/fastapi/fastapi/pull/12118) by [@svlandeg](https://github.com/svlandeg).
* ⬆ Bump pypa/gh-action-pypi-publish from 1.9.0 to 1.10.0. PR [#12112](https://github.com/fastapi/fastapi/pull/12112) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 🔧 Update sponsors link: Coherence. PR [#12097](https://github.com/fastapi/fastapi/pull/12097) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update labeler config to handle sponsorships data. PR [#12096](https://github.com/fastapi/fastapi/pull/12096) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update sponsors, remove Kong. PR [#12085](https://github.com/fastapi/fastapi/pull/12085) by [@tiangolo](https://github.com/tiangolo).
* ⬆ [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).
Expand Down
6 changes: 6 additions & 0 deletions docs/en/docs/tutorial/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ For example, you could add a custom header `X-Process-Time` containing the time
{!../../../docs_src/middleware/tutorial001.py!}
```

/// tip

Here we use <a href="https://docs.python.org/3/library/time.html#time.perf_counter" class="external-link" target="_blank">`time.perf_counter()`</a> instead of `time.time()` because it can be more precise for these use cases. 🤓

///

## Other middlewares

You can later read more about other middlewares in the [Advanced User Guide: Advanced Middleware](../advanced/middleware.md){.internal-link target=_blank}.
Expand Down
Loading
Loading