Fastapi

Latest version: v0.111.0

Safety actively analyzes 623704 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 31

0.96.1

Not secure
Fixes

* 🐛 Fix `HTTPException` header type annotations. PR [9648](https://github.com/tiangolo/fastapi/pull/9648) by [tiangolo](https://github.com/tiangolo).
* 🐛 Fix OpenAPI model fields int validations, `gte` to `ge`. PR [9635](https://github.com/tiangolo/fastapi/pull/9635) by [tiangolo](https://github.com/tiangolo).

Upgrades

* 📌 Update minimum version of Pydantic to >=1.7.4. This fixes an issue when trying to use an old version of Pydantic. PR [9567](https://github.com/tiangolo/fastapi/pull/9567) by [Kludex](https://github.com/Kludex).

Refactors

* ♻ Remove `media_type` from `ORJSONResponse` as it's inherited from the parent class. PR [5805](https://github.com/tiangolo/fastapi/pull/5805) by [Kludex](https://github.com/Kludex).
* ♻ Instantiate `HTTPException` only when needed, optimization refactor. PR [5356](https://github.com/tiangolo/fastapi/pull/5356) by [pawamoy](https://github.com/pawamoy).

Docs

* 🔥 Remove link to Pydantic's benchmark, as it was removed there. PR [5811](https://github.com/tiangolo/fastapi/pull/5811) by [Kludex](https://github.com/Kludex).

Translations

* 🌐 Fix spelling in Indonesian translation of `docs/id/docs/tutorial/index.md`. PR [5635](https://github.com/tiangolo/fastapi/pull/5635) by [purwowd](https://github.com/purwowd).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/index.md`. PR [5896](https://github.com/tiangolo/fastapi/pull/5896) by [Wilidon](https://github.com/Wilidon).
* 🌐 Add Chinese translations for `docs/zh/docs/advanced/response-change-status-code.md` and `docs/zh/docs/advanced/response-headers.md`. PR [9544](https://github.com/tiangolo/fastapi/pull/9544) by [ChoyeonChern](https://github.com/ChoyeonChern).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/schema-extra-example.md`. PR [9621](https://github.com/tiangolo/fastapi/pull/9621) by [Alexandrhub](https://github.com/Alexandrhub).

Internal

* 🔧 Add sponsor Platform.sh. PR [9650](https://github.com/tiangolo/fastapi/pull/9650) by [tiangolo](https://github.com/tiangolo).
* 👷 Add custom token to Smokeshow and Preview Docs for download-artifact, to prevent API rate limits. PR [9646](https://github.com/tiangolo/fastapi/pull/9646) by [tiangolo](https://github.com/tiangolo).
* 👷 Add custom tokens for GitHub Actions to avoid rate limits. PR [9647](https://github.com/tiangolo/fastapi/pull/9647) by [tiangolo](https://github.com/tiangolo).

0.96.0

Not secure
Features

* ⚡ Update `create_cloned_field` to use a global cache and improve startup performance. PR [4645](https://github.com/tiangolo/fastapi/pull/4645) by [madkinsz](https://github.com/madkinsz) and previous original PR by [huonw](https://github.com/huonw).

Docs

* 📝 Update Deta deployment tutorial for compatibility with Deta Space. PR [6004](https://github.com/tiangolo/fastapi/pull/6004) by [mikBighne98](https://github.com/mikBighne98).
* ✏️ Fix typo in Deta deployment tutorial. PR [9501](https://github.com/tiangolo/fastapi/pull/9501) by [lemonyte](https://github.com/lemonyte).

Translations

* 🌐 Add Russian translation for `docs/tutorial/body.md`. PR [3885](https://github.com/tiangolo/fastapi/pull/3885) by [solomein-sv](https://github.com/solomein-sv).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/static-files.md`. PR [9580](https://github.com/tiangolo/fastapi/pull/9580) by [Alexandrhub](https://github.com/Alexandrhub).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/query-params.md`. PR [9584](https://github.com/tiangolo/fastapi/pull/9584) by [Alexandrhub](https://github.com/Alexandrhub).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/first-steps.md`. PR [9471](https://github.com/tiangolo/fastapi/pull/9471) by [AGolicyn](https://github.com/AGolicyn).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/debugging.md`. PR [9579](https://github.com/tiangolo/fastapi/pull/9579) by [Alexandrhub](https://github.com/Alexandrhub).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/path-params.md`. PR [9519](https://github.com/tiangolo/fastapi/pull/9519) by [AGolicyn](https://github.com/AGolicyn).
* 🌐 Add Chinese translation for `docs/zh/docs/tutorial/static-files.md`. PR [9436](https://github.com/tiangolo/fastapi/pull/9436) by [wdh99](https://github.com/wdh99).
* 🌐 Update Spanish translation including new illustrations in `docs/es/docs/async.md`. PR [9483](https://github.com/tiangolo/fastapi/pull/9483) by [andresbermeoq](https://github.com/andresbermeoq).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/path-params-numeric-validations.md`. PR [9563](https://github.com/tiangolo/fastapi/pull/9563) by [ivan-abc](https://github.com/ivan-abc).
* 🌐 Add Russian translation for `docs/ru/docs/deployment/concepts.md`. PR [9577](https://github.com/tiangolo/fastapi/pull/9577) by [Xewus](https://github.com/Xewus).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/body-multiple-params.md`. PR [9586](https://github.com/tiangolo/fastapi/pull/9586) by [Alexandrhub](https://github.com/Alexandrhub).

Internal

* 👥 Update FastAPI People. PR [9602](https://github.com/tiangolo/fastapi/pull/9602) by [github-actions[bot]](https://github.com/apps/github-actions).
* 🔧 Update sponsors, remove InvestSuite. PR [9612](https://github.com/tiangolo/fastapi/pull/9612) by [tiangolo](https://github.com/tiangolo).

0.95.2

Not secure
* ⬆️ Upgrade Starlette version to `>=0.27.0` for a security release. PR [9541](https://github.com/tiangolo/fastapi/pull/9541) by [tiangolo](https://github.com/tiangolo). Details on [Starlette's security advisory](https://github.com/encode/starlette/security/advisories/GHSA-v5gw-mw7f-84px).

Translations

* 🌐 Add Portuguese translation for `docs/pt/docs/advanced/events.md`. PR [9326](https://github.com/tiangolo/fastapi/pull/9326) by [oandersonmagalhaes](https://github.com/oandersonmagalhaes).
* 🌐 Add Russian translation for `docs/ru/docs/deployment/manually.md`. PR [9417](https://github.com/tiangolo/fastapi/pull/9417) by [Xewus](https://github.com/Xewus).
* 🌐 Add setup for translations to Lao. PR [9396](https://github.com/tiangolo/fastapi/pull/9396) by [TheBrown](https://github.com/TheBrown).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/testing.md`. PR [9403](https://github.com/tiangolo/fastapi/pull/9403) by [Xewus](https://github.com/Xewus).
* 🌐 Add Russian translation for `docs/ru/docs/deployment/https.md`. PR [9428](https://github.com/tiangolo/fastapi/pull/9428) by [Xewus](https://github.com/Xewus).
* ✏ Fix command to install requirements in Windows. PR [9445](https://github.com/tiangolo/fastapi/pull/9445) by [MariiaRomanuik](https://github.com/MariiaRomanuik).
* 🌐 Add French translation for `docs/fr/docs/advanced/response-directly.md`. PR [9415](https://github.com/tiangolo/fastapi/pull/9415) by [axel584](https://github.com/axel584).
* 🌐 Initiate Czech translation setup. PR [9288](https://github.com/tiangolo/fastapi/pull/9288) by [3p1463k](https://github.com/3p1463k).
* ✏ Fix typo in Portuguese docs for `docs/pt/docs/index.md`. PR [9337](https://github.com/tiangolo/fastapi/pull/9337) by [lucasbalieiro](https://github.com/lucasbalieiro).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/response-status-code.md`. PR [9370](https://github.com/tiangolo/fastapi/pull/9370) by [nadia3373](https://github.com/nadia3373).

Internal

* 🐛 Fix `flask.escape` warning for internal tests. PR [9468](https://github.com/tiangolo/fastapi/pull/9468) by [samuelcolvin](https://github.com/samuelcolvin).
* ✅ Refactor 2 tests, for consistency and simplification. PR [9504](https://github.com/tiangolo/fastapi/pull/9504) by [tiangolo](https://github.com/tiangolo).
* ✅ Refactor OpenAPI tests, prepare for Pydantic v2. PR [9503](https://github.com/tiangolo/fastapi/pull/9503) by [tiangolo](https://github.com/tiangolo).
* ⬆ Bump dawidd6/action-download-artifact from 2.26.0 to 2.27.0. PR [9394](https://github.com/tiangolo/fastapi/pull/9394) by [dependabot[bot]](https://github.com/apps/dependabot).
* 💚 Disable setup-python pip cache in CI. PR [9438](https://github.com/tiangolo/fastapi/pull/9438) by [tiangolo](https://github.com/tiangolo).
* ⬆ Bump pypa/gh-action-pypi-publish from 1.6.4 to 1.8.5. PR [9346](https://github.com/tiangolo/fastapi/pull/9346) by [dependabot[bot]](https://github.com/apps/dependabot).

0.95.1

Not secure
Fixes

* 🐛 Fix using `Annotated` in routers or path operations decorated multiple times. PR [9315](https://github.com/tiangolo/fastapi/pull/9315) by [sharonyogev](https://github.com/sharonyogev).

Docs

* 🌐 🔠 📄 🐢 Translate docs to Emoji 🥳 🎉 💥 🤯 🤯. PR [5385](https://github.com/tiangolo/fastapi/pull/5385) by [LeeeeT](https://github.com/LeeeeT).
* 📝 Add notification message warning about old versions of FastAPI not supporting `Annotated`. PR [9298](https://github.com/tiangolo/fastapi/pull/9298) by [grdworkin](https://github.com/grdworkin).
* 📝 Fix typo in `docs/en/docs/advanced/behind-a-proxy.md`. PR [5681](https://github.com/tiangolo/fastapi/pull/5681) by [Leommjr](https://github.com/Leommjr).
* ✏ Fix wrong import from typing module in Persian translations for `docs/fa/docs/index.md`. PR [6083](https://github.com/tiangolo/fastapi/pull/6083) by [Kimiaattaei](https://github.com/Kimiaattaei).
* ✏️ Fix format, remove unnecessary asterisks in `docs/en/docs/help-fastapi.md`. PR [9249](https://github.com/tiangolo/fastapi/pull/9249) by [armgabrielyan](https://github.com/armgabrielyan).
* ✏ Fix typo in `docs/en/docs/tutorial/query-params-str-validations.md`. PR [9272](https://github.com/tiangolo/fastapi/pull/9272) by [nicornk](https://github.com/nicornk).
* ✏ Fix typo/bug in inline code example in `docs/en/docs/tutorial/query-params-str-validations.md`. PR [9273](https://github.com/tiangolo/fastapi/pull/9273) by [tim-habitat](https://github.com/tim-habitat).
* ✏ Fix typo in `docs/en/docs/tutorial/path-params-numeric-validations.md`. PR [9282](https://github.com/tiangolo/fastapi/pull/9282) by [aadarsh977](https://github.com/aadarsh977).
* ✏ Fix typo: 'wll' to 'will' in `docs/en/docs/tutorial/query-params-str-validations.md`. PR [9380](https://github.com/tiangolo/fastapi/pull/9380) by [dasstyxx](https://github.com/dasstyxx).

Translations

* 🌐 Add French translation for `docs/fr/docs/advanced/index.md`. PR [5673](https://github.com/tiangolo/fastapi/pull/5673) by [axel584](https://github.com/axel584).
* 🌐 Add Portuguese translation for `docs/pt/docs/tutorial/body-nested-models.md`. PR [4053](https://github.com/tiangolo/fastapi/pull/4053) by [luccasmmg](https://github.com/luccasmmg).
* 🌐 Add Russian translation for `docs/ru/docs/alternatives.md`. PR [5994](https://github.com/tiangolo/fastapi/pull/5994) by [Xewus](https://github.com/Xewus).
* 🌐 Add Portuguese translation for `docs/pt/docs/tutorial/extra-models.md`. PR [5912](https://github.com/tiangolo/fastapi/pull/5912) by [LorhanSohaky](https://github.com/LorhanSohaky).
* 🌐 Add Portuguese translation for `docs/pt/docs/tutorial/path-operation-configuration.md`. PR [5936](https://github.com/tiangolo/fastapi/pull/5936) by [LorhanSohaky](https://github.com/LorhanSohaky).
* 🌐 Add Russian translation for `docs/ru/docs/contributing.md`. PR [6002](https://github.com/tiangolo/fastapi/pull/6002) by [stigsanek](https://github.com/stigsanek).
* 🌐 Add Korean translation for `docs/tutorial/dependencies/classes-as-dependencies.md`. PR [9176](https://github.com/tiangolo/fastapi/pull/9176) by [sehwan505](https://github.com/sehwan505).
* 🌐 Add Russian translation for `docs/ru/docs/project-generation.md`. PR [9243](https://github.com/tiangolo/fastapi/pull/9243) by [Xewus](https://github.com/Xewus).
* 🌐 Add French translation for `docs/fr/docs/index.md`. PR [9265](https://github.com/tiangolo/fastapi/pull/9265) by [frabc](https://github.com/frabc).
* 🌐 Add Russian translation for `docs/ru/docs/tutorial/query-params-str-validations.md`. PR [9267](https://github.com/tiangolo/fastapi/pull/9267) by [dedkot01](https://github.com/dedkot01).
* 🌐 Add Russian translation for `docs/ru/docs/benchmarks.md`. PR [9271](https://github.com/tiangolo/fastapi/pull/9271) by [Xewus](https://github.com/Xewus).

Internal

* 🔧 Update sponsors: remove Jina. PR [9388](https://github.com/tiangolo/fastapi/pull/9388) by [tiangolo](https://github.com/tiangolo).
* 🔧 Update sponsors, add databento, remove Ines's course and StriveWorks. PR [9351](https://github.com/tiangolo/fastapi/pull/9351) by [tiangolo](https://github.com/tiangolo).

0.95.0

Not secure
Highlights

This release adds support for dependencies and parameters using `Annotated` and recommends its usage. ✨

This has **several benefits**, one of the main ones is that now the parameters of your functions with `Annotated` would **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 `Annotated` too, then you could use the same function for an API and a CLI), etc.

Because `Annotated` is **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 `Annotated` dependencies 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:

Python
def get_current_user(token: str):
authenticate user
return User()


app.get("/items/")
def read_items(user: User = Depends(get_current_user)):
...


app.post("/items/")
def create_item(*, user: User = Depends(get_current_user), item: Item):
...


app.get("/items/{item_id}")
def read_item(*, user: User = Depends(get_current_user), item_id: int):
...


app.delete("/items/{item_id}")
def delete_item(*, user: User = Depends(get_current_user), item_id: int):
...


There's a bit of code duplication for the dependency:

Python
user: User = Depends(get_current_user)


...the bigger the codebase, the more noticeable it is.

Now you can create an annotated dependency once, like this:

Python
CurrentUser = Annotated[User, Depends(get_current_user)]


And then you can reuse this `Annotated` dependency:

Python
CurrentUser = Annotated[User, Depends(get_current_user)]


app.get("/items/")
def read_items(user: CurrentUser):
...


app.post("/items/")
def create_item(user: CurrentUser, item: Item):
...


app.get("/items/{item_id}")
def read_item(user: CurrentUser, item_id: int):
...


app.delete("/items/{item_id}")
def delete_item(user: CurrentUser, item_id: int):
...


...and `CurrentUser` has all the typing information as `User`, so your editor will work as expected (autocompletion and everything), and **FastAPI** will be able to understand the dependency defined in `Annotated`. 😎

Roughly **all the docs** have been rewritten to use `Annotated` as the main way to declare **parameters** and **dependencies**. All the **examples** in the docs now include a version with `Annotated` and 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:

* Python Types Intro:
* [Type Hints with Metadata Annotations](https://fastapi.tiangolo.com/python-types/#type-hints-with-metadata-annotations).
* Tutorial:
* [Query Parameters and String Validations - Additional validation](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#additional-validation)
* [Advantages of `Annotated`](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#advantages-of-annotated)
* [Path Parameters and Numeric Validations - Order the parameters as you need, tricks](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#order-the-parameters-as-you-need-tricks)
* [Better with `Annotated`](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/#better-with-annotated)
* [Dependencies - First Steps - Share `Annotated` dependencies](https://fastapi.tiangolo.com/tutorial/dependencies/#share-annotated-dependencies)

Special thanks to [nzig](https://github.com/nzig) for the core implementation and to [adriangb](https://github.com/adriangb) for the inspiration and idea with [Xpresso](https://github.com/adriangb/xpresso)! 🚀

Features

* ✨Add support for PEP-593 `Annotated` for specifying dependencies and parameters. PR [4871](https://github.com/tiangolo/fastapi/pull/4871) by [nzig](https://github.com/nzig).

Docs

* 📝 Tweak tip recommending `Annotated` in docs. PR [9270](https://github.com/tiangolo/fastapi/pull/9270) by [tiangolo](https://github.com/tiangolo).
* 📝 Update order of examples, latest Python version first, and simplify version tab names. PR [9269](https://github.com/tiangolo/fastapi/pull/9269) by [tiangolo](https://github.com/tiangolo).
* 📝 Update all docs to use `Annotated` as the main recommendation, with new examples and tests. PR [9268](https://github.com/tiangolo/fastapi/pull/9268) by [tiangolo](https://github.com/tiangolo).

0.94.1

Not secure
Fixes

* 🎨 Fix types for lifespan, upgrade Starlette to 0.26.1. PR [9245](https://github.com/tiangolo/fastapi/pull/9245) by [tiangolo](https://github.com/tiangolo).

Page 6 of 31

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.