Update dependency fastapi to v0.109.2 #3
1 Participants
Due Date
Notifications
Total Time Spent: 4 seconds
marco
4 seconds
No due date set.
Dependencies
No dependencies set.
Reference: training/docker-build-exercise#3
Reference in New Issue
Block a user
Delete Branch "renovate/fastapi-0.x"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
==0.68.2->==0.109.2Release Notes
tiangolo/fastapi (fastapi)
v0.109.2Compare Source
Upgrades
>= 0.36.3. PR #11086 by @tiangolo.Translations
docs/tr/docs/fastapi-people.md. PR #10547 by @alperiox.Internal
v0.109.1Compare Source
Security fixes
python-multipartto>=0.0.7to 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
Refactors
fastapi/utils.py. PR #10576 by @eukub.tests/test_tutorial/test_header_params/test_tutorial003.pyafter fix in Starlette. PR #10904 by @ooknimm.Docs
help-fastapi.md. PR #11040 by @tiangolo.fastapi/security/oauth2.py. PR #10972 by @RafalSkolasinski.HTTPExceptiondetails indocs/en/docs/tutorial/handling-errors.md. PR #5418 by @papb.docs/de/docs/tutorial/first-steps.md. PR #10959 by @nilslindemann.docs/en/docs/advanced/async-tests.md. PR #10960 by @nilslindemann.docs/tutorial/sql-databases.mdin several languages. PR #10716 by @theoohoho.external_links.yml. PR #10943 by @Torabek.url_for. PR #5937 by @EzzEddin.docs/en/docs/tutorial/bigger-applications.md. PR #5490 by @papb.docs/en/docs/tutorial/static-files.md. PR #10243 by @hungtsetse.en/docs/contributing.md. PR #10480 by @nilslindemann.tutorial/bigger-applications.md. PR #10552 by @nilslindemann.docs/en/docs/advanced/path-operation-advanced-configuration.md. PR #10826 by @ahmedabdou14.Translations
docs/es/docs/external-links.md. PR #10933 by @pablocm83.docs/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. PR #4218 by @SnowSuno.docs/zh/docs/tutorial/dependencies/dependencies-with-yield.md. PR #10870 by @zhiquanchi.docs/zh/docs/deployment/concepts.md. PR #10282 by @xzmeng.docs/az/docs/index.md. PR #11047 by @aykhans.docs/ko/docs/tutorial/middleware.md. PR #2829 by @JeongHyeongKim.docs/de/docs/tutorial/body-nested-models.md. PR #10313 by @nilslindemann.docs/fa/docs/tutorial/middleware.md. PR #9695 by @mojtabapaso.docs/fa/docs/index.md. PR #10216 by @theonlykingpin.docs/de/docs/tutorial/body-fields.md. PR #10310 by @nilslindemann.docs/de/docs/tutorial/body.md. PR #10295 by @nilslindemann.docs/de/docs/tutorial/body-multiple-params.md. PR #10308 by @nilslindemann.docs/ja/docs/tutorial/security/get-current-user.md. PR #2681 by @sh0nk.docs/zh/docs/advanced/advanced-dependencies.md. PR #3798 by @jaystone776.docs/zh/docs/advanced/events.md. PR #3815 by @jaystone776.docs/zh/docs/advanced/behind-a-proxy.md. PR #3820 by @jaystone776.docs/zh/docs/advanced/testing-events.md. PR #3818 by @jaystone776.docs/zh/docs/advanced/testing-websockets.md. PR #3817 by @jaystone776.docs/zh/docs/advanced/testing-database.md. PR #3821 by @jaystone776.docs/zh/docs/deployment/deta.md. PR #3837 by @jaystone776.docs/zh/docs/history-design-future.md. PR #3832 by @jaystone776.docs/zh/docs/project-generation.md. PR #3831 by @jaystone776.docs/zh/docs/deployment/docker.md. PR #10296 by @xzmeng.docs/es/docs/features.md. PR #10884 by @pablocm83.docs/es/docs/newsletter.md. PR #10922 by @pablocm83.docs/ko/docs/tutorial/background-tasks.md. PR #5910 by @junah201.docs/tr/docs/alternatives.md. PR #10502 by @alperiox.docs/ko/docs/tutorial/dependencies/index.md. PR #10989 by @KaniKim./docs/ko/docs/tutorial/body.md. PR #11000 by @KaniKim.docs/pt/docs/tutorial/schema-extra-example.md. PR #4065 by @luccasmmg.docs/tr/docs/history-design-future.md. PR #11012 by @hasansezertasan.docs/tr/docs/resources/index.md. PR #11020 by @hasansezertasan.docs/tr/docs/how-to/index.md. PR #11021 by @hasansezertasan.docs/de/docs/tutorial/query-params.md. PR #10293 by @nilslindemann.docs/de/docs/benchmarks.md. PR #10866 by @nilslindemann.docs/tr/docs/learn/index.md. PR #11014 by @hasansezertasan.docs/fa/docs/tutorial/security/index.md. PR #9945 by @mojtabapaso.docs/tr/docs/help/index.md. PR #11013 by @hasansezertasan.docs/tr/docs/about/index.md. PR #11006 by @hasansezertasan.docs/tr/docs/benchmarks.md. PR #11005 by @hasansezertasan.docs/it/docs/index.md. PR #5233 by @matteospanio.docs/ko/docs/help/index.md. PR #10983 by @KaniKim.docs/ko/docs/features.md. PR #10976 by @KaniKim.docs/ko/docs/tutorial/security/get-current-user.md. PR #5737 by @KdHyeon0661.docs/ru/docs/tutorial/security/first-steps.md. PR #10541 by @AlertRED.docs/ru/docs/tutorial/handling-errors.md. PR #10375 by @AlertRED.docs/ru/docs/tutorial/encoder.md. PR #10374 by @AlertRED.docs/ru/docs/tutorial/body-updates.md. PR #10373 by @AlertRED.fastapi-people.md.. PR #10255 by @NiKuma0.docs/ja/docs/tutorial/security/index.md. PR #5798 by @3w36zj6.docs/de/docs/advanced/generate-clients.md. PR #10725 by @nilslindemann.docs/de/docs/advanced/openapi-webhooks.md. PR #10712 by @nilslindemann.docs/de/docs/advanced/custom-response.md. PR #10624 by @nilslindemann.docs/de/docs/advanced/additional-status-codes.md. PR #10617 by @nilslindemann.docs/de/docs/tutorial/middleware.md. PR #10391 by @JohannesJungbluth.docs/ja/docs/tutorial/encoder.md. PR #1955 by @SwftAlpc.docs/ja/docs/tutorial/extra-data-types.md. PR #1932 by @SwftAlpc.docs/tr/docs/async.md. PR #5191 by @BilalAlpaslan.docs/tr/docs/project-generation.md. PR #5192 by @BilalAlpaslan.docs/ko/docs/deployment/docker.md. PR #5657 by @nearnear.docs/ko/docs/deployment/server-workers.md. PR #4935 by @jujumilk3.docs/ko/docs/deployment/index.md. PR #4561 by @jujumilk3.docs/ko/docs/tutorial/path-operation-configuration.md. PR #3639 by @jungsu-kwon.zh- Traditional Chinese. PR #10889 by @cherinyy.docs/ko/docs/tutorial/static-files.md. PR #2957 by @jeesang7.docs/ko/docs/tutorial/response-model.md. PR #2766 by @hard-coders.docs/ko/docs/tutorial/body-multiple-params.md. PR #2461 by @PandaHun.docs/ko/docs/tutorial/query-params-str-validations.md. PR #2415 by @hard-coders.docs/ko/docs/python-types.md. PR #2267 by @jrim.docs/ko/docs/tutorial/body-nested-models.md. PR #2506 by @hard-coders.docs/ko/docs/learn/index.md. PR #10977 by @KaniKim.docs/de/docs/tutorial/index.md. PR #10962 by @nilslindemann.docs/ko/docs/tutorial/path-params.md. PR #10758 by @2chanhaeng.docs/ja/docs/tutorial/dependencies/dependencies-with-yield.md. PR #1961 by @SwftAlpc.docs/ja/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md. PR #1960 by @SwftAlpc.docs/ja/docs/tutorial/dependencies/sub-dependencies.md. PR #1959 by @SwftAlpc.docs/ja/docs/tutorial/background-tasks.md. PR #2668 by @tokusumi.docs/ja/docs/tutorial/dependencies/index.mdanddocs/ja/docs/tutorial/dependencies/classes-as-dependencies.md. PR #1958 by @SwftAlpc.docs/ja/docs/tutorial/response-model.md. PR #1938 by @SwftAlpc.docs/ja/docs/tutorial/body-multiple-params.md. PR #1903 by @SwftAlpc.docs/ja/docs/tutorial/path-params-numeric-validations.md. PR #1902 by @SwftAlpc.docs/ja/docs/python-types.md. PR #1899 by @SwftAlpc.docs/ja/docs/tutorial/handling-errors.md. PR #1953 by @SwftAlpc.docs/ja/docs/tutorial/response-status-code.md. PR #1942 by @SwftAlpc.docs/ja/docs/tutorial/extra-models.md. PR #1941 by @SwftAlpc.docs/ja/docs/tutorial/schema-extra-example.md. PR #1931 by @SwftAlpc.docs/ja/docs/tutorial/body-nested-models.md. PR #1930 by @SwftAlpc.docs/ja/docs/tutorial/body-fields.md. PR #1923 by @SwftAlpc.docs/de/docs/tutorial/index.md. PR #9502 by @fhabers21.docs/de/docs/tutorial/background-tasks.md. PR #10566 by @nilslindemann.docs/ru/docs/index.md. PR #10672 by @Delitel-WEB.docs/zh/docs/tutorial/extra-data-types.md. PR #10727 by @HiemalBeryl.docs/ru/docs/tutorial/dependencies/classes-as-dependencies.md. PR #10410 by @AlertRED.Internal
mkdocs.yml. PR #11016 by @alejsdev.mkdocs.ymllanguages in CI, updatedocs.py. PR #11009 by @tiangolo.label-approved.ymlto accept translations with 1 reviewer. PR #11007 by @alejsdev.zh-hant. PR #10950 by @tiangolo.v0.109.0Compare Source
Features
Upgrades
Docs
docs/en/docs/alternatives.md. PR #10931 by @s111d.emailwithusernameindocs_src/security/tutorial007code examples. PR #10649 by @nilslindemann..model_dump(). PR #10929 by @tiangolo.docs/en/docs/tutorial/sql-databases.md. PR #10765 by @HurSungYun.docs/en/docs/alternatives.mdanddocs/en/docs/tutorial/dependencies/index.md. PR #10906 by @s111d.docs/en/docs/tutorial/dependencies/dependencies-with-yield.md. PR #10834 by @Molkree.AsyncClient. PR #4167 by @andrew-chang-dewitt./docs/reference/exceptions.mdand/en/docs/reference/status.md. PR #10809 by @clarencepenz.openapi-callbacks.md. PR #10673 by @kayjan.fastapi/routing.py. PR #10520 by @sepsh.create_itemwithupdate_itemwhen appropriate. PR #5913 by @OttoAndrey.Translations
docs/bn/docs/index.md. PR #9177 by @Fahad-Md-Kamal.index.mdin several languages. PR #10711 by @tamago3keran.docs/ru/docs/tutorial/request-forms-and-files.md. PR #10347 by @AlertRED.docs/uk/docs/index.md. PR #10362 by @rostik1410.docs/ko/docs/index.md. PR #10680 by @Eeap.docs/fa/docs/features.md. PR #5887 by @amirilf.docs/zh/docs/advanced/additional-responses.md. PR #10325 by @ShuibeiC.docs/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. PR #10311 by @AlertRED.docs/ru/docs/tutorial/request-files.md. PR #10332 by @AlertRED.docs/zh/docs/deployment/server-workers.md. PR #10292 by @xzmeng.docs/zh/docs/deployment/cloud.md. PR #10291 by @xzmeng.docs/zh/docs/deployment/manually.md. PR #10279 by @xzmeng.docs/zh/docs/deployment/https.md. PR #10277 by @xzmeng.docs/zh/docs/deployment/index.md. PR #10275 by @xzmeng.docs/de/docs/tutorial/first-steps.md. PR #9530 by @fhabers21.docs/tr/docs/index.md. PR #10444 by @hasansezertasan.docs/zh/docs/learn/index.md. PR #10479 by @KAZAMA-DREAM.docs/ru/docs/learn/index.md. PR #10539 by @AlertRED.docs/zh/docs/tutorial/sql-databases.md. PR #9712 by @Royc30ne.docs/tr/docs/external-links.md. PR #10549 by @hasansezertasan.docs/es/docs/learn/index.md. PR #10885 by @pablocm83.docs/uk/docs/tutorial/body-fields.md. PR #10670 by @ArtemKhymenko./docs/hu/docs/index.md. PR #10812 by @takacs.docs/tr/docs/newsletter.md. PR #10550 by @hasansezertasan.docs/es/docs/help/index.md. PR #10907 by @pablocm83.docs/es/docs/about/index.md. PR #10908 by @pablocm83.docs/es/docs/resources/index.md. PR #10909 by @pablocm83.Internal
v0.108.0Compare Source
Upgrades
>=0.29.0,<0.33.0, update docs and usage of templates with new Starlette arguments. PR #10846 by @tiangolo.v0.107.0Compare Source
Upgrades
Docs
v0.106.0Compare Source
Breaking Changes
Using resources from dependencies with
yieldin background tasks is no longer supported.This change is what supports the new features, read below. 🤓
Dependencies with
yield,HTTPExceptionand Background TasksDependencies with
yieldnow can raiseHTTPExceptionand other exceptions afteryield. 🎉Read the new docs here: Dependencies with
yieldandHTTPException.Before FastAPI 0.106.0, raising exceptions after
yieldwas not possible, the exit code in dependencies withyieldwas 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.0Compare Source
Features
Annotated[str, Field(), Query()]. PR #10773 by @tiangolo.Refactors
Docs
Internal
v0.104.1Compare Source
Fixes
Docs
docs/en/docs/tutorial/metadata.md. PR #10433 by @worldworm.docs/en/docs/tutorial/path-params.md. PR #10043 by @giuliowaitforitdavide.docs/en/docs/reference/dependencies.md. PR #10465 by @suravshresth.docs/en/docs/tutorial/body-nested-models.md. PR #10468 by @yogabonito.pydantic.Requiredindocs/en/docs/tutorial/query-params-str-validations.md. PR #10469 by @yogabonito.docs/en/docs/reference/index.md. PR #10467 by @tarsil.Internal
docs/en/docs/async.mdanddocs/zh/docs/async.mdto make them relative. PR #10498 by @hasnatsajid.docs/em/docs/async.md. PR #10507 by @hasnatsajid.docs/em/docs/index.md, Python 3.8. PR #10521 by @kerriop.CITATION.cfffile for academic citations. PR #10496 by @tiangolo.v0.104.0Compare Source
Features
BackgroundTasks, refactor docs structure. PR #10392 by @tiangolo. New docs at FastAPI Reference - Code API.Upgrades
Internal
v0.103.2Compare Source
Refactors
Translations
docs/uk/docs/tutorial/extra-data-types.md. PR #10132 by @ArtemKhymenko.docs/fr/docs/advanced/path-operation-advanced-configuration.md,docs/fr/docs/alternatives.md,docs/fr/docs/async.md,docs/fr/docs/features.md,docs/fr/docs/help-fastapi.md,docs/fr/docs/index.md,docs/fr/docs/python-types.md,docs/fr/docs/tutorial/body.md,docs/fr/docs/tutorial/first-steps.md,docs/fr/docs/tutorial/query-params.md. PR #10154 by @s-rigaud.docs/zh/docs/async.md. PR #5591 by @mkdir700.docs/tutorial/security/simple-oauth2.md. PR #3844 by @jaystone776.docs/ko/docs/deployment/cloud.md. PR #10191 by @Sion99.docs/ja/docs/deployment/https.md. PR #10298 by @tamtam-fitness.docs/ru/docs/tutorial/body-fields.md. PR #10224 by @AlertRED.docs/pl/docs/help-fastapi.md. PR #10121 by @romabozhanovgithub.docs/ru/docs/tutorial/header-params.md. PR #10226 by @AlertRED.docs/zh/docs/deployment/versions.md. PR #10276 by @xzmeng.Internal
v0.103.1Compare Source
Fixes
Docs
regextopattern. PR #10085 by @pablodorrio.docs/en/docs/deployment/server-workers.md. PR #10066 by @tamtam-fitness.docs/en/docs/tutorial/extra-data-types.md. PR #10155 by @hasnatsajid.docs/en/docs/tutorial/handling-errors.md. PR #10170 by @poupapaa.docs/en/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md. PR #10172 by @ragul-kachiappan.Translations
docs/pt/docs/tutorial/path-params.md. PR #10126 by @LecoOliveira.docs/yo/docs/index.md. PR #10033 by @AfolabiOlaoluwa.docs/uk/docs/python-types.md. PR #10080 by @rostik1410.docs/vi/docs/tutorial/first-steps.mdanddocs/vi/docs/tutorial/index.md. PR #10088 by @magiskboy.docs/uk/docs/alternatives.md. PR #10060 by @whysage.docs/uk/docs/tutorial/index.md. PR #10079 by @rostik1410.docs/en/docs/how-to/separate-openapi-schemas.mdanddocs/en/docs/tutorial/schema-extra-example.md. PR #10189 by @xzmeng.docs/zh/docs/advanced/generate-clients.md. PR #9883 by @funny-cat-happy.Refactors
fastapi/applications.py. PR #10045 by @AhsanSheraz.Internal
v0.103.0Compare Source
Features
openapi_examplesin all FastAPI parameters. PR #10152 by @tiangolo.Docs
v0.102.0Compare Source
Features
separate_input_output_schemas=False. PR #10145 by @tiangolo.Refactors
Docs
Internal
v0.101.1Compare Source
Fixes
ResponseValidationErrorprintable details, to show up in server error logs. PR #10078 by @tiangolo.Refactors
fastapi/params.py. PR #9854 by @russbiggs.fastapi/concurrency.pyandfastapi/routing.py. PR #9590 by @ElliottLarsen.Docs
docs/en/docs/contributing.md. PR #9878 by @VicenteMerino.docs/en/docs/tutorial/bigger-applications.md. PR #9806 by @theonlykingpin.Translations
docs/ja/docs/deployment/concepts.md. PR #10062 by @tamtam-fitness.docs/ja/docs/deployment/server-workers.md. PR #10064 by @tamtam-fitness.docs/ja/docs/deployment/docker.md. PR #10073 by @tamtam-fitness.docs/uk/docs/fastapi-people.md. PR #10059 by @rostik1410.docs/uk/docs/tutorial/cookie-params.md. PR #10032 by @rostik1410.docs/ru/docs/deployment/docker.md. PR #9971 by @Xewus.docs/vi/docs/python-types.md. PR #10047 by @magiskboy.docs/ru/docs/tutorial/dependencies/global-dependencies.md. PR #9970 by @dudyaosuplayer.docs/ur/docs/benchmarks.md. PR #9974 by @AhsanSheraz.Internal
v0.101.0Compare Source
Features
computed_field, better OpenAPI for response models, proper required attributes, better generated clients. PR #10011 by @tiangolo.Refactors
jsonable_encoder. PR #9840 by @iudeen.Upgrades
Translations
docs/ru/docs/tutorial/security/index.md. PR #9963 by @eVery1337.Internal
v0.100.1Compare Source
Fixes
MultHostUrltoAnyUrlfor compatibility with older versions of Pydantic v1. PR #9852 by @Kludex.Docs
Translations
docs/uk/docs/tutorial/body.md. PR #4574 by @ss-o-furda.docs/vi/docs/features.mdanddocs/vi/docs/index.md. PR #3006 by @magiskboy.docs/ko/docs/async.md. PR #4179 by @NinaHwang.docs/zh/docs/tutorial/background-tasks.md. PR #9812 by @wdh99.docs/fr/docs/tutorial/query-params-str-validations.md. PR #4075 by @Smlep.docs/fr/docs/tutorial/index.md. PR #2234 by @JulianMaurin.docs/fr/docs/contributing.md. PR #2132 by @JulianMaurin.docs/fr/docs/benchmarks.md. PR #2155 by @clemsau.docs/ru/docs/tutorial/request-forms.md. PR #9841 by @dedkot01.docs/zh/docs/tutorial/handling-errors.md. PR #9485 by @Creat55.Internal
v0.100.0Compare Source
✨ Support for Pydantic v2 ✨
Pydantic version 2 has the core re-written in Rust and includes a lot of improvements and features, for example:
...all this while keeping the same Python API. In most of the cases, for simple models, you can simply upgrade the Pydantic version and get all the benefits. 🚀
In some cases, for pure data validation and processing, you can get performance improvements of 20x or more. This means 2,000% or more. 🤯
When you use FastAPI, there's a lot more going on, processing the request and response, handling dependencies, executing your own code, and particularly, waiting for the network. But you will probably still get some nice performance improvements just from the upgrade.
The focus of this release is compatibility with Pydantic v1 and v2, to make sure your current apps keep working. Later there will be more focus on refactors, correctness, code improvements, and then performance improvements. Some third-party early beta testers that ran benchmarks on the beta releases of FastAPI reported improvements of 2x - 3x. Which is not bad for just doing
pip install --upgrade fastapi pydantic. This was not an official benchmark and I didn't check it myself, but it's a good sign.Migration
Check out the Pydantic migration guide.
For the things that need changes in your Pydantic models, the Pydantic team built
bump-pydantic.A command line tool that will process your code and update most of the things automatically for you. Make sure you have your code in git first, and review each of the changes to make sure everything is correct before committing the changes.
Pydantic v1
This version of FastAPI still supports Pydantic v1. And although Pydantic v1 will be deprecated at some point, ti will still be supported for a while.
This means that you can install the new Pydantic v2, and if something fails, you can install Pydantic v1 while you fix any problems you might have, but having the latest FastAPI.
There are tests for both Pydantic v1 and v2, and test coverage is kept at 100%.
Changes
There are new parameter fields supported by Pydantic
Field()for:Path()Query()Header()Cookie()Body()Form()File()The new parameter fields are:
default_factoryalias_priorityvalidation_aliasserialization_aliasdiscriminatorstrictmultiple_ofallow_inf_nanmax_digitsdecimal_placesjson_schema_extra...you can read about them in the Pydantic docs.
The parameter
regexhas been deprecated and replaced bypattern.New Pydantic models use an improved and simplified attribute
model_configthat takes a simple dict instead of an internal classConfigfor their configuration.The attribute
schema_extrafor the internal classConfighas been replaced by the keyjson_schema_extrain the newmodel_configdict.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.Now Pydantic Settings is an additional optional package (included in
"fastapi[all]"). To use settings you should now importfrom pydantic_settings import BaseSettingsinstead of importing frompydanticdirectly.PR #9816 by @tiangolo, included all the work done (in multiple PRs) on the beta branch (
main-pv2).v0.99.1Compare Source
Fixes
additionalProperties: false. PR #9781 by @tiangolo.Docs
v0.99.0Compare Source
Note: this is the last release before supporting Pydantic v2. You can try out the beta with support for Pydantic v2 now, a new beta supporting Pydantic v2 with these same changes from this release will be available in the next hours/days. And the final version (0.100.0) with support for Pydantic v2 will be released in the next days (next week).
Now, back to this release (this one doesn't include the beta support for Pydantic v2).
This release has ✨ OpenAPI 3.1.0 ✨ 🎉
Features
✨ Add support for OpenAPI 3.1.0. PR #9770 by @tiangolo.
examplesfield inQuery(),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.✨ Add support for
dequeobjects and children injsonable_encoder. PR #9433 by @cranium.Docs
Translations
docs/fa/docs/advanced/sub-applications.md. PR #9692 by @mojtabapaso.docs/ru/docs/tutorial/response-model.md. PR #9675 by @glsglsgls.Internal
v0.98.0Compare Source
Note: please also help me try out the beta with support for Pydantic v2: https://github.com/tiangolo/fastapi/releases/tag/0.100.0-beta1
Now, back to this release (this one doesn't include the beta support for Pydantic v2).
Features
redirect_slashesat the FastAPI app level. PR #3432 by @cyberlis.Docs
docs/en/docs/tutorial/debugging.md. PR #9581 by @ivan-abc.docs/en/docs/tutorial/security/index.md. PR #9561 by @jyothish-mohan.Annotatednotes indocs/en/docs/tutorial/schema-extra-example.md. PR #9620 by @Alexandrhub.Annotation->Annotatedindocs/en/docs/tutorial/query-params-str-validations.md. PR #9625 by @mccricardo.Translations
docs/ru/docs/tutorial/metadata.md. PR #9681 by @TabarakoAkula.docs/es/docs/tutorial/first-steps.md. PR #9571 by @lilidl-nft.docs/tutorial/path-operation-configuration.md. PR #9696 by @TabarakoAkula.docs/zh/docs/advanced/security/index.md. PR #9666 by @lordqyxz.docs/zh/docs/advanced/settings.md. PR #9652 by @ChoyeonChern.docs/zh/docs/advanced/websockets.md. PR #9651 by @ChoyeonChern.docs/zh/docs/tutorial/testing.md. PR #9641 by @wdh99.docs/tutorial/extra-models.md. PR #9619 by @ivan-abc.docs/tutorial/cors.md. PR #9608 by @ivan-abc.docs/pl/docs/features.md. PR #5348 by @mbroton.docs/ru/docs/tutorial/body-nested-models.md. PR #9605 by @Alexandrhub.Internal
v0.97.0Compare Source
Features
dependenciesin WebSocket routes. PR #4534 by @paulo-raca.WebSocketRequestValidationError(which also allows to override it). PR #6030 by @kristjanvalur.Refactors
AsyncExitStackMiddlewareas without Python 3.6AsyncExitStackis always available. PR #9657 by @tiangolo.Upgrades
Internal
v0.96.1Compare Source
Fixes
HTTPExceptionheader type annotations. PR #9648 by @tiangolo.gtetoge. PR #9635 by @tiangolo.Upgrades
Refactors
media_typefromORJSONResponseas it's inherited from the parent class. PR #5805 by @Kludex.HTTPExceptiononly when needed, optimization refactor. PR #5356 by @pawamoy.Docs
Translations
docs/id/docs/tutorial/index.md. PR #5635 by @purwowd.docs/ru/docs/tutorial/index.md. PR #5896 by @Wilidon.docs/zh/docs/advanced/response-change-status-code.mdanddocs/zh/docs/advanced/response-headers.md. PR #9544 by @ChoyeonChern.docs/ru/docs/tutorial/schema-extra-example.md. PR #9621 by @Alexandrhub.Internal
v0.96.0Compare Source
Features
create_cloned_fieldto use a global cache and improve startup performance. PR #4645 by @madkinsz and previous original PR by @huonw.Docs
Translations
docs/tutorial/body.md. PR #3885 by @solomein-sv.docs/ru/docs/tutorial/static-files.md. PR #9580 by @Alexandrhub.docs/ru/docs/tutorial/query-params.md. PR #9584 by @Alexandrhub.docs/ru/docs/tutorial/first-steps.md. PR #9471 by @AGolicyn.docs/ru/docs/tutorial/debugging.md. PR #9579 by @Alexandrhub.docs/ru/docs/tutorial/path-params.md. PR #9519 by @AGolicyn.docs/zh/docs/tutorial/static-files.md. PR #9436 by @wdh99.docs/es/docs/async.md. PR #9483 by @andresbermeoq.docs/ru/docs/tutorial/path-params-numeric-validations.md. PR #9563 by @ivan-abc.docs/ru/docs/deployment/concepts.md. PR #9577 by @Xewus.docs/ru/docs/tutorial/body-multiple-params.md. PR #9586 by @Alexandrhub.Internal
v0.95.2Compare Source
>=0.27.0for a security release. PR #9541 by @tiangolo. Details on Starlette's security advisory.Translations
docs/pt/docs/advanced/events.md. PR #9326 by @oandersonmagalhaes.docs/ru/docs/deployment/manually.md. PR #9417 by @Xewus.docs/ru/docs/tutorial/testing.md. PR #9403 by @Xewus.docs/ru/docs/deployment/https.md. PR #9428 by @Xewus.docs/fr/docs/advanced/response-directly.md. PR #9415 by @axel584.docs/pt/docs/index.md. PR #9337 by @lucasbalieiro.docs/ru/docs/tutorial/response-status-code.md. PR #9370 by @nadia3373.Internal
flask.escapewarning for internal tests. PR #9468 by @samuelcolvin.v0.95.1Compare Source
Fixes
Annotatedin routers or path operations decorated multiple times. PR #9315 by @sharonyogev.Docs
Annotated. PR #9298 by @grdworkin.docs/en/docs/advanced/behind-a-proxy.md. PR #5681 by @Leommjr.docs/fa/docs/index.md. PR #6083 by @Kimiaattaei.docs/en/docs/help-fastapi.md. PR #9249 by @armgabrielyan.docs/en/docs/tutorial/query-params-str-validations.md. PR #9272 by @nicornk.docs/en/docs/tutorial/query-params-str-validations.md. PR #9273 by @tim-habitat.docs/en/docs/tutorial/path-params-numeric-validations.md. PR #9282 by @aadarsh977.docs/en/docs/tutorial/query-params-str-validations.md. PR #9380 by @dasstyxx.Translations
docs/fr/docs/advanced/index.md. PR #5673 by @axel584.docs/pt/docs/tutorial/body-nested-models.md. PR #4053 by @luccasmmg.docs/ru/docs/alternatives.md. PR #5994 by @Xewus.docs/pt/docs/tutorial/extra-models.md. PR #5912 by @LorhanSohaky.docs/pt/docs/tutorial/path-operation-configuration.md. PR #5936 by @LorhanSohaky.docs/ru/docs/contributing.md. PR #6002 by @stigsanek.docs/tutorial/dependencies/classes-as-dependencies.md. PR #9176 by @sehwan505.docs/ru/docs/project-generation.md. PR #9243 by @Xewus.docs/fr/docs/index.md. PR #9265 by @frabc.docs/ru/docs/tutorial/query-params-str-validations.md. PR #9267 by @dedkot01.docs/ru/docs/benchmarks.md. PR #9271 by @Xewus.Internal
v0.95.0Compare Source
Highlights
This release adds support for dependencies and parameters using
Annotatedand recommends its usage. ✨This has several benefits, one of the main ones is that now the parameters of your functions with
Annotatedwould not be affected at all.If you call those functions in other places in your code, the actual default values will be kept, your editor will help you notice missing required arguments, Python will require you to pass required arguments at runtime, you will be able to use the same functions for different things and with different libraries (e.g. Typer will soon support
Annotatedtoo, then you could use the same function for an API and a CLI), etc.Because
Annotatedis standard Python, you still get all the benefits from editors and tools, like autocompletion, inline errors, etc.One of the biggest benefits is that now you can create
Annotateddependencies that are then shared by multiple path operation functions, this will allow you to reduce a lot of code duplication in your codebase, while keeping all the support from editors and tools.For example, you could have code like this:
There's a bit of code duplication for the dependency:
...the bigger the codebase, the more noticeable it is.
Now you can create an annotated dependency once, like this:
And then you can reuse this
Annotateddependency:...and
CurrentUserhas all the typing information asUser, so your editor will work as expected (autocompletion and everything), and FastAPI will be able to understand the dependency defined inAnnotated. 😎Roughly all the docs have been rewritten to use
Annotatedas the main way to declare parameters and dependencies. All the examples in the docs now include a version withAnnotatedand a version without it, for each of the specific Python versions (when there are small differences/improvements in more recent versions). There were around 23K new lines added between docs, examples, and tests. 🚀The key updated docs are:
AnnotatedAnnotatedAnnotateddependenciesSpecial thanks to @nzig for the core implementation and to @adriangb for the inspiration and idea with Xpresso! 🚀
Features
Annotatedfor specifying dependencies and parameters. PR #4871 by @nzig.Docs
Annotatedin docs. PR #9270 by @tiangolo.Annotatedas the main recommendation, with new examples and tests. PR #9268 by @tiangolo.v0.94.1Compare Source
Fixes
v0.94.0Compare Source
Upgrades
lifespanwith state. PR #9239 by @tiangolo.Docs
Translations
docs/ru/docs/history-design-future.md. PR #5986 by @Xewus.Internal
pydanticto PyPI classifiers. PR #5914 by @yezz123.v0.93.0Compare Source
Features
lifespanasync context managers (supersedingstartupandshutdownevents). Initial PR #2944 by @uSpike.Now, instead of using independent
startupandshutdownevents, you can define that logic in a single function withyielddecorated with@asynccontextmanager(an async context manager).For example:
Note: This is the recommended way going forward, instead of using
startupandshutdownevents.Read more about it in the new docs: Advanced User Guide: Lifespan Events.
Docs
docs/en/docs/tutorial/metadata.mdforReDoc. PR #6005 by @eykamp.Translations
docs/fr/docs/advanced/path-operation-advanced-configuration.md. PR #9221 by @axel584.docs/tutorial/debugging.md. PR #9175 by @frabc.deployment/manually.md. PR #3693 by @rjNemo.Internal
v0.92.0Compare Source
🚨 This is a security fix. Please upgrade as soon as possible.
Upgrades
v0.91.0Compare Source
Upgrades
0.24.0and refactor internals for compatibility. PR #5985 by @tiangolo.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! Starlette PR #2017). Now the middleware class instances are created once, right before the first request (the first time the app is called).v0.90.1Compare Source
Upgrades
Docs
docs/en/docs/project-generation.md. PR #5930 by @chandra-deb.Translations
docs/ru/docs/tutorial/cookie-params.md. PR #5890 by @bnzone.Internal
zip-docs.shinternal script, remove extra space. PR #5931 by @JuanPerdomo00.v0.90.0Compare Source
Upgrades
Docs
Translations
docs/ru/docs/tutorial/body-fields.md. PR #5898 by @simatheone.docs/ru/docs/help-fastapi.md. PR #5970 by @tiangolo.docs/pt/docs/tutorial/static-files.md. PR #5858 by @batlopes.docs/pt/docs/tutorial/encoder.md. PR #5525 by @felipebpl.docs/ru/docs/contributing.md. PR #5870 by @Xewus.Internal
v0.89.1Compare Source
Fixes
Docs
Translations
docs/tr/docs/tutorial/first_steps.md. PR #5691 by @Kadermiyanyedi.v0.89.0Compare Source
Features
response_model. Initial PR #1436 by @uriyyo.Now you can declare the return type /
response_modelin the function return type annotation:FastAPI will use the return type annotation to perform:
Before this version it was only supported via the
response_modelparameter.Read more about it in the new docs: Response Model - Return Type.
Docs
docs/en/docs/async.md. PR #5785 by @Kingdageek.docs/en/docs/deployment/concepts.md. PR #5824 by @kelbyfaessler.Translations
docs/ru/docs/fastapi-people.md. PR #5577 by @Xewus.docs/zh/docs/benchmarks.md. PR #4269 by @15027668g.docs/tutorial/cors.md. PR #3764 by @NinaHwang.Internal
v0.88.0Compare Source
Upgrades
0.22.0to fix bad encoding for query parameters in newTestClient. PR #5659 by @azogue.Docs
docs/en/docs/advanced/middleware.md. PR #5376 by @rifatrakib.Translations
docs/pt/docs/deployment/docker.md. PR #5663 by @ayr-ton.Internal
setup-pythonaction in tests to use new caching feature. PR #5680 by @madkinsz.v0.87.0Compare Source
Highlights of this release:
TestClientis based on HTTPX instead of Requests. 🚀TestClientusage, but @Kludex built bump-testclient to help you automatize migrating your tests. Make sure you are using Git and that you can undo any unnecessary changes (false positive changes, etc) before usingbump-testclient.all(including new Uvicorn version), when you install"fastapi[all]".Features
WebSocketExceptionand add it to docs. PR #5629 by @tiangolo.0.21.0, including the newTestClientbased on HTTPX. PR #5471 by @pawelrubin.Docs
Translations
docs/tutorial/query-params.md. PR #2969 by @ftnext.docs/fr/docs/advanced/additional-status-code.md. PR #5477 by @axel584.docs/pt/docs/tutorial/request-forms-and-files.md. PR #5579 by @batlopes.docs/ja/docs/advanced/websockets.md. PR #4983 by @xryuseix.Internal
v0.86.0Compare Source
Features
Fixes
Docs
docs/en/docs/tutorial/security/oauth2-jwt.md. PR #5584 by @vivekashok1221.Translations
docs/zh/docs/python-types.md. PR #5416 by @supercaizehua.docs/ru/docs/deployment/index.md. PR #5336 by @Xewus.docs/tutorial/security/oauth2-jwt.md. PR #3846 by @jaystone776.Internal
test_starlette_exception.py. PR #5379 by @iudeen.v0.85.2Compare Source
Note: this release doesn't affect final users, it's mainly internal. It unlocks Pydanitc work with the integration that runs FastAPI's tests in Pydantic's CI.
Docs
docs/en/docs/async.md. PR #5432 by @pamelafox.alternatives.md. PR #5455 by @su-shubham.pipin Zsh. PR #5523 by @zhangbo2012.Translations
docs/pt/docs/tutorial/request-forms.md. PR #4934 by @batlopes.docs/zh/docs/tutorial/dependencies/classes-as-dependencies.md. PR #4971 by @Zssaer.deployment/deta.md. PR #3692 by @rjNemo.docs/zh/docs/tutorial/query-params-str-validations.md. PR #5255 by @hjlarry.docs/zh/docs/tutorial/sql-databases.md. PR #4999 by @Zssaer.docs/zh/docs/advanced/wsgi.md. PR #4505 by @ASpathfinder.docs/pt/docs/tutorial/body-multiple-params.md. PR #4111 by @lbmendes.docs/pt/docs/tutorial/path-params-numeric-validations.md. PR #4099 by @lbmendes.deployment/versions.md. PR #3690 by @rjNemo.docs/fr/docs/help-fastapi.md. PR #2233 by @JulianMaurin.docs/zh/docs/tutorial/security/first-steps.md. PR #5530 by @yuki1sntSnow.docs/pt/docs/tutorial/response-status-code.md. PR #4922 by @batlopes.Internal
mkdocsfor languages as a subprocess to fix/enable MkDocs Material search plugin. PR #5501 by @tiangolo.v0.85.1Compare Source
Fixes
default,1XX,2XX,3XX,4XX,5XX. PR #5187 by @JarroVGIT.Docs
Internal
v0.85.0Compare Source
Features
0.19.1to0.20.4. Initial PR #4820 by @Kludex.>=0.12.0,<0.18.0to>=0.12.0,<0.19.0. PR #5401 by @tiangolo.Internal
v0.84.0Compare Source
Breaking Changes
This version of FastAPI drops support for Python 3.6. 🔥 Please upgrade to a supported version of Python (3.7 or above), Python 3.6 reached the end-of-life a long time ago. 😅☠
v0.83.0Compare Source
🚨 This is probably the last release (or one of the last releases) to support Python 3.6. 🔥
Python 3.6 reached the end-of-life and is no longer supported by Python since around a year ago.
You hopefully updated to a supported version of Python a while ago. If you haven't, you really should.
Features
jsonable_encoderfor include and exclude with dataclasses. PR #4923 by @DCsunset.Fixes
RuntimeErrorraised whenHTTPExceptionhas a status code with no content. PR #5365 by @iudeen.status_codeis empty but the aResponseparameter withresponse.status_codeis set. PR #5360 by @tmeckel.Docs
SECURITY.md. PR #5377 by @Kludex.Internal
v0.82.0Compare Source
🚨 This is probably the last release (or one of the last releases) to support Python 3.6. 🔥
Python 3.6 reached the end-of-life and is no longer supported by Python since around a year ago.
You hopefully updated to a supported version of Python a while ago. If you haven't, you really should.
Features
WebSocketStateinfastapi.websockets. PR #4376 by @matiuszka.ORJSONResponseto support nonstrkeys and serializing Numpy arrays. PR #3892 by @baby5.Fixes
yieldto always execute, by removing capacity limiter for them, to e.g. allow closing DB connections without deadlocks. PR #5122 by @adriangb.Docs
docs/en/docs/advanced/dataclasses.md. PR #3698 by @pfackeldey.X | Yoperator in explanation about Response Models. PR #5307 by @MendyLanda.ORJSONResponsewith details about improving performance. PR #2615 by @falkben.Translations
docs/ru/docs/features.md. PR #5315 by @Xewus.docs/zh/docs/tutorial/request-files.md. PR #4529 by @ASpathfinder.docs/zh/docs/tutorial/encoder.md. PR #4969 by @Zssaer.background-task.md. PR #5242 by @ComicShrimp.Internal
operation_idparameter position in delete method for consistency with the code. PR #4474 by @hiel.v0.81.0Compare Source
Features
<noscript>warning when JS is disabled. PR #5074 by @evroon.FrozenSetin parameters (e.g. query). PR #2938 by @juntatalor.HTTPExceptions and propagate them. PR #2036 by @ghandic.json.JSONDecodeErrorinformation when handling invalid JSON in request body, to support custom exception handlers that use its information. PR #4057 by @UKnowWhoIm.Fixes
jsonable_encoderfor dataclasses with pydantic-compatible fields. PR #3607 by @himbeles.openapi_extraswith parameter lists. PR #4267 by @orilevari.Docs
docs/en/docs/python-types.md. PR #5193 by @GlitchingCore.tests/test_schema_extra_examples.py. PR #5126 by @supraaxdd.docs/en/docs/tutorial/path-params-numeric-validations.md. PR #5142 by @invisibleroads.docs/en/docs/contributing.md. PR #5181 by @edisnake.docs/en/docs/tutorial/body-nested-models.md. PR #5169 by @papb.docs/en/docs/features.md. PR #5206 by @OtherBarry.docs/en/docs/async.md. PR #5125 by @Ksenofanex.else. PR #4693 by @adriangb.docs/en/docs/python-types.md. PR #4886 by @MicaelJarniac.typo-fix-path-params-numeric-validations.md. PR #3219 by @ccrenfroe.secrets.compare_digest()to account for non-ASCII characters. PR #3536 by @lewoudar.Translations
docs/ru/docs/index.md. PR #5289 by @impocode.docs/ru/docs/deployment/versions.md. PR #4985 by @emp7yhead.docs/pt/docs/tutorial/header-params.md. PR #4921 by @batlopes.ko/mkdocs.ymlfor a missing link. PR #5020 by @dalinaum.Internal
tests/test_tutorial/test_sql_databases/test_sql_databases.py. PR #5040 by @raccoonyy.fastapi/utils.py. PR #5057 by @pylounge.auto_errorwhich does not need to beOptional[bool]. PR #4933 by @DavidKimDY.strict = trueinstead of manual configs. PR #4605 by @michaeloliverx.dict()for{}infastapi/utils.py. PR #3138 by @ShahriyarR.jsonable_encoderto put related code closer. PR #4560 by @GuilleQP.fastapi/dependencies/utils.py. PR #4597 by @cikay.flake8 >=3.8.3,<6.0.0. PR #4097 by @jamescurtin.v0.80.0Compare Source
Breaking Changes - Fixes
response_modelnot invalidatingNone. PR #2725 by @hukkin.If you are using
response_modelwith some type that doesn't includeNonebut the function is returningNone, it will now raise an internal server error, because you are returning invalid data that violates the contract inresponse_model. Before this release it would allow breaking that contract returningNone.For example, if you have an app like this:
...calling the path
/items/invalidnonewill raise an error, becauseNoneis not a valid type for theresponse_modeldeclared withItem.You could also be implicitly returning
Nonewithout realizing, for example:If you have path operations using
response_modelthat need to be allowed to returnNone, make it explicit inresponse_modelusingUnion[Something, None]:This way the data will be correctly validated, you won't have an internal server error, and the documentation will also reflect that this path operation could return
None(ornullin JSON).Fixes
oauth2-redirect.htmlto include fixes for flavors of authorization code flows in Swagger UI. PR #3439 initial PR by @koonpeng.Security()and other places (e.g.Depends()) with different OAuth2 scopes. PR #2945 by @laggardkernel.response_model, allow things likeUnion[str, None]. PR #5294 by @tiangolo.Translations
docs/de/docs/features.md. PR #4533 by @0xflotus.encoder.mdin Korean translation. PR #5238 by @joonas-yoon.v0.79.1Compare Source
Fixes
jsonable_encoderusingincludeandexcludeparameters for non-Pydantic objects. PR #2606 by @xaviml.Docs
python-types.md. PR #5116 by @Kludex.docs/en/docs/python-types.md. PR #5007 by @atiabbz.Translations
docs/pt/docs/tutorial/query-params.md. PR #4775 by @batlopes.docs/pt/docs/tutorial/security/first-steps.md. PR #4954 by @FLAIR7.docs/zh/docs/advanced/response-cookies.md. PR #4638 by @zhangbo2012.docs/fr/docs/deployment/index.md. PR #3689 by @rjNemo.tutorial/handling-errors.md. PR #4769 by @frnsimoes.docs/fr/docs/history-design-future.md. PR #3451 by @rjNemo.docs/ru/docs/tutorial/background-tasks.md. PR #4854 by @AdmiralDesu.docs/tutorial/security/first-steps.md. PR #3841 by @jaystone776.docs/ja/docs/advanced/nosql-databases.md. PR #4205 by @sUeharaE4.docs/id/docs/tutorial/index.md. PR #4705 by @bas-baskara.docs/fa/docs/index.mdand tweak right-to-left CSS. PR #2395 by @mohsen-mahmoodi.Internal
v0.79.0Compare Source
Fixes - Breaking Changes
status_codeto204,304, or any code below200(1xx) will remove the body from the response.RuntimeError: Response content longer than Content-Length.fastapi.openapi.constants.STATUS_CODES_WITH_NO_BODY, it is replaced by a function in utils.Translations
docs/ja/docs/advanced/index.md. PR #5043 by @wakabame.docs/pl/docs/tutorial/first-steps.md. PR #5024 by @Valaraucoo.Internal
Optional[X]toUnion[X, None]for internal utils. PR #5124 by @tiangolo.v0.78.0Compare Source
Features
✨ Add support for omitting
...as default value when declaring required parameters with:Path()Query()Header()Cookie()Body()Form()File()New docs at Tutorial - Query Parameters and String Validations - Make it required. PR #4906 by @tiangolo.
Up to now, declaring a required parameter while adding additional validation or metadata needed using
...(Ellipsis).For example:
...all these parameters are required because the default value is
...(Ellipsis).But now it's possible and supported to just omit the default value, as would be done with Pydantic fields, and the parameters would still be required.
✨ For example, this is now supported:
To declare parameters as optional (not required), you can set a default value as always, for example using
None:Docs
UnionoverOptionaland migrate source examples. New docs at Python Types Intro - UsingUnionorOptional. PR #4908 by @tiangolo.Translations
docs/ja/docs/tutorial/testing.md. PR #4623 by @hirotoKirimaru.Internal
fastapi/utils.py. PR #3139 by @ShahriyarR.v0.77.1Compare Source
Upgrades
Docs
docs/en/docs/tutorial/security/first-steps.md. PR #4515 by @KikoIlievski.Translations
docs/pl/docs/tutorial/index.md. PR #4516 by @MKaczkow.docs/pt/docs/help-fastapi.md. PR #4583 by @mateusjs.Internal
v0.77.0Compare Source
Upgrades
JSONResponsethecontentargument is now required.Docs
TestClient. PR #4389 by @rgilton.docs/en/docs/tutorial/sql-databases.md. PR #4875 by @wpyoga.docs/en/docs/async.md. PR #4726 by @Prezu.Translations
docs/zh/docs/tutorial/query-params-str-validations.md. PR #4237 by @caimaoy.docs/pt/docs/tutorial/path-params.md. PR #4722 by @CleoMenezesJr.docs/pt/docs/tutorial/cookie-params.md. PR #4112 by @lbmendes.docs/tutorial/body.md. PR #4332 by @Smlep.docs/ja/docs/advanced/conditional-openapi.md. PR #2631 by @sh0nk.docs/ja/docs/tutorial/body.md. PR #3062 by @a-takahashi223.docs/pt/docs/tutorial/background-tasks.md. PR #2170 by @izaguerreiro.docs/deployment/deta.md. PR #4442 by @lsglucas.docs/async.md. PR #4036 by @Winand.docs/tutorial/body.md. PR #3960 by @leandrodesouzadev.tutorial/extra-data-types.md. PR #4077 by @luccasmmg.docs/features.md. PR #3905 by @jomue.v0.76.0Compare Source
Upgrades
Internal
v0.75.2Compare Source
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.
Fixes
ValidationErrorJSON Schema. PR #4806 by @tiangolo.ValidationErrorat fieldloc. PR #3810 by @dconathan.Upgrades
/docs) publicly to non-expert users. PR #4347 by @RAlanWright.Internal
v0.75.1Compare Source
Translations
Internal
v0.75.0Compare Source
Features
generate_unique_id_functionand docs for generating clients. New docs: Advanced - Generate Clients. PR #4650 by @tiangolo.v0.74.1Compare Source
Features
v0.74.0Compare Source
Breaking Changes
AsyncExitStackto fix context for dependencies withyield. PR #4575 by @tiangolo.Dependencies with
yieldcan now catchHTTPExceptionand custom exceptions. For example:After the dependency with
yieldhandles the exception (or not) the exception is raised again. So that any exception handlers can catch it, or ultimately the default internalServerErrorMiddleware.If you depended on exceptions not being received by dependencies with
yield, and receiving an exception breaks the code afteryield, you can use a block withtryandfinally:...that way the
finallyblock is run regardless of any exception that might happen.Features
contextvarscontext for the code before and afteryield. This was the main objective of that PR.This means that now, if you set a value in a context variable before
yield, the value would still be available afteryield(as you would intuitively expect). And it also means that you can reset the context variable with a token afterwards.For example, this works correctly now:
...before this change it would raise an error when resetting the context variable, because the
contextvarscontext was different, because of the way it was implemented.Note: You probably don't need
contextvars, and you should probably avoid using them. But they are powerful and useful in some advanced scenarios, for example, migrating from code that used Flask'sgsemi-global variable.Technical Details: If you want to know more of the technical details you can check out the PR description #4575.
Internal
v0.73.0Compare Source
Features
UploadFileparameters without explicitFile(). PR #4469 by @tiangolo. New docs: Request Files - File Parameters with UploadFile.Query,Cookie,Header, andPathparameters. PR #3144 by @astraldawn. New docs: Query Parameters and String Validations - Exclude from OpenAPI.Docs
Fixes
jsonable_encoder. PR #2061 by @viveksunder.Internal
v0.72.0Compare Source
Features
Docs
Translations
docs/help-fastapi.md. PR #3847 by @jaystone776.docs/ko/docs/index.md. PR #4195 by @kty4119.docs/pl/docs/index.md. PR #4245 by @MicroPanda123.docs\tutorial\path-operation-configuration.md. PR #3312 by @jaystone776.Internal
content.tabs.link. PR #4399 by @tiangolo.v0.71.0Compare Source
Features
Internal
v0.70.1Compare Source
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. 🤩
Fixes
Translations
docs/tutorial/request-forms-and-files.md. PR #3744 by @NinaHwang.docs/tutorial/request-files.md. PR #3743 by @NinaHwang.docs/tutorial/query-params-str-validations.md. PR #3965 by @leandrodesouzadev.docs/tutorial/response-status-code.md. PR #3742 by @NinaHwang.docs/ko/docs/deployment/versions.md. PR #4121 by @DevDae.docs/ko/docs/tutorial/index.md. PR #4193 by @kimjaeyoonn.docs/tutorial/dependencies/classes-as-dependencies: Add type of query parameters in a description ofClasses as dependencies. PR #4015 by @0417taehyun.docs/tutorial/path-params.md. PR #3548 by @Smlep.docs/tutorial/query-params.md. PR #3556 by @Smlep.docs/python-types.md. PR #3926 by @BilalAlpaslan.Internal
v0.70.0Compare Source
This release just upgrades Starlette to the latest version,
0.16.0, which includes several bug fixes and some small breaking changes.These last three consecutive releases are independent so that you can migrate gradually:
0.68.2, with no breaking changes, but upgrading all the sub-dependencies.0.69.0, which upgrades Starlette to0.15.0, with AnyIO support, and a higher chance of having breaking changes in your code.0.70.0, just upgrading Starlette to the latest version0.16.0with additional bug fixes.This way, in case there was a breaking change for your code in one of the releases, you can still benefit from the previous upgrades. ✨
Breaking Changes - Upgrade
Also upgrades the ranges of optional dependencies:
"jinja2 >=2.11.2,<4.0.0""itsdangerous >=1.1.0,<3.0.0"v0.69.0Compare Source
Breaking Changes - Upgrade
This release adds support for Trio. ✨
It upgrades the version of Starlette to
0.15.0, now based on AnyIO, and the internal async components in FastAPI are now based on AnyIO as well, making it compatible with both asyncio and Trio.You can read the docs about running FastAPI with Trio using Hypercorn.
This release also removes
grapheneas an optional dependency for GraphQL. If you need to work with GraphQL, the recommended library now is Strawberry. You can read the new FastAPI with GraphQL docs.Features
0.15.0. PR #3372 by @graingert.grapheneas an optional dependency. PR #4007 by @tiangolo.Docs
docs/en/docs/contributing.md. PR #3752 by @NinaHwang.docs/en/docs/advanced/path-operation-advanced-configuration.mdanddocs/en/docs/release-notes.md. PR #3750 by @saintmalik.docs/en/docs/help-fastapi.md. PR #3760 by @jaystone776.docs/en/docs/tutorial/bigger-applications.md. PR #3285 by @HolyDorus.docs/en/docs/tutorial/testing.md. PR #3382 by @Bharat123rox.docs/en/docs/advanced/templates.md. PR #3211 by @oerpli.docs/en/docs/tutorial/request-files.md. PR #2803 by @gsganden.docs/tutorial/handling-errors.md. PR #2700 by @graue70.Translations
docs/fastapi-people.md. PR #3848 by @BilalAlpaslan.Internal
docs/ja/docs/deployment/docker.md. PR #3245 by @utamori.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.
Renovate Ignore Notification
Because you closed this PR without merging, Renovate will ignore this update (
==0.109.2). You will get a PR once a newer version is released. To ignore this dependency forever, add it to theignoreDepsarray of your Renovate config.If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.