chore(deps): update dependency fastapi to ^0.85 - autoclosed
This MR contains the following updates:
Package | Change | Age | Adoption | Passing | Confidence |
---|---|---|---|---|---|
fastapi |
^0.66 -> ^0.85
|
Release Notes
tiangolo/fastapi
v0.85.1
Fixes
-
🐛 Fix support for strings in OpenAPI status codes:default
,1XX
,2XX
,3XX
,4XX
,5XX
. MR #5187 by @JarroVGIT.
Docs
Internal
-
👥 Update FastAPI People. MR #5447 by @github-actions[bot]. -
🔧 Disable Material for MkDocs search plugin. MR #5495 by @tiangolo. -
🔇 Ignore Trio warning in tests for CI. MR #5483 by @samuelcolvin.
v0.85.0
Features
-
⬆ Upgrade version required of Starlette from0.19.1
to0.20.4
. Initial MR #4820 by @Kludex.- This includes several bug fixes in Starlette.
-
⬆ ️ Upgrade Uvicorn max version in public extras: all. From>=0.12.0,<0.18.0
to>=0.12.0,<0.19.0
. MR #5401 by @tiangolo.
Internal
-
⬆ ️ Upgrade dependencies for doc and dev internal extras: Typer, Uvicorn. MR #5400 by @tiangolo. -
⬆ ️ Upgrade test dependencies: Black, HTTPX, databases, types-ujson. MR #5399 by @tiangolo. -
⬆ ️ Upgrade mypy and tweak internal type annotations. MR #5398 by @tiangolo. -
🔧 Update test dependencies, upgrade Pytest, move dependencies from dev to test. MR #5396 by @tiangolo.
v0.84.0
Breaking Changes
This version of FastAPI drops support for Python 3.6.
-
🔧 Update package metadata, drop support for Python 3.6, move build internals from Flit to Hatch. MR #5240 by @ofek.
v0.83.0
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
-
✨ Add support injsonable_encoder
for include and exclude with dataclasses. MR #4923 by @DCsunset.
Fixes
-
🐛 FixRuntimeError
raised whenHTTPException
has a status code with no content. MR #5365 by @iudeen. -
🐛 Fix empty reponse body when defaultstatus_code
is empty but the aResponse
parameter withresponse.status_code
is set. MR #5360 by @tmeckel.
Docs
Internal
-
⬆ [pre-commit.ci] pre-commit autoupdate. MR #5352 by @pre-commit-ci[bot].
v0.82.0
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
-
✨ ExportWebSocketState
infastapi.websockets
. MR #4376 by @matiuszka. -
✨ Support Python internal description on Pydantic model's docstring. MR #3032 by @Kludex. -
✨ UpdateORJSONResponse
to support nonstr
keys and serializing Numpy arrays. MR #3892 by @baby5.
Fixes
-
🐛 Allow exit code for dependencies withyield
to always execute, by removing capacity limiter for them, to e.g. allow closing DB connections without deadlocks. MR #5122 by @adriangb. -
🐛 Fix FastAPI People GitHub Action: set HTTPX timeout for GraphQL query request. MR #5222 by @iudeen. -
🐛 Make sure a parameter defined as required is kept required in OpenAPI even if defined as optional in another dependency. MR #4319 by @cd17822. -
🐛 Fix support for path parameters in WebSockets. MR #3879 by @davidbrochart.
Docs
-
✏ Update Hypercorn link, now pointing to GitHub. MR #5346 by @baconfield. -
✏ Tweak wording indocs/en/docs/advanced/dataclasses.md
. MR #3698 by @pfackeldey. -
📝 Add note about Python 3.10X | Y
operator in explanation about Response Models. MR #5307 by @MendyLanda. -
📝 Add link to New Relic article: "How to monitor FastAPI application performance using Python agent". MR #5260 by @sjyothi54. -
📝 Update docs forORJSONResponse
with details about improving performance. MR #2615 by @falkben. -
📝 Add docs for creating a custom Response class. MR #5331 by @tiangolo. -
📝 Add tip about using alias for form data fields. MR #5329 by @tiangolo.
Translations
-
🌐 Add Russian translation fordocs/ru/docs/features.md
. MR #5315 by @Xewus. -
🌐 Update Chinese translation fordocs/zh/docs/tutorial/request-files.md
. MR #4529 by @ASpathfinder. -
🌐 Add Chinese translation fordocs/zh/docs/tutorial/encoder.md
. MR #4969 by @Zssaer. -
🌐 Fix MkDocs file line for Portuguese translation ofbackground-task.md
. MR #5242 by @ComicShrimp.
Internal
-
👥 Update FastAPI People. MR #5347 by @github-actions[bot]. -
⬆ Bump dawidd6/action-download-artifact from 2.22.0 to 2.23.0. MR #5321 by @dependabot[bot]. -
⬆ [pre-commit.ci] pre-commit autoupdate. MR #5318 by @pre-commit-ci[bot]. -
✏ Fix a small code highlight line error. MR #5256 by @hjlarry. -
♻ Internal small refactor, moveoperation_id
parameter position in delete method for consistency with the code. MR #4474 by @hiel. -
🔧 Update sponsors, disable ImgWhale. MR #5338 by @tiangolo.
v0.81.0
Features
-
✨ Add ReDoc<noscript>
warning when JS is disabled. MR #5074 by @evroon. -
✨ Add support forFrozenSet
in parameters (e.g. query). MR #2938 by @juntatalor. -
✨ Allow custom middlewares to raiseHTTPException
s and propagate them. MR #2036 by @ghandic. -
✨ Preservejson.JSONDecodeError
information when handling invalid JSON in request body, to support custom exception handlers that use its information. MR #4057 by @UKnowWhoIm.
Fixes
-
🐛 Fixjsonable_encoder
for dataclasses with pydantic-compatible fields. MR #3607 by @himbeles. -
🐛 Fix support for extendingopenapi_extras
with parameter lists. MR #4267 by @orilevari.
Docs
-
✏ Fix a simple typo indocs/en/docs/python-types.md
. MR #5193 by @GlitchingCore. -
✏ Fix typos intests/test_schema_extra_examples.py
. MR #5126 by @supraaxdd. -
✏ Fix typos indocs/en/docs/tutorial/path-params-numeric-validations.md
. MR #5142 by @invisibleroads. -
📝 Add step about upgrading pip in the venv to avoid errors when installing dependenciesdocs/en/docs/contributing.md
. MR #5181 by @edisnake. -
✏ Reword and clarify text in tutorialdocs/en/docs/tutorial/body-nested-models.md
. MR #5169 by @papb. -
✏ Fix minor typo indocs/en/docs/features.md
. MR #5206 by @OtherBarry. -
✏ Fix minor typos indocs/en/docs/async.md
. MR #5125 by @Ksenofanex. -
📝 Add external link to docs: "Fastapi, Docker(Docker compose) and Postgres". MR #5033 by @krishnardt. -
📝 Simplify example for docs for Additional Responses, remove unnecessaryelse
. MR #4693 by @adriangb. -
📝 Update docs, compare enums with identity instead of equality. MR #4905 by @MicaelJarniac. -
✏ Fix typo indocs/en/docs/python-types.md
. MR #4886 by @MicaelJarniac. -
🎨 Fix syntax highlighting in docs for OpenAPI Callbacks. MR #4368 by @xncbf. -
✏ Reword confusing sentence in docs filetypo-fix-path-params-numeric-validations.md
. MR #3219 by @ccrenfroe. -
📝 Update docs for handling HTTP Basic Auth withsecrets.compare_digest()
to account for non-ASCII characters. MR #3536 by @lewoudar. -
📝 Update docs for testing, fix examples with relative imports. MR #5302 by @tiangolo.
Translations
-
🌐 Add Russian translation fordocs/ru/docs/index.md
. MR #5289 by @impocode. -
🌐 Add Russian translation fordocs/ru/docs/deployment/versions.md
. MR #4985 by @emp7yhead. -
🌐 Add Portuguese translation fordocs/pt/docs/tutorial/header-params.md
. MR #4921 by @batlopes. -
🌐 Updateko/mkdocs.yml
for a missing link. MR #5020 by @dalinaum.
Internal
-
⬆ Bump dawidd6/action-download-artifact from 2.21.1 to 2.22.0. MR #5258 by @dependabot[bot]. -
⬆ [pre-commit.ci] pre-commit autoupdate. MR #5196 by @pre-commit-ci[bot]. -
🔥 Delete duplicated tests intests/test_tutorial/test_sql_databases/test_sql_databases.py
. MR #5040 by @raccoonyy. -
♻ Simplify internal RegEx infastapi/utils.py
. MR #5057 by @pylounge. -
🔧 Fix Type hint ofauto_error
which does not need to beOptional[bool]
. MR #4933 by @DavidKimDY. -
🔧 Update mypy config, usestrict = true
instead of manual configs. MR #4605 by @michaeloliverx. -
♻ Change adict()
for{}
infastapi/utils.py
. MR #3138 by @ShahriyarR. -
♻ Move internal variable for errors injsonable_encoder
to put related code closer. MR #4560 by @GuilleQP. -
♻ Simplify conditional assignment infastapi/dependencies/utils.py
. MR #4597 by @cikay. -
⬆ Upgrade version pin accepted for Flake8, for internal code, toflake8 >=3.8.3,<6.0.0
. MR #4097 by @jamescurtin. -
🍱 Update Jina banner, fix typo. MR #5301 by @tiangolo.
v0.80.0
Breaking Changes - Fixes
If you are using response_model
with some type that doesn't include None
but the function is returning None
, it will now raise an internal server error, because you are returning invalid data that violates the contract in response_model
. Before this release it would allow breaking that contract returning None
.
For example, if you have an app like this:
from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
price: Optional[float] = None
owner_ids: Optional[List[int]] = None
app = FastAPI()
@​app.get("/items/invalidnone", response_model=Item)
def get_invalid_none():
return None
...calling the path /items/invalidnone
will raise an error, because None
is not a valid type for the response_model
declared with Item
.
You could also be implicitly returning None
without realizing, for example:
from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
price: Optional[float] = None
owner_ids: Optional[List[int]] = None
app = FastAPI()
@​app.get("/items/invalidnone", response_model=Item)
def get_invalid_none():
if flag:
return {"name": "foo"}
### if flag is False, at this point the function will implicitly return None
If you have path operations using response_model
that need to be allowed to return None
, make it explicit in response_model
using Union[Something, None]
:
from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
price: Optional[float] = None
owner_ids: Optional[List[int]] = None
app = FastAPI()
@​app.get("/items/invalidnone", response_model=Union[Item, None])
def get_invalid_none():
return 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
(or null
in JSON).
Fixes
-
⬆ Upgrade Swagger UI copy ofoauth2-redirect.html
to include fixes for flavors of authorization code flows in Swagger UI. MR #3439 initial MR by @koonpeng. -
♻ Strip empty whitespace from description extracted from docstrings. MR #2821 by @and-semakin. -
🐛 Fix cached dependencies when using a dependency inSecurity()
and other places (e.g.Depends()
) with different OAuth2 scopes. MR #2945 by @laggardkernel. -
🎨 Update type annotations forresponse_model
, allow things likeUnion[str, None]
. MR #5294 by @tiangolo.
Translations
-
🌐 Fix typos in German translation fordocs/de/docs/features.md
. MR #4533 by @0xflotus. -
🌐 Add missing navigator forencoder.md
in Korean translation. MR #5238 by @joonas-yoon. - (Empty MR merge by accident) #4913.
v0.79.1
Fixes
-
🐛 Fixjsonable_encoder
usinginclude
andexclude
parameters for non-Pydantic objects. MR #2606 by @xaviml. -
🐛 Fix edge case with repeated aliases names not shown in OpenAPI. MR #2351 by @klaa97. -
📝 Add misc dependency installs to tutorial docs. MR #2126 by @TeoZosa.
Docs
-
📝 Add note giving credit for illustrations to Ketrina Thompson. MR #5284 by @tiangolo. -
✏ Fix typo inpython-types.md
. MR #5116 by @Kludex. -
✏ Fix typo indocs/en/docs/python-types.md
. MR #5007 by @atiabbz. -
📝 Remove unneeded Django/Flask references from async topic intro. MR #5280 by @carltongibson. -
✨ Add illustrations for Concurrent burgers and Parallel burgers. MR #5277 by @tiangolo. Updated docs at: Concurrency and Burgers.
Translations
-
🌐 Add Portuguese translation fordocs/pt/docs/tutorial/query-params.md
. MR #4775 by @batlopes. -
🌐 Add Portuguese translation fordocs/pt/docs/tutorial/security/first-steps.md
. MR #4954 by @FLAIR7. -
🌐 Add translation fordocs/zh/docs/advanced/response-cookies.md
. MR #4638 by @zhangbo2012. -
🌐 Add French translation fordocs/fr/docs/deployment/index.md
. MR #3689 by @rjNemo. -
🌐 Add Portuguese translation fortutorial/handling-errors.md
. MR #4769 by @frnsimoes. -
🌐 Add French translation fordocs/fr/docs/history-design-future.md
. MR #3451 by @rjNemo. -
🌐 Add Russian translation fordocs/ru/docs/tutorial/background-tasks.md
. MR #4854 by @AdmiralDesu. -
🌐 Add Chinese translation fordocs/tutorial/security/first-steps.md
. MR #3841 by @jaystone776. -
🌐 Add Japanese translation fordocs/ja/docs/advanced/nosql-databases.md
. MR #4205 by @sUeharaE4. -
🌐 Add Indonesian translation fordocs/id/docs/tutorial/index.md
. MR #4705 by @bas-baskara. -
🌐 Add Persian translation fordocs/fa/docs/index.md
and tweak right-to-left CSS. MR #2395 by @mohsen-mahmoodi.
Internal
-
🔧 Update Jina sponsorship. MR #5283 by @tiangolo. -
🔧 Update Jina sponsorship. MR #5272 by @tiangolo. -
🔧 Update sponsors, Striveworks badge. MR #5179 by @tiangolo.
v0.79.0
Fixes - Breaking Changes
-
🐛 Fix removing body from status codes that do not support it. MR #5145 by @tiangolo.- Setting
status_code
to204
,304
, or any code below200
(1xx) will remove the body from the response. - This fixes an error in Uvicorn that otherwise would be thrown:
RuntimeError: Response content longer than Content-Length
. - This removes
fastapi.openapi.constants.STATUS_CODES_WITH_NO_BODY
, it is replaced by a function in utils.
- Setting
Translations
-
🌐 Start of Hebrew translation. MR #5050 by @itay-raveh. -
🔧 Add config for Swedish translations notification. MR #5147 by @tiangolo. -
🌐 Start of Swedish translation. MR #5062 by @MrRawbin. -
🌐 Add Japanese translation fordocs/ja/docs/advanced/index.md
. MR #5043 by @wakabame. -
🌐 🇵🇱 Add Polish translation fordocs/pl/docs/tutorial/first-steps.md
. MR #5024 by @Valaraucoo.
Internal
-
🔧 Update translations notification for Hebrew. MR #5158 by @tiangolo. -
🔧 Update Dependabot commit message. MR #5156 by @tiangolo. -
⬆ Bump actions/upload-artifact from 2 to 3. MR #5148 by @dependabot[bot]. -
⬆ Bump actions/cache from 2 to 3. MR #5149 by @dependabot[bot]. -
🔧 Update sponsors badge configs. MR #5155 by @tiangolo. -
👥 Update FastAPI People. MR #5154 by @tiangolo. -
🔧 Update Jina sponsor badges. MR #5151 by @tiangolo. -
⬆ Bump actions/checkout from 2 to 3. MR #5133 by @dependabot[bot]. -
⬆ [pre-commit.ci] pre-commit autoupdate. MR #5030 by @pre-commit-ci[bot]. -
⬆ Bump nwtgck/actions-netlify from 1.1.5 to 1.2.3. MR #5132 by @dependabot[bot]. -
⬆ Bump codecov/codecov-action from 2 to 3. MR #5131 by @dependabot[bot]. -
⬆ Bump dawidd6/action-download-artifact from 2.9.0 to 2.21.1. MR #5130 by @dependabot[bot]. -
⬆ Bump actions/setup-python from 2 to 4. MR #5129 by @dependabot[bot]. -
👷 Add Dependabot. MR #5128 by @tiangolo. -
♻ ️ Move fromOptional[X]
toUnion[X, None]
for internal utils. MR #5124 by @tiangolo. -
🔧 Update sponsors, remove Dropbase, add Doist. MR #5096 by @tiangolo. -
🔧 Update sponsors, remove Classiq, add ImgWhale. MR #5079 by @tiangolo.
v0.78.0
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. MR #4906 by @tiangolo.
Up to now, declaring a required parameter while adding additional validation or metadata needed using ...
(Ellipsis).
For example:
from fastapi import Cookie, FastAPI, Header, Path, Query
app = FastAPI()
@​app.get("/items/{item_id}")
def main(
item_id: int = Path(default=..., gt=0),
query: str = Query(default=..., max_length=10),
session: str = Cookie(default=..., min_length=3),
x_trace: str = Header(default=..., title="Tracing header"),
):
return {"message": "Hello World"}
...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.
from fastapi import Cookie, FastAPI, Header, Path, Query
app = FastAPI()
@​app.get("/items/{item_id}")
def main(
item_id: int = Path(gt=0),
query: str = Query(max_length=10),
session: str = Cookie(min_length=3),
x_trace: str = Header(title="Tracing header"),
):
return {"message": "Hello World"}
To declare parameters as optional (not required), you can set a default value as always, for example using None
:
from typing import Union
from fastapi import Cookie, FastAPI, Header, Path, Query
app = FastAPI()
@​app.get("/items/{item_id}")
def main(
item_id: int = Path(gt=0),
query: Union[str, None] = Query(default=None, max_length=10),
session: Union[str, None] = Cookie(default=None, min_length=3),
x_trace: Union[str, None] = Header(default=None, title="Tracing header"),
):
return {"message": "Hello World"}
Docs
-
📝 Add docs recommendingUnion
overOptional
and migrate source examples. New docs at Python Types Intro - UsingUnion
orOptional
. MR #4908 by @tiangolo. -
🎨 Fix default value as set in tutorial for Path Operations Advanced Configurations. MR #4899 by @tiangolo. -
📝 Add documentation for redefined path operations. MR #4864 by @madkinsz. -
📝 Updates links for Celery documentation. MR #4736 by @sammyzord. -
✏ Fix example code with sets in tutorial for body nested models. MR #3030 by @hitrust. -
✏ Fix links to Pydantic docs. MR #4670 by @kinuax. -
📝 Update docs about Swagger UI self-hosting with newer source links. MR #4813 by @Kastakin. -
📝 Add link to external article: Building the Poll App From Django Tutorial With FastAPI And React. MR #4778 by @jbrocher. -
📝 Add OpenAPI warning to "Body - Fields" docs with extra schema extensions. MR #4846 by @ml-evs.
Translations
-
🌐 Fix code examples in Japanese translation fordocs/ja/docs/tutorial/testing.md
. MR #4623 by @hirotoKirimaru.
Internal
-
♻ Refactor dict value extraction to minimize key lookupsfastapi/utils.py
. MR #3139 by @ShahriyarR. -
✅ Add tests for required nonable parameters and body fields. MR #4907 by @tiangolo. -
👷 Fix installing Material for MkDocs Insiders in CI. MR #4897 by @tiangolo. -
👷 Add pre-commit CI instead of custom GitHub Action. MR #4896 by @tiangolo. -
👷 Add pre-commit GitHub Action workflow. MR #4895 by @tiangolo. -
📝 Add dark mode auto switch to docs based on OS preference. MR #4869 by @ComicShrimp. -
🔥 Remove un-used old pending tests, already covered in other places. MR #4891 by @tiangolo. -
🔧 Add Python formatting hooks to pre-commit. MR #4890 by @tiangolo. -
🔧 Add pre-commit with first config and first formatting pass. MR #4888 by @tiangolo. -
👷 Disable CI installing Material for MkDocs in forks. MR #4410 by @dolfinus.
v0.77.1
Upgrades
Docs
-
📝 Add link to german article: REST-API Programmieren mittels Python und dem FastAPI Modul. MR #4624 by @fschuermeyer. -
📝 Add external link: PyCharm Guide to FastAPI. MR #4512 by @mukulmantosh. -
📝 Add external link to article: Building an API with FastAPI and Supabase and Deploying on Deta. MR #4440 by @aUnicornDev. -
✏ Fix small typo indocs/en/docs/tutorial/security/first-steps.md
. MR #4515 by @KikoIlievski.
Translations
-
🌐 Add Polish translation fordocs/pl/docs/tutorial/index.md
. MR #4516 by @MKaczkow. -
✏ Fix typo in deployment. MR #4629 by @raisulislam541. -
🌐 Add Portuguese translation fordocs/pt/docs/help-fastapi.md
. MR #4583 by @mateusjs.
Internal
-
🔧 Add notifications in issue for Uzbek translations. MR #4884 by @tiangolo.
v0.77.0
Upgrades
-
⬆ Upgrade Starlette from 0.18.0 to 0.19.0. MR #4488 by @Kludex.- When creating an explicit
JSONResponse
thecontent
argument is now required.
- When creating an explicit
Docs
-
📝 Add external link to article: Seamless FastAPI Configuration with ConfZ. MR #4414 by @silvanmelchior. -
📝 Add external link to article: 5 Advanced Features of FastAPI You Should Try. MR #4436 by @kaustubhgupta. -
✏ Reword to improve legibility of docs aboutTestClient
. MR #4389 by @rgilton. -
📝 Add external link to blog post about Kafka, FastAPI, and Ably. MR #4044 by @Ugbot. -
✏ Fix typo indocs/en/docs/tutorial/sql-databases.md
. MR #4875 by @wpyoga. -
✏ Fix typo indocs/en/docs/async.md
. MR #4726 by @Prezu.
Translations
-
🌐 Update source example highlights fordocs/zh/docs/tutorial/query-params-str-validations.md
. MR #4237 by @caimaoy. -
🌐 Remove translation docs references to aiofiles as it's no longer needed since AnyIO. MR #3594 by @alonme. -
✏ 🌐 Fix typo in Portuguese translation fordocs/pt/docs/tutorial/path-params.md
. MR #4722 by @CleoMenezesJr. -
🌐 Fix live docs server for translations for some languages. MR #4729 by @wakabame. -
🌐 Add Portuguese translation fordocs/pt/docs/tutorial/cookie-params.md
. MR #4112 by @lbmendes. -
🌐 Fix French translation fordocs/tutorial/body.md
. MR #4332 by @Smlep. -
🌐 Add Japanese translation fordocs/ja/docs/advanced/conditional-openapi.md
. MR #2631 by @sh0nk. -
🌐 Fix Japanese translation ofdocs/ja/docs/tutorial/body.md
. MR #3062 by @a-takahashi223. -
🌐 Add Portuguese translation fordocs/pt/docs/tutorial/background-tasks.md
. MR #2170 by @izaguerreiro. -
🌐 Add Portuguese translation fordocs/deployment/deta.md
. MR #4442 by @lsglucas. -
🌐 Add Russian translation fordocs/async.md
. MR #4036 by @Winand. -
🌐 Add Portuguese translation fordocs/tutorial/body.md
. MR #3960 by @leandrodesouzadev. -
🌐 Add Portuguese translation oftutorial/extra-data-types.md
. MR #4077 by @luccasmmg. -
🌐 Update German translation fordocs/features.md
. MR #3905 by @jomue.
v0.76.0
Upgrades
Internal
-
👥 Update FastAPI People. MR #4847 by @github-actions[bot]. -
🔧 Add Budget Insight sponsor. MR #4824 by @tiangolo. -
🍱 Update sponsor, ExoFlare badge. MR #4822 by @tiangolo. -
🔧 Update sponsors, enable Dropbase again, update TalkPython link. MR #4821 by @tiangolo.
v0.75.2
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
-
✅ Fix new/recent tests with new fixedValidationError
JSON Schema. MR #4806 by @tiangolo. -
🐛 Fix JSON Schema forValidationError
at fieldloc
. MR #3810 by @dconathan. -
🐛 Fix support for prefix on APIRouter WebSockets. MR #2640 by @Kludex.
Upgrades
-
⬆ ️ Update ujson ranges for CVE-2021-45958. MR #4804 by @tiangolo. -
⬆ ️ Upgrade dependencies upper range for extras "all". MR #4803 by @tiangolo. -
⬆ Upgrade Swagger UI - swagger-ui-dist@4. This handles a security issue in Swagger UI itself where it could be possible to inject HTML into Swagger UI. Please upgrade as soon as you can, in particular if you expose your Swagger UI (/docs
) publicly to non-expert users. MR #4347 by @RAlanWright.
Internal
-
🔧 Update sponsors, add: ExoFlare, Ines Course; remove: Dropbase, Vim.so, Calmcode; update: Striveworks, TalkPython and TestDriven.io. MR #4805 by @tiangolo. -
⬆ ️ Upgrade Codecov GitHub Action. MR #4801 by @tiangolo.
v0.75.1
Translations
-
🌐 Start Dutch translations. MR #4703 by @tiangolo. -
🌐 Start Persian/Farsi translations. MR #4243 by @aminalaee. -
✏ Reword sentence about handling errors. MR #1993 by @khuhroproeza.
Internal
-
👥 Update FastAPI People. MR #4752 by @github-actions[bot]. -
➖ Temporarily remove typer-cli from dependencies and upgrade Black to unblock Pydantic CI. MR #4754 by @tiangolo. -
🔧 Add configuration to notify Dutch translations. MR #4702 by @tiangolo. -
👥 Update FastAPI People. MR #4699 by @github-actions[bot]. -
🐛 Fix FastAPI People generation to include missing file in commit. MR #4695 by @tiangolo. -
🔧 Update Classiq sponsor links. MR #4688 by @tiangolo. -
🔧 Add Classiq sponsor. MR #4671 by @tiangolo. -
📝 Add Jina's QA Bot to the docs to help people that want to ask quick questions. MR #4655 by @tiangolo based on original MR #4626 by @hanxiao.
v0.75.0
Features
-
✨ Add support for customgenerate_unique_id_function
and docs for generating clients. New docs: Advanced - Generate Clients. MR #4650 by @tiangolo.
v0.74.1
Features
-
✨ Include route in scope to allow middleware and other tools to extract its information. MR #4603 by @tiangolo.
v0.74.0
Breaking Changes
-
✨ Update internalAsyncExitStack
to fix context for dependencies withyield
. MR #4575 by @tiangolo.
Dependencies with yield
can now catch HTTPException
and custom exceptions. For example:
async def get_database():
with Session() as session:
try:
yield session
except HTTPException:
session.rollback()
raise
finally:
session.close()
After the dependency with yield
handles the exception (or not) the exception is raised again. So that any exception handlers can catch it, or ultimately the default internal ServerErrorMiddleware
.
If you depended on exceptions not being received by dependencies with yield
, and receiving an exception breaks the code after yield
, you can use a block with try
and finally
:
async def do_something():
try:
yield something
finally:
some_cleanup()
...that way the finally
block is run regardless of any exception that might happen.
Features
- The same MR #4575 from above also fixes the
contextvars
context for the code before and afteryield
. This was the main objective of that MR.
This means that now, if you set a value in a context variable before yield
, the value would still be available after yield
(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:
from contextvars import ContextVar
from typing import Any, Dict, Optional
legacy_request_state_context_var: ContextVar[Optional[Dict[str, Any]]] = ContextVar(
"legacy_request_state_context_var", default=None
)
async def set_up_request_state_dependency():
request_state = {"user": "deadpond"}
contextvar_token = legacy_request_state_context_var.set(request_state)
yield request_state
legacy_request_state_context_var.reset(contextvar_token)
...before this change it would raise an error when resetting the context variable, because the contextvars
context 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's g
semi-global variable.
Technical Details: If you want to know more of the technical details you can check out the MR description #4575.
Internal
-
🔧 Add Striveworks sponsor. MR #4596 by @tiangolo. -
💚 Only build docs on push when on master to avoid duplicate runs from MRs. MR #4564 by @tiangolo. -
👥 Update FastAPI People. MR #4502 by @github-actions[bot].
v0.73.0
Features
-
✨ Add support for declaringUploadFile
parameters without explicitFile()
. MR #4469 by @tiangolo. New docs: Request Files - File Parameters with UploadFile. -
✨ Add support for tags with Enums. MR #4468 by @tiangolo. New docs: Path Operation Configuration - Tags with Enums. -
✨ Allow hiding from OpenAPI (and Swagger UI)Query
,Cookie
,Header
, andPath
parameters. MR #3144 by @astraldawn. New docs: Query Parameters and String Validations - Exclude from OpenAPI.
Docs
-
📝 Tweak and improve docs for Request Files. MR #4470 by @tiangolo.
Fixes
-
🐛 Fix bug preventing to use OpenAPI when using tuples. MR #3874 by @victorbenichoux. -
🐛 Prefer custom encoder over defaults if specified injsonable_encoder
. MR #2061 by @viveksunder.-
💚 Duplicate MR to trigger CI. MR #4467 by @tiangolo.
-
Internal
-
🐛 Fix docs dependencies cache, to get the latest Material for MkDocs. MR #4466 by @tiangolo. -
🔧 Add sponsor Dropbase. MR #4465 by @tiangolo.
v0.72.0
Features
-
✨ Enable configuring Swagger UI parameters. Original MR #2568 by @jmriebold. Here are the new docs: Configuring Swagger UI.
Docs
-
📝 Update Python Types docs, add missing 3.6 / 3.9 example. MR #4434 by @tiangolo.
Translations
-
🌐 Update Chinese translation fordocs/help-fastapi.md
. MR #3847 by @jaystone776. -
🌐 Fix Korean translation fordocs/ko/docs/index.md
. MR #4195 by @kty4119. -
🌐 Add Polish translation fordocs/pl/docs/index.md
. MR #4245 by @MicroPanda123. -
🌐 Add Chinese translation fordocs\tutorial\path-operation-configuration.md
. MR #3312 by @jaystone776.
Internal
-
🔧 Enable MkDocs Material Insiders'content.tabs.link
. MR #4399 by @tiangolo.
v0.71.0
Features
-
✨ Add docs and tests for Python 3.9 and Python 3.10. MR #3712 by @tiangolo.- You can start with Python Types Intro, it explains what changes between different Python versions, in Python 3.9 and in Python 3.10.
- All the FastAPI docs are updated. Each code example in the docs that could use different syntax in Python 3.9 or Python 3.10 now has all the alternatives in tabs.
-
⬆ ️ Upgrade Starlette to 0.17.1. MR #4145 by @simondale00.
Internal
-
👥 Update FastAPI People. MR #4354 by @github-actions[bot]. -
🔧 Add FastAPI Trove Classifier for PyPI as now there's one🤷 😁 . MR #4386 by @tiangolo. -
⬆ Upgrade MkDocs Material and configs. MR #4385 by @tiangolo.
v0.70.1
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
-
🐛 Fix JSON Schema for dataclasses, supporting the fixes in Pydantic 1.9. MR #4272 by @PrettyWood.
Translations
-
🌐 Add Korean translation fordocs/tutorial/request-forms-and-files.md
. MR #3744 by @NinaHwang. -
🌐 Add Korean translation fordocs/tutorial/request-files.md
. MR #3743 by @NinaHwang. -
🌐 Add portuguese translation fordocs/tutorial/query-params-str-validations.md
. MR #3965 by @leandrodesouzadev. -
🌐 Add Korean translation fordocs/tutorial/response-status-code.md
. MR #3742 by @NinaHwang. -
🌐 Add Korean translation for Tutorial - JSON Compatible Encoder. MR #3152 by @NEONKID. -
🌐 Add Korean translation for Tutorial - Path Parameters and Numeric Validations. MR #2432 by @hard-coders. -
🌐 Add Korean translation fordocs/ko/docs/deployment/versions.md
. MR #4121 by @DevDae. -
🌐 Fix Korean translation fordocs/ko/docs/tutorial/index.md
. MR #4193 by @kimjaeyoonn. -
🔧 Add CryptAPI sponsor. MR #4264 by @tiangolo. -
📝 Updatedocs/tutorial/dependencies/classes-as-dependencies
: Add type of query parameters in a description ofClasses as dependencies
. MR #4015 by @0417taehyun. -
🌐 Add French translation for Tutorial - First steps. MR #3455 by @Smlep. -
🌐 Add French translation fordocs/tutorial/path-params.md
. MR #3548 by @Smlep. -
🌐 Add French translation fordocs/tutorial/query-params.md
. MR #3556 by @Smlep. -
🌐 Add Turkish translation fordocs/python-types.md
. MR #3926 by @BilalAlpaslan.
Internal
-
👥 Update FastAPI People. MR #4274 by @github-actions[bot].
v0.70.0
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:
- First to FastAPI
0.68.2
, with no breaking changes, but upgrading all the sub-dependencies. - Next to FastAPI
0.69.0
, which upgrades Starlette to0.15.0
, with AnyIO support, and a higher chance of having breaking changes in your code. - Finally to FastAPI
0.70.0
, just upgrading Starlette to the latest version0.16.0
with 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
-
⬆ ️ Upgrade Starlette to 0.16.0. MR #4016 by @tiangolo.
Also upgrades the ranges of optional dependencies:
"jinja2 >=2.11.2,<4.0.0"
"itsdangerous >=1.1.0,<3.0.0"
v0.69.0
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 graphene
as 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
-
✨ Add support for Trio via AnyIO, upgrading Starlette to0.15.0
. MR #3372 by @graingert. -
➖ Removegraphene
as an optional dependency. MR #4007 by @tiangolo.
Docs
-
📝 Add docs for using Trio with Hypercorn. MR #4014 by @tiangolo. -
✏ Fix typos in Deployment Guide. MR #3975 by @ghandic. -
📝 Update docs with pip install calls when using extras with brackets, use quotes for compatibility with Zsh. MR #3131 by @tomwei7. -
📝 Add external link to article: Deploying ML Models as API Using FastAPI and Heroku. MR #3904 by @kaustubhgupta. -
✏ Fix typo in file paths indocs/en/docs/contributing.md
. MR #3752 by @NinaHwang. -
✏ Fix a typo indocs/en/docs/advanced/path-operation-advanced-configuration.md
anddocs/en/docs/release-notes.md
. MR #3750 by @saintmalik. -
✏ ️ Add a missing comma in the security tutorial. MR #3564 by @jalvaradosegura. -
✏ Fix typo indocs/en/docs/help-fastapi.md
. MR #3760 by @jaystone776. -
✏ Fix typo about file path indocs/en/docs/tutorial/bigger-applications.md
. MR #3285 by @HolyDorus. -
✏ Re-word to clarify test client indocs/en/docs/tutorial/testing.md
. MR #3382 by @Bharat123rox. -
📝 Fix incorrect highlighted code. MR #3325 by @paxcodes. -
📝 Add external link to article: How-to deploy FastAPI app to Heroku. MR #3241 by @Jarmos-san. -
✏ Fix typo (mistranslation) indocs/en/docs/advanced/templates.md
. MR #3211 by @oerpli. -
📝 Remove note about (now supported) feature from Swagger UI indocs/en/docs/tutorial/request-files.md
. MR #2803 by @gsganden. -
✏ Fix typo re-word indocs/tutorial/handling-errors.md
. MR #2700 by @graue70.
Translations
-
🌐 Initialize Azerbaijani translations. MR #3941 by @madatbay. -
🌐 Add Turkish translation fordocs/fastapi-people.md
. MR #3848 by @BilalAlpaslan.
Internal
-
📝 Add supported Python versions badge. MR #2794 by @hramezani. -
✏ Fix link in Japanese docs fordocs/ja/docs/deployment/docker.md
. MR #3245 by @utamori. -
🔧 Correct DeprecationWarning config and comment in pytest settings. MR #4008 by @graingert. -
🔧 Swap light/dark theme button icon. MR #3246 by @eddsalkield. -
🔧 Lint only in Python 3.7 and above. MR #4006 by @tiangolo. -
🔧 Add GitHub Action notify-translations config for Azerbaijani. MR #3995 by @tiangolo.
v0.68.2
This release has no breaking changes.
It upgrades the version ranges of sub-dependencies to allow applications using FastAPI to easily upgrade them.
Soon there will be a new FastAPI release upgrading Starlette to take advantage of recent improvements, but as that has a higher chance of having breaking changes, it will be in a separate release.
Features
-
⬆ Increase supported version of aiofiles to suppress warnings. MR #2899 by @SnkSynthesis. -
➖ Do not require backports in Python >= 3.7. MR #1880 by @FFY00. -
⬆ Upgrade required Python version to >= 3.6.1, needed by typing.Deque, used by Pydantic. MR #2733 by @hukkin. -
⬆ ️ Bump Uvicorn max range to 0.15.0. MR #3345 by @Kludex.
Docs
-
📝 Update GraphQL docs, recommend Strawberry. MR #3981 by @tiangolo. -
📝 Re-write and extend Deployment guide: Concepts, Uvicorn, Gunicorn, Docker, Containers, Kubernetes. MR #3974 by @tiangolo. -
📝 Upgrade HTTPS guide with more explanations and diagrams. MR #3950 by @tiangolo.
Translations
-
🌐 Add Turkish translation fordocs/features.md
. MR #1950 by @ycd. -
🌐 Add Turkish translation fordocs/benchmarks.md
. MR #2729 by @Telomeraz. -
🌐 Add Turkish translation fordocs/index.md
. MR #1908 by @ycd. -
🌐 Add French translation fordocs/tutorial/body.md
. MR #3671 by @Smlep. -
🌐 Add French translation fordeployment/docker.md
. MR #3694 by @rjNemo. -
🌐 Add Portuguese translation fordocs/tutorial/path-params.md
. MR #3664 by @FelipeSilva93. -
🌐 Add Portuguese translation fordocs/deployment/https.md
. MR #3754 by @lsglucas. -
🌐 Add German translation fordocs/features.md
. MR #3699 by @mawassk.
Internal
-
✨ Update GitHub Action: notify-translations, to avoid a race conditions. MR #3989 by @tiangolo. -
⬆ ️ Upgrade developmentautoflake
, supporting multi-line imports. MR #3988 by @tiangolo. -
⬆ ️ Increase dependency ranges for tests and docs: pytest-cov, pytest-asyncio, black, httpx, sqlalchemy, databases, mkdocs-markdownextradata-plugin. MR #3987 by @tiangolo. -
👥 Update FastAPI People. MR #3986 by @github-actions[bot]. -
💚 Fix badges in README and main page. MR #3979 by @ghandic. -
⬆ Upgrade internal testing dependencies: mypy to version 0.910, add newly needed type packages. MR #3350 by @ArcLightSlavik. -
✨ Add Deepset Sponsorship. MR #3976 by @tiangolo. -
🎨 Tweak CSS styles for shell animations. MR #3888 by @tiangolo. -
🔧 Add new Sponsor Calmcode.io. MR #3777 by @tiangolo.
v0.68.1
-
✨ Add support forread_with_orm_mode
, to support SQLModel relationship attributes. MR #3757 by @tiangolo.
Translations
-
🌐 Add Portuguese translation ofdocs/fastapi-people.md
. MR #3461 by @ComicShrimp. -
🌐 Add Chinese translation fordocs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
. MR #3492 by @jaystone776. -
🔧 Add new Translation tracking issues for German and Indonesian. MR #3718 by @tiangolo. -
🌐 Add Chinese translation fordocs/tutorial/dependencies/sub-dependencies.md
. MR #3491 by @jaystone776. -
🌐 Add Portuguese translation fordocs/advanced/index.md
. MR #3460 by @ComicShrimp. -
🌐 Portuguese translation ofdocs/async.md
. MR #1330 by @Serrones. -
🌐 Add French translation fordocs/async.md
. MR #3416 by @Smlep.
Internal
-
✨ Add GitHub Action: Notify Translations. MR #3715 by @tiangolo. -
✨ Update computation of FastAPI People and sponsors. MR #3714 by @tiangolo. -
✨ Enable recent Material for MkDocs Insiders features. MR #3710 by @tiangolo. -
🔥 Remove/clean extra imports from examples in docs for features. MR #3709 by @tiangolo. -
➕ Update docs library to include sources in Markdown. MR #3648 by @tiangolo. -
⬆ Enable tests for Python 3.9. MR #2298 by @Kludex. -
👥 Update FastAPI People. MR #3642 by @github-actions[bot].
v0.68.0
Features
-
✨ Add support for extensions and updates to the OpenAPI schema in each path operation. New docs: FastAPI Path Operation Advanced Configuration - OpenAPI Extra. Initial MR #1922 by @edouardlp. -
✨ Add additonal OpenAPI metadata parameters toFastAPI
class, shown on the automatic API docs UI. New docs: Metadata and Docs URLs. Initial MR #1812 by @dkreeft. -
✨ Adddescription
parameter to all the security scheme classes, e.g.APIKeyQuery(name="key", description="A very cool API key")
. MR #1757 by @hylkepostma. -
✨ Update OpenAPI models, supporting recursive models and extensions. MR #3628 by @tiangolo. -
✨ Import and re-export data structures from Starlette, used by Request properties, onfastapi.datastructures
. Initial MR #1872 by @jamescurtin.
Docs
-
📝 Update docs about async and response-model with more gender neutral language. MR #1869 by @Edward-Knight.
Translations
-
🌐 Add Russian translation fordocs/python-types.md
. MR #3039 by @dukkee. -
🌐 Add Chinese translation fordocs/tutorial/dependencies/index.md
. MR #3489 by @jaystone776. -
🌐 Add Russian translation fordocs/external-links.md
. MR #3036 by @dukkee. -
🌐 Add Chinese translation fordocs/tutorial/dependencies/global-dependencies.md
. MR #3493 by @jaystone776. -
🌐 Add Portuguese translation fordocs/deployment/versions.md
. MR #3618 by @lsglucas. -
🌐 Add Japanese translation fordocs/tutorial/security/oauth2-jwt.md
. MR #3526 by @sattosan.
Internal
-
✅ Add thedocs_src
directory to test coverage and update tests. Initial MR #1904 by @Kludex. -
🔧 Add new GitHub templates with forms for new issues. MR #3612 by @tiangolo. -
📝 Add official FastAPI Twitter to docs: @fastapi. MR #3578 by @tiangolo.
v0.67.0
Features
-
✨ Add support fordataclasses
in request bodies andresponse_model
. New documentation: Advanced User Guide - Using Dataclasses. MR #3577 by @tiangolo. -
✨ Supportdataclasses
in responses. MR #3576 by @tiangolo, continuation from initial MR #2722 by @amitlissack.
Docs
-
📝 Add external link: How to Create A Fake Certificate Authority And Generate TLS Certs for FastAPI. MR #2839 by @aitoehigie. -
✏ Fix code highlighted line in:body-nested-models.md
. MR #3463 by @jaystone776. -
✏ Fix typo inbody-nested-models.md
. MR #3462 by @jaystone776. -
✏ Fix typo "might me" -> "might be" indocs/en/docs/tutorial/schema-extra-example.md
. MR #3362 by @dbrakman. -
📝 Add external link: Building simple E-Commerce with NuxtJS and FastAPI. MR #3271 by @ShahriyarR. -
📝 Add external link: Serve a machine learning model using Sklearn, FastAPI and Docker. MR #2974 by @rodrigo-arenas. -
✏ ️ Fix typo on docstring in datastructures file. MR #2887 by @Kludex. -
📝 Add External Link: Deploy FastAPI on Ubuntu and Serve using Caddy 2 Web Server. MR #3572 by @tiangolo. -
📝 Add External Link, replaces #1898. MR #3571 by @tiangolo.
Internal
-
🎨 Improve style for sponsors, add radius border. MR #2388 by @Kludex. -
👷 Update GitHub Action latest-changes. MR #3574 by @tiangolo. -
👷 Update GitHub Action latest-changes. MR #3573 by @tiangolo. -
👷 Rename and clarify CI workflow job names. MR #3570 by @tiangolo. -
👷 Update GitHub Action latest-changes, strike 2⚾ . MR #3575 by @tiangolo. -
🔧 Sort external links in docs to have the most recent at the top. MR #3568 by @tiangolo.
v0.66.1
Translations
-
🌐 Add basic setup for German translations. MR #3522 by @0x4Dark. -
🌐 Add Portuguese translation fordocs/tutorial/security/index.md
. MR #3507 by @oandersonmagalhaes. -
🌐 Add Portuguese translation fordocs/deployment/index.md
. MR #3337 by @lsglucas.
Internal
-
🔧 Configure strict pytest options and update/refactor tests. Upgrade pytest to>=6.2.4,<7.0.0
and pytest-cov to>=2.12.0,<3.0.0
. Initial MR #2790 by @graingert. -
⬆ ️ Upgrade python-jose dependency to>=3.3.0,<4.0.0
for tests. MR #3468 by @tiangolo.
Configuration
-
If you want to rebase/retry this MR, click this checkbox.
This MR has been generated by Renovate Bot.