Fastapi

Latest version: v0.115.5

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

Scan your dependencies

Page 9 of 33

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).

0.94.0

Not secure
Upgrades

* ⬆ Upgrade python-multipart to support 0.0.6. PR [9212](https://github.com/tiangolo/fastapi/pull/9212) by [musicinmybrain](https://github.com/musicinmybrain).
* ⬆️ Upgrade Starlette version, support new `lifespan` with state. PR [9239](https://github.com/tiangolo/fastapi/pull/9239) by [tiangolo](https://github.com/tiangolo).

Docs

* 📝 Update Sentry link in docs. PR [9218](https://github.com/tiangolo/fastapi/pull/9218) by [smeubank](https://github.com/smeubank).

Translations

* 🌐 Add Russian translation for `docs/ru/docs/history-design-future.md`. PR [5986](https://github.com/tiangolo/fastapi/pull/5986) by [Xewus](https://github.com/Xewus).

Internal

* ➕ Add `pydantic` to PyPI classifiers. PR [5914](https://github.com/tiangolo/fastapi/pull/5914) by [yezz123](https://github.com/yezz123).
* ⬆ Bump black from 22.10.0 to 23.1.0. PR [5953](https://github.com/tiangolo/fastapi/pull/5953) by [dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump types-ujson from 5.6.0.0 to 5.7.0.1. PR [6027](https://github.com/tiangolo/fastapi/pull/6027) by [dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ Bump dawidd6/action-download-artifact from 2.24.3 to 2.26.0. PR [6034](https://github.com/tiangolo/fastapi/pull/6034) by [dependabot[bot]](https://github.com/apps/dependabot).
* ⬆ [pre-commit.ci] pre-commit autoupdate. PR [5709](https://github.com/tiangolo/fastapi/pull/5709) by [pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).

0.93.0

Not secure
Features

* ✨ Add support for `lifespan` async context managers (superseding `startup` and `shutdown` events). Initial PR [2944](https://github.com/tiangolo/fastapi/pull/2944) by [uSpike](https://github.com/uSpike).

Now, instead of using independent `startup` and `shutdown` events, you can define that logic in a single function with `yield` decorated with `asynccontextmanager` (an async context manager).

For example:

Python
from contextlib import asynccontextmanager

from fastapi import FastAPI


def fake_answer_to_everything_ml_model(x: float):
return x * 42


ml_models = {}


asynccontextmanager
async def lifespan(app: FastAPI):
Load the ML model
ml_models["answer_to_everything"] = fake_answer_to_everything_ml_model
yield
Clean up the ML models and release the resources
ml_models.clear()


app = FastAPI(lifespan=lifespan)


app.get("/predict")
async def predict(x: float):
result = ml_models["answer_to_everything"](x)
return {"result": result}


**Note**: This is the recommended way going forward, instead of using `startup` and `shutdown` events.

Read more about it in the new docs: [Advanced User Guide: Lifespan Events](https://fastapi.tiangolo.com/advanced/events/).

Docs

* ✏ Fix formatting in `docs/en/docs/tutorial/metadata.md` for `ReDoc`. PR [6005](https://github.com/tiangolo/fastapi/pull/6005) by [eykamp](https://github.com/eykamp).

Translations

* 🌐 Tamil translations - initial setup. PR [5564](https://github.com/tiangolo/fastapi/pull/5564) by [gusty1g](https://github.com/gusty1g).
* 🌐 Add French translation for `docs/fr/docs/advanced/path-operation-advanced-configuration.md`. PR [9221](https://github.com/tiangolo/fastapi/pull/9221) by [axel584](https://github.com/axel584).
* 🌐 Add French translation for `docs/tutorial/debugging.md`. PR [9175](https://github.com/tiangolo/fastapi/pull/9175) by [frabc](https://github.com/frabc).
* 🌐 Initiate Armenian translation setup. PR [5844](https://github.com/tiangolo/fastapi/pull/5844) by [har8](https://github.com/har8).
* 🌐 Add French translation for `deployment/manually.md`. PR [3693](https://github.com/tiangolo/fastapi/pull/3693) by [rjNemo](https://github.com/rjNemo).

Internal

* 👷 Update translation bot messages. PR [9206](https://github.com/tiangolo/fastapi/pull/9206) by [tiangolo](https://github.com/tiangolo).
* 👷 Update translations bot to use Discussions, and notify when a PR is done. PR [9183](https://github.com/tiangolo/fastapi/pull/9183) by [tiangolo](https://github.com/tiangolo).
* 🔧 Update sponsors-badges. PR [9182](https://github.com/tiangolo/fastapi/pull/9182) by [tiangolo](https://github.com/tiangolo).
* 👥 Update FastAPI People. PR [9181](https://github.com/tiangolo/fastapi/pull/9181) by [github-actions[bot]](https://github.com/apps/github-actions).
* 🔊 Log GraphQL errors in FastAPI People, because it returns 200, with a payload with an error. PR [9171](https://github.com/tiangolo/fastapi/pull/9171) by [tiangolo](https://github.com/tiangolo).
* 💚 Fix/workaround GitHub Actions in Docker with git for FastAPI People. PR [9169](https://github.com/tiangolo/fastapi/pull/9169) by [tiangolo](https://github.com/tiangolo).
* ♻️ Refactor FastAPI Experts to use only discussions now that questions are migrated. PR [9165](https://github.com/tiangolo/fastapi/pull/9165) by [tiangolo](https://github.com/tiangolo).
* ⬆️ Upgrade analytics. PR [6025](https://github.com/tiangolo/fastapi/pull/6025) by [tiangolo](https://github.com/tiangolo).
* ⬆️ Upgrade and re-enable installing Typer-CLI. PR [6008](https://github.com/tiangolo/fastapi/pull/6008) by [tiangolo](https://github.com/tiangolo).

Page 9 of 33

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.