Update dependency fastapi to v0.110.0 - autoclosed
This MR contains the following updates:
Package | Type | Update | Change |
---|---|---|---|
fastapi | dependencies | minor |
0.104.1 -> 0.110.0
|
Release Notes
tiangolo/fastapi (fastapi)
v0.110.0
Breaking Changes
-
🐛 Fix unhandled growing memory for internal server errors, refactor dependencies withyield
andexcept
to require raising again as in regular Python. MR #11191 by @tiangolo.- This is a breaking change (and only slightly) if you used dependencies with
yield
, usedexcept
in those dependencies, and didn't raise again. - This was reported internally by @rushilsrivastava as a memory leak when the server had unhandled exceptions that would produce internal server errors, the memory allocated before that point would not be released.
- Read the new docs: Dependencies with
yield
andexcept
.
- This is a breaking change (and only slightly) if you used dependencies with
In short, if you had dependencies that looked like:
def my_dep():
try:
yield
except SomeException:
pass
Now you need to make sure you raise again after except
, just as you would in regular Python:
def my_dep():
try:
yield
except SomeException:
raise
Docs
-
✏ ️ Fix minor typos indocs/ko/docs/
. MR #11126 by @KaniKim. -
✏ ️ Fix minor typo infastapi/applications.py
. MR #11099 by @JacobHayes.
Translations
-
🌐 Add German translation fordocs/de/docs/reference/background.md
. MR #10820 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/reference/templating.md
. MR #10842 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/external-links.md
. MR #10852 by @nilslindemann. -
🌐 Update Turkish translation fordocs/tr/docs/tutorial/query-params.md
. MR #11162 by @hasansezertasan. -
🌐 Add German translation fordocs/de/docs/reference/encoders.md
. MR #10840 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/reference/responses.md
. MR #10825 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/reference/request.md
. MR #10821 by @nilslindemann. -
🌐 Add Turkish translation fordocs/tr/docs/tutorial/query-params.md
. MR #11078 by @emrhnsyts. -
🌐 Add German translation fordocs/de/docs/reference/fastapi.md
. MR #10813 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/newsletter.md
. MR #10853 by @nilslindemann. -
🌐 Add Traditional Chinese translation fordocs/zh-hant/docs/learn/index.md
. MR #11142 by @hsuanchi. -
🌐 Add Korean translation for/docs/ko/docs/tutorial/dependencies/global-dependencies.md
. MR #11123 by @riroan. -
🌐 Add Korean translation for/docs/ko/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
. MR #11124 by @riroan. -
🌐 Add Korean translation for/docs/ko/docs/tutorial/schema-extra-example.md
. MR #11121 by @KaniKim. -
🌐 Add Korean translation for/docs/ko/docs/tutorial/body-fields.md
. MR #11112 by @KaniKim. -
🌐 Add Korean translation for/docs/ko/docs/tutorial/cookie-params.md
. MR #11118 by @riroan. -
🌐 Update Korean translation for/docs/ko/docs/dependencies/index.md
. MR #11114 by @KaniKim. -
🌐 Update Korean translation for/docs/ko/docs/deployment/docker.md
. MR #11113 by @KaniKim. -
🌐 Update Turkish translation fordocs/tr/docs/tutorial/first-steps.md
. MR #11094 by @hasansezertasan. -
🌐 Add Spanish translation fordocs/es/docs/advanced/security/index.md
. MR #2278 by @Xaraxx. -
🌐 Add Spanish translation fordocs/es/docs/advanced/response-headers.md
. MR #2276 by @Xaraxx. -
🌐 Add Spanish translation fordocs/es/docs/deployment/index.md
and~/deployment/versions.md
. MR #9669 by @pabloperezmoya. -
🌐 Add Spanish translation fordocs/es/docs/benchmarks.md
. MR #10928 by @pablocm83. -
🌐 Add Spanish translation fordocs/es/docs/advanced/response-change-status-code.md
. MR #11100 by @alejsdev.
v0.109.2
Upgrades
-
⬆ ️ Upgrade version of Starlette to>= 0.36.3
. MR #11086 by @tiangolo.
Translations
-
🌐 Update Turkish translation fordocs/tr/docs/fastapi-people.md
. MR #10547 by @alperiox.
Internal
-
🍱 Add new FastAPI logo. MR #11090 by @tiangolo.
v0.109.1
Security fixes
-
⬆ ️ Upgrade minimum version ofpython-multipart
to>=0.0.7
to fix a vulnerability when using form data with a ReDos attack. You can also simply upgradepython-multipart
.
Read more in the advisory: Content-Type Header ReDoS.
Features
-
✨ Include HTTP 205 in status codes with no body. MR #10969 by @tiangolo.
Refactors
-
✅ Refactor tests for duplicate operation ID generation for compatibility with other tools running the FastAPI test suite. MR #10876 by @emmettbutler. -
♻ ️ Simplify string format with f-strings infastapi/utils.py
. MR #10576 by @eukub. -
🔧 Fix Ruff configuration unintentionally enabling and re-disabling mccabe complexity check. MR #10893 by @jiridanek. -
✅ Re-enable test intests/test_tutorial/test_header_params/test_tutorial003.py
after fix in Starlette. MR #10904 by @ooknimm.
Docs
-
📝 Tweak wording inhelp-fastapi.md
. MR #11040 by @tiangolo. -
📝 Tweak docs for Behind a Proxy. MR #11038 by @tiangolo. -
📝 Add External Link: 10 Tips for adding SQLAlchemy to FastAPI. MR #11036 by @Donnype. -
📝 Add External Link: Tips on migrating from Flask to FastAPI and vice-versa. MR #11029 by @jtemporal. -
📝 Deprecate old tutorials: Peewee, Couchbase, encode/databases. MR #10979 by @tiangolo. -
✏ ️ Fix typo infastapi/security/oauth2.py
. MR #10972 by @RafalSkolasinski. -
📝 UpdateHTTPException
details indocs/en/docs/tutorial/handling-errors.md
. MR #5418 by @papb. -
✏ ️ A few tweaks indocs/de/docs/tutorial/first-steps.md
. MR #10959 by @nilslindemann. -
✏ ️ Fix link indocs/en/docs/advanced/async-tests.md
. MR #10960 by @nilslindemann. -
✏ ️ Fix typos for Spanish documentation. MR #10957 by @jlopezlira. -
📝 Add warning about lifespan functions and backwards compatibility with events. MR #10734 by @jacob-indigo. -
✏ ️ Fix broken link indocs/tutorial/sql-databases.md
in several languages. MR #10716 by @theoohoho. -
✏ ️ Remove broken links fromexternal_links.yml
. MR #10943 by @Torabek. -
📝 Update template docs with more info abouturl_for
. MR #5937 by @EzzEddin. -
📝 Update usage of Token model in security docs. MR #9313 by @piotrszacilowski. -
✏ ️ Update highlighted line indocs/en/docs/tutorial/bigger-applications.md
. MR #5490 by @papb. -
📝 Add External Link: Explore How to Effectively Use JWT With FastAPI. MR #10212 by @aanchlia. -
📝 Add hyperlink todocs/en/docs/tutorial/static-files.md
. MR #10243 by @hungtsetse. -
📝 Add External Link: Instrument a FastAPI service adding tracing with OpenTelemetry and send/show traces in Grafana Tempo. MR #9440 by @softwarebloat. -
📝 Review and rewording ofen/docs/contributing.md
. MR #10480 by @nilslindemann. -
📝 Add External Link: ML serving and monitoring with FastAPI and Evidently. MR #9701 by @mnrozhkov. -
📝 Reword in docs, from "have in mind" to "keep in mind". MR #10376 by @malicious. -
📝 Add External Link: Talk by Jeny Sadadia. MR #10265 by @JenySadadia. -
📝 Add location info totutorial/bigger-applications.md
. MR #10552 by @nilslindemann. -
✏ ️ Fix Pydantic method name indocs/en/docs/advanced/path-operation-advanced-configuration.md
. MR #10826 by @ahmedabdou14.
Translations
-
🌐 Add Spanish translation fordocs/es/docs/external-links.md
. MR #10933 by @pablocm83. -
🌐 Update Korean translation fordocs/ko/docs/tutorial/first-steps.md
,docs/ko/docs/tutorial/index.md
,docs/ko/docs/tutorial/path-params.md
, anddocs/ko/docs/tutorial/query-params.md
. MR #4218 by @SnowSuno. -
🌐 Add Chinese translation fordocs/zh/docs/tutorial/dependencies/dependencies-with-yield.md
. MR #10870 by @zhiquanchi. -
🌐 Add Chinese translation fordocs/zh/docs/deployment/concepts.md
. MR #10282 by @xzmeng. -
🌐 Add Azerbaijani translation fordocs/az/docs/index.md
. MR #11047 by @aykhans. -
🌐 Add Korean translation fordocs/ko/docs/tutorial/middleware.md
. MR #2829 by @JeongHyeongKim. -
🌐 Add German translation fordocs/de/docs/tutorial/body-nested-models.md
. MR #10313 by @nilslindemann. -
🌐 Add Persian translation fordocs/fa/docs/tutorial/middleware.md
. MR #9695 by @mojtabapaso. -
🌐 Update Farsi translation fordocs/fa/docs/index.md
. MR #10216 by @theonlykingpin. -
🌐 Add German translation fordocs/de/docs/tutorial/body-fields.md
. MR #10310 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/tutorial/body.md
. MR #10295 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/tutorial/body-multiple-params.md
. MR #10308 by @nilslindemann. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/security/get-current-user.md
. MR #2681 by @sh0nk. -
🌐 Add Chinese translation fordocs/zh/docs/advanced/advanced-dependencies.md
. MR #3798 by @jaystone776. -
🌐 Add Chinese translation fordocs/zh/docs/advanced/events.md
. MR #3815 by @jaystone776. -
🌐 Add Chinese translation fordocs/zh/docs/advanced/behind-a-proxy.md
. MR #3820 by @jaystone776. -
🌐 Add Chinese translation fordocs/zh/docs/advanced/testing-events.md
. MR #3818 by @jaystone776. -
🌐 Add Chinese translation fordocs/zh/docs/advanced/testing-websockets.md
. MR #3817 by @jaystone776. -
🌐 Add Chinese translation fordocs/zh/docs/advanced/testing-database.md
. MR #3821 by @jaystone776. -
🌐 Add Chinese translation fordocs/zh/docs/deployment/deta.md
. MR #3837 by @jaystone776. -
🌐 Add Chinese translation fordocs/zh/docs/history-design-future.md
. MR #3832 by @jaystone776. -
🌐 Add Chinese translation fordocs/zh/docs/project-generation.md
. MR #3831 by @jaystone776. -
🌐 Add Chinese translation fordocs/zh/docs/deployment/docker.md
. MR #10296 by @xzmeng. -
🌐 Update Spanish translation fordocs/es/docs/features.md
. MR #10884 by @pablocm83. -
🌐 Add Spanish translation fordocs/es/docs/newsletter.md
. MR #10922 by @pablocm83. -
🌐 Add Korean translation fordocs/ko/docs/tutorial/background-tasks.md
. MR #5910 by @junah201. -
🌐 Add Turkish translation fordocs/tr/docs/alternatives.md
. MR #10502 by @alperiox. -
🌐 Add Korean translation fordocs/ko/docs/tutorial/dependencies/index.md
. MR #10989 by @KaniKim. -
🌐 Add Korean translation for/docs/ko/docs/tutorial/body.md
. MR #11000 by @KaniKim. -
🌐 Add Portuguese translation fordocs/pt/docs/tutorial/schema-extra-example.md
. MR #4065 by @luccasmmg. -
🌐 Add Turkish translation fordocs/tr/docs/history-design-future.md
. MR #11012 by @hasansezertasan. -
🌐 Add Turkish translation fordocs/tr/docs/resources/index.md
. MR #11020 by @hasansezertasan. -
🌐 Add Turkish translation fordocs/tr/docs/how-to/index.md
. MR #11021 by @hasansezertasan. -
🌐 Add German translation fordocs/de/docs/tutorial/query-params.md
. MR #10293 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/benchmarks.md
. MR #10866 by @nilslindemann. -
🌐 Add Turkish translation fordocs/tr/docs/learn/index.md
. MR #11014 by @hasansezertasan. -
🌐 Add Persian translation fordocs/fa/docs/tutorial/security/index.md
. MR #9945 by @mojtabapaso. -
🌐 Add Turkish translation fordocs/tr/docs/help/index.md
. MR #11013 by @hasansezertasan. -
🌐 Add Turkish translation fordocs/tr/docs/about/index.md
. MR #11006 by @hasansezertasan. -
🌐 Update Turkish translation fordocs/tr/docs/benchmarks.md
. MR #11005 by @hasansezertasan. -
🌐 Add Italian translation fordocs/it/docs/index.md
. MR #5233 by @matteospanio. -
🌐 Add Korean translation fordocs/ko/docs/help/index.md
. MR #10983 by @KaniKim. -
🌐 Add Korean translation fordocs/ko/docs/features.md
. MR #10976 by @KaniKim. -
🌐 Add Korean translation fordocs/ko/docs/tutorial/security/get-current-user.md
. MR #5737 by @KdHyeon0661. -
🌐 Add Russian translation fordocs/ru/docs/tutorial/security/first-steps.md
. MR #10541 by @AlertRED. -
🌐 Add Russian translation fordocs/ru/docs/tutorial/handling-errors.md
. MR #10375 by @AlertRED. -
🌐 Add Russian translation fordocs/ru/docs/tutorial/encoder.md
. MR #10374 by @AlertRED. -
🌐 Add Russian translation fordocs/ru/docs/tutorial/body-updates.md
. MR #10373 by @AlertRED. -
🌐 Russian translation: updatedfastapi-people.md
.. MR #10255 by @NiKuma0. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/security/index.md
. MR #5798 by @3w36zj6. -
🌐 Add German translation fordocs/de/docs/advanced/generate-clients.md
. MR #10725 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/advanced/openapi-webhooks.md
. MR #10712 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/advanced/custom-response.md
. MR #10624 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/advanced/additional-status-codes.md
. MR #10617 by @nilslindemann. -
🌐 Add German translation fordocs/de/docs/tutorial/middleware.md
. MR #10391 by @JohannesJungbluth. -
🌐 Add German translation for introduction documents. MR #10497 by @nilslindemann. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/encoder.md
. MR #1955 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/extra-data-types.md
. MR #1932 by @SwftAlpc. -
🌐 Add Turkish translation fordocs/tr/docs/async.md
. MR #5191 by @BilalAlpaslan. -
🌐 Add Turkish translation fordocs/tr/docs/project-generation.md
. MR #5192 by @BilalAlpaslan. -
🌐 Add Korean translation fordocs/ko/docs/deployment/docker.md
. MR #5657 by @nearnear. -
🌐 Add Korean translation fordocs/ko/docs/deployment/server-workers.md
. MR #4935 by @jujumilk3. -
🌐 Add Korean translation fordocs/ko/docs/deployment/index.md
. MR #4561 by @jujumilk3. -
🌐 Add Korean translation fordocs/ko/docs/tutorial/path-operation-configuration.md
. MR #3639 by @jungsu-kwon. -
🌐 Modify the description ofzh
- Traditional Chinese. MR #10889 by @cherinyy. -
🌐 Add Korean translation fordocs/ko/docs/tutorial/static-files.md
. MR #2957 by @jeesang7. -
🌐 Add Korean translation fordocs/ko/docs/tutorial/response-model.md
. MR #2766 by @hard-coders. -
🌐 Add Korean translation fordocs/ko/docs/tutorial/body-multiple-params.md
. MR #2461 by @PandaHun. -
🌐 Add Korean translation fordocs/ko/docs/tutorial/query-params-str-validations.md
. MR #2415 by @hard-coders. -
🌐 Add Korean translation fordocs/ko/docs/python-types.md
. MR #2267 by @jrim. -
🌐 Add Korean translation fordocs/ko/docs/tutorial/body-nested-models.md
. MR #2506 by @hard-coders. -
🌐 Add Korean translation fordocs/ko/docs/learn/index.md
. MR #10977 by @KaniKim. -
🌐 Initialize translations for Traditional Chinese. MR #10505 by @hsuanchi. -
✏ ️ Tweak the german translation ofdocs/de/docs/tutorial/index.md
. MR #10962 by @nilslindemann. -
✏ ️ Fix typo error indocs/ko/docs/tutorial/path-params.md
. MR #10758 by @2chanhaeng. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/dependencies/dependencies-with-yield.md
. MR #1961 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
. MR #1960 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/dependencies/sub-dependencies.md
. MR #1959 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/background-tasks.md
. MR #2668 by @tokusumi. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/dependencies/index.md
anddocs/ja/docs/tutorial/dependencies/classes-as-dependencies.md
. MR #1958 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/response-model.md
. MR #1938 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/body-multiple-params.md
. MR #1903 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/path-params-numeric-validations.md
. MR #1902 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/python-types.md
. MR #1899 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/handling-errors.md
. MR #1953 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/response-status-code.md
. MR #1942 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/extra-models.md
. MR #1941 by @SwftAlpc. -
🌐 Add Japanese tranlsation fordocs/ja/docs/tutorial/schema-extra-example.md
. MR #1931 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/body-nested-models.md
. MR #1930 by @SwftAlpc. -
🌐 Add Japanese translation fordocs/ja/docs/tutorial/body-fields.md
. MR #1923 by @SwftAlpc. -
🌐 Add German translation fordocs/de/docs/tutorial/index.md
. MR #9502 by @fhabers21. -
🌐 Add German translation fordocs/de/docs/tutorial/background-tasks.md
. MR #10566 by @nilslindemann. -
✏ ️ Fix typo indocs/ru/docs/index.md
. MR #10672 by @Delitel-WEB. -
✏ ️ Fix typos indocs/zh/docs/tutorial/extra-data-types.md
. MR #10727 by @HiemalBeryl. -
🌐 Add Russian translation fordocs/ru/docs/tutorial/dependencies/classes-as-dependencies.md
. MR #10410 by @AlertRED.
Internal
-
👥 Update FastAPI People. MR #11074 by @tiangolo. -
🔧 Update sponsors: add Coherence. MR #11066 by @tiangolo. -
👷 Upgrade GitHub Action issue-manager. MR #11056 by @tiangolo. -
🍱 Update sponsors: TalkPython badge. MR #11052 by @tiangolo. -
🔧 Update sponsors: TalkPython badge image. MR #11048 by @tiangolo. -
🔧 Update sponsors, remove Deta. MR #11041 by @tiangolo. -
💄 Fix CSS breaking RTL languages (erroneously introduced by a previous RTL MR). MR #11039 by @tiangolo. -
🔧 Add Italian tomkdocs.yml
. MR #11016 by @alejsdev. -
🔨 Verifymkdocs.yml
languages in CI, updatedocs.py
. MR #11009 by @tiangolo. -
🔧 Update config inlabel-approved.yml
to accept translations with 1 reviewer. MR #11007 by @alejsdev. -
👷 Add changes-requested handling in GitHub Action issue manager. MR #10971 by @tiangolo. -
🔧 Group dependencies on dependabot updates. MR #10952 by @Kludex. -
⬆ Bump actions/setup-python from 4 to 5. MR #10764 by @dependabot[bot]. -
⬆ Bump pypa/gh-action-pypi-publish from 1.8.10 to 1.8.11. MR #10731 by @dependabot[bot]. -
⬆ Bump dawidd6/action-download-artifact from 2.28.0 to 3.0.0. MR #10777 by @dependabot[bot]. -
🔧 Add support for translations to languages with a longer code name, likezh-hant
. MR #10950 by @tiangolo.
v0.109.0
Features
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. MR #10846 by @tiangolo.
Docs
-
✏ ️ Fix typo indocs/en/docs/alternatives.md
. MR #10931 by @s111d. -
📝 Replaceemail
withusername
indocs_src/security/tutorial007
code examples. MR #10649 by @nilslindemann. -
📝 Add VS Code tutorial link. MR #10592 by @nilslindemann. -
📝 Add notes about Pydantic v2's new.model_dump()
. MR #10929 by @tiangolo. -
📝 Fix broken link indocs/en/docs/tutorial/sql-databases.md
. MR #10765 by @HurSungYun. -
📝 Add External Link: FastAPI application monitoring made easy. MR #10917 by @tiangolo. -
✨ Generate automatic language names for docs translations. MR #5354 by @jakul. -
✏ ️ Fix typos indocs/en/docs/alternatives.md
anddocs/en/docs/tutorial/dependencies/index.md
. MR #10906 by @s111d. -
✏ ️ Fix typos indocs/en/docs/tutorial/dependencies/dependencies-with-yield.md
. MR #10834 by @Molkree. -
📝 Add article: "Building a RESTful API with FastAPI: Secure Signup and Login Functionality Included". MR #9733 by @dxphilo. -
📝 Add warning about lifecycle events withAsyncClient
. MR #4167 by @andrew-chang-dewitt. -
✏ ️ Fix typos in/docs/reference/exceptions.md
and/en/docs/reference/status.md
. MR #10809 by @clarencepenz. -
✏ ️ Fix typo inopenapi-callbacks.md
. MR #10673 by @kayjan. -
✏ ️ Fix typo infastapi/routing.py
. MR #10520 by @sepsh. -
📝 Replace HTTP code returned in case of existing user error in docs for testing. MR #4482 by @TristanMarion. -
📝 Add blog for FastAPI & Supabase. MR #6018 by @theinfosecguy. -
📝 Update example source files for SQL databases with SQLAlchemy. MR #9508 by @s-mustafa. -
📝 Update code examples in docs for body, replace namecreate_item
withupdate_item
when appropriate. MR #5913 by @OttoAndrey. -
✏ ️ Fix typo in dependencies with yield source examples. MR #10847 by @tiangolo.
Translations
-
🌐 Add Bengali translation fordocs/bn/docs/index.md
. MR #9177 by @Fahad-Md-Kamal. -
✏ ️ Update Python version inindex.md
in several languages. MR #10711 by @tamago3keran. -
🌐 Add Russian translation fordocs/ru/docs/tutorial/request-forms-and-files.md
. MR #10347 by @AlertRED. -
🌐 Add Ukrainian translation fordocs/uk/docs/index.md
. MR #10362 by @rostik1410. -
✏ ️ Update Python version indocs/ko/docs/index.md
. MR #10680 by @Eeap. -
🌐 Add Persian translation fordocs/fa/docs/features.md
. MR #5887 by @amirilf. -
🌐 Add Chinese translation fordocs/zh/docs/advanced/additional-responses.md
. MR #10325 by @ShuibeiC. -
🌐 Fix typos in Russian translations fordocs/ru/docs/tutorial/background-tasks.md
,docs/ru/docs/tutorial/body-nested-models.md
,docs/ru/docs/tutorial/debugging.md
,docs/ru/docs/tutorial/testing.md
. MR #10311 by @AlertRED. -
🌐 Add Russian translation fordocs/ru/docs/tutorial/request-files.md
. MR #10332 by @AlertRED. -
🌐 Add Chinese translation fordocs/zh/docs/deployment/server-workers.md
. MR #10292 by @xzmeng. -
🌐 Add Chinese translation fordocs/zh/docs/deployment/cloud.md
. MR #10291 by @xzmeng. -
🌐 Add Chinese translation fordocs/zh/docs/deployment/manually.md
. MR #10279 by @xzmeng. -
🌐 Add Chinese translation fordocs/zh/docs/deployment/https.md
. MR #10277 by @xzmeng. -
🌐 Add Chinese translation fordocs/zh/docs/deployment/index.md
. MR #10275 by @xzmeng. -
🌐 Add German translation fordocs/de/docs/tutorial/first-steps.md
. MR #9530 by @fhabers21. -
🌐 Update Turkish translation fordocs/tr/docs/index.md
. MR #10444 by @hasansezertasan. -
🌐 Add Chinese translation fordocs/zh/docs/learn/index.md
. MR #10479 by @KAZAMA-DREAM. -
🌐 Add Russian translation fordocs/ru/docs/learn/index.md
. MR #10539 by @AlertRED. -
🌐 Update SQLAlchemy instruction in Chinese translationdocs/zh/docs/tutorial/sql-databases.md
. MR #9712 by @Royc30ne. -
🌐 Add Turkish translation fordocs/tr/docs/external-links.md
. MR #10549 by @hasansezertasan. -
🌐 Add Spanish translation fordocs/es/docs/learn/index.md
. MR #10885 by @pablocm83. -
🌐 Add Ukrainian translation fordocs/uk/docs/tutorial/body-fields.md
. MR #10670 by @ArtemKhymenko. -
🌐 Add Hungarian translation for/docs/hu/docs/index.md
. MR #10812 by @takacs. -
🌐 Add Turkish translation fordocs/tr/docs/newsletter.md
. MR #10550 by @hasansezertasan. -
🌐 Add Spanish translation fordocs/es/docs/help/index.md
. MR #10907 by @pablocm83. -
🌐 Add Spanish translation fordocs/es/docs/about/index.md
. MR #10908 by @pablocm83. -
🌐 Add Spanish translation fordocs/es/docs/resources/index.md
. MR #10909 by @pablocm83.
Internal
-
👥 Update FastAPI People. MR #10871 by @tiangolo. -
👷 Upgrade custom GitHub Action comment-docs-preview-in-pr. MR #10916 by @tiangolo. -
⬆ ️ Upgrade GitHub Action latest-changes. MR #10915 by @tiangolo. -
👷 Upgrade GitHub Action label-approved. MR #10913 by @tiangolo. -
⬆ ️ Upgrade GitHub Action label-approved. MR #10905 by @tiangolo.
v0.108.0
Upgrades
-
⬆ ️ Upgrade Starlette to>=0.29.0,<0.33.0
, update docs and usage of templates with new Starlette arguments. MR #10846 by @tiangolo.
v0.107.0
Upgrades
-
⬆ ️ Upgrade Starlette to 0.28.0. MR #9636 by @adriangb.
Docs
-
📝 Add docs: Node.js script alternative to update OpenAPI for generated clients. MR #10845 by @alejsdev. -
📝 Restructure Docs section in Contributing page. MR #10844 by @alejsdev.
v0.106.0
Breaking Changes
Using resources from dependencies with yield
in background tasks is no longer supported.
This change is what supports the new features, read below.
yield
, HTTPException
and Background Tasks
Dependencies with Dependencies with yield
now can raise HTTPException
and other exceptions after yield
.
Read the new docs here: Dependencies with yield
and HTTPException
.
from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated
app = FastAPI()
data = {
"plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
"portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
}
class OwnerError(Exception):
pass
def get_username():
try:
yield "Rick"
except OwnerError as e:
raise HTTPException(status_code=400, detail=f"Onwer error: {e}")
@​app.get("/items/{item_id}")
def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
if item_id not in data:
raise HTTPException(status_code=404, detail="Item not found")
item = data[item_id]
if item["owner"] != username:
raise OwnerError(username)
return item
Before FastAPI 0.106.0, raising exceptions after yield
was not possible, the exit code in dependencies with yield
was executed after the response was sent, so Exception Handlers would have already run.
This was designed this way mainly to allow using the same objects "yielded" by dependencies inside of background tasks, because the exit code would be executed after the background tasks were finished.
Nevertheless, as this would mean waiting for the response to travel through the network while unnecessarily holding a resource in a dependency with yield (for example a database connection), this was changed in FastAPI 0.106.0.
Additionally, a background task is normally an independent set of logic that should be handled separately, with its own resources (e.g. its own database connection).
If you used to rely on this behavior, now you should create the resources for background tasks inside the background task itself, and use internally only data that doesn't depend on the resources of dependencies with yield
.
For example, instead of using the same database session, you would create a new database session inside of the background task, and you would obtain the objects from the database using this new session. And then instead of passing the object from the database as a parameter to the background task function, you would pass the ID of that object and then obtain the object again inside the background task function.
The sequence of execution before FastAPI 0.106.0 was like the diagram in the Release Notes for FastAPI 0.106.0.
The new execution flow can be found in the docs: Execution of dependencies with yield
.
v0.105.0
Features
-
✨ Add support for multiple Annotated annotations, e.g.Annotated[str, Field(), Query()]
. MR #10773 by @tiangolo.
Refactors
-
🔥 Remove unused NoneType. MR #10774 by @tiangolo.
Docs
-
📝 Tweak default suggested configs for generating clients. MR #10736 by @tiangolo.
Internal
-
🔧 Update sponsors, add Scalar. MR #10728 by @tiangolo. -
🔧 Update sponsors, add PropelAuth. MR #10760 by @tiangolo. -
👷 Update build docs, verify README on CI. MR #10750 by @tiangolo. -
🔧 Update sponsors, remove Fern. MR #10729 by @tiangolo. -
🔧 Update sponsors, add Codacy. MR #10677 by @tiangolo. -
🔧 Update sponsors, add Reflex. MR #10676 by @tiangolo. -
📝 Update release notes, move and check latest-changes. MR #10588 by @tiangolo. -
👷 Upgrade latest-changes GitHub Action. MR #10587 by @tiangolo.
Configuration
-
If you want to rebase/retry this MR, check this box
This MR has been generated by Renovate Bot.