Browse Source

Merge remote-tracking branch 'upstream/master' into fix-body-fields-aliases

pull/14293/head
Yurii Motov 9 months ago
parent
commit
6df608d031
  1. 2
      .pre-commit-config.yaml
  2. 12
      docs/en/docs/advanced/advanced-dependencies.md
  3. 9
      docs/en/docs/release-notes.md
  4. 2
      requirements-docs-tests.txt

2
.pre-commit-config.yaml

@ -14,7 +14,7 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.2 rev: v0.14.3
hooks: hooks:
- id: ruff - id: ruff
args: args:

12
docs/en/docs/advanced/advanced-dependencies.md

@ -70,12 +70,22 @@ If you understood all this, you already know how those utility tools for securit
You most probably don't need these technical details. You most probably don't need these technical details.
These details are useful mainly if you had a FastAPI application older than 0.118.0 and you are facing issues with dependencies with `yield`. These details are useful mainly if you had a FastAPI application older than 0.121.0 and you are facing issues with dependencies with `yield`.
/// ///
Dependencies with `yield` have evolved over time to account for the different use cases and to fix some issues, here's a summary of what has changed. Dependencies with `yield` have evolved over time to account for the different use cases and to fix some issues, here's a summary of what has changed.
### Dependencies with `yield` and `scope` { #dependencies-with-yield-and-scope }
In version 0.121.0, FastAPI added support for `Depends(scope="function")` for dependencies with `yield`.
Using `Depends(scope="function")`, the exit code after `yield` is executed right after the *path operation function* is finished, before the response is sent back to the client.
And when using `Depends(scope="request")` (the default), the exit code after `yield` is executed after the response is sent.
You can read more about it in the docs for [Dependencies with `yield` - Early exit and `scope`](../tutorial/dependencies/dependencies-with-yield.md#early-exit-and-scope).
### Dependencies with `yield` and `StreamingResponse`, Technical Details { #dependencies-with-yield-and-streamingresponse-technical-details } ### Dependencies with `yield` and `StreamingResponse`, Technical Details { #dependencies-with-yield-and-streamingresponse-technical-details }
Before FastAPI 0.118.0, if you used a dependency with `yield`, it would run the exit code after the *path operation function* returned but right before sending the response. Before FastAPI 0.118.0, if you used a dependency with `yield`, it would run the exit code after the *path operation function* returned but right before sending the response.

9
docs/en/docs/release-notes.md

@ -7,6 +7,15 @@ hide:
## Latest Changes ## Latest Changes
### Docs
* 📝 Upate docs for advanced dependencies with `yield`, noting the changes in 0.121.0, adding `scope`. PR [#14287](https://github.com/fastapi/fastapi/pull/14287) by [@tiangolo](https://github.com/tiangolo).
### Internal
* ⬆ 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
### Features ### Features

2
requirements-docs-tests.txt

@ -1,4 +1,4 @@
# For mkdocstrings and tests # For mkdocstrings and tests
httpx >=0.23.0,<1.0.0 httpx >=0.23.0,<1.0.0
# For linting and generating docs versions # For linting and generating docs versions
ruff ==0.13.2 ruff ==0.14.3

Loading…
Cancel
Save