Skip to content

Update dependency fastapi to <0.116#3

Open
mend-for-github-com[bot] wants to merge 1 commit intomasterfrom
whitesource-remediate/fastapi-0.x
Open

Update dependency fastapi to <0.116#3
mend-for-github-com[bot] wants to merge 1 commit intomasterfrom
whitesource-remediate/fastapi-0.x

Conversation

@mend-for-github-com
Copy link
Copy Markdown
Contributor

@mend-for-github-com mend-for-github-com Bot commented Dec 23, 2022

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
fastapi (changelog) <0.86 -> <0.116 age adoption passing confidence

Release Notes

fastapi/fastapi (fastapi)

v0.115.0

Compare Source

Highlights

Now you can declare Query, Header, and Cookie parameters with Pydantic models. 🎉

Query Parameter Models

Use Pydantic models for Query parameters:

from typing import Annotated, Literal

from fastapi import FastAPI, Query
from pydantic import BaseModel, Field

app = FastAPI()

class FilterParams(BaseModel):
    limit: int = Field(100, gt=0, le=100)
    offset: int = Field(0, ge=0)
    order_by: Literal["created_at", "updated_at"] = "created_at"
    tags: list[str] = []

@&#8203;app.get("/items/")
async def read_items(filter_query: Annotated[FilterParams, Query()]):
    return filter_query

Read the new docs: Query Parameter Models.

Header Parameter Models

Use Pydantic models for Header parameters:

from typing import Annotated

from fastapi import FastAPI, Header
from pydantic import BaseModel

app = FastAPI()

class CommonHeaders(BaseModel):
    host: str
    save_data: bool
    if_modified_since: str | None = None
    traceparent: str | None = None
    x_tag: list[str] = []

@&#8203;app.get("/items/")
async def read_items(headers: Annotated[CommonHeaders, Header()]):
    return headers

Read the new docs: Header Parameter Models.

Cookie Parameter Models

Use Pydantic models for Cookie parameters:

from typing import Annotated

from fastapi import Cookie, FastAPI
from pydantic import BaseModel

app = FastAPI()

class Cookies(BaseModel):
    session_id: str
    fatebook_tracker: str | None = None
    googall_tracker: str | None = None

@&#8203;app.get("/items/")
async def read_items(cookies: Annotated[Cookies, Cookie()]):
    return cookies

Read the new docs: Cookie Parameter Models.

Forbid Extra Query (Cookie, Header) Parameters

Use Pydantic models to restrict extra values for Query parameters (also applies to Header and Cookie parameters).

To achieve it, use Pydantic's model_config = {"extra": "forbid"}:

from typing import Annotated, Literal

from fastapi import FastAPI, Query
from pydantic import BaseModel, Field

app = FastAPI()

class FilterParams(BaseModel):
    model_config = {"extra": "forbid"}

    limit: int = Field(100, gt=0, le=100)
    offset: int = Field(0, ge=0)
    order_by: Literal["created_at", "updated_at"] = "created_at"
    tags: list[str] = []

@&#8203;app.get("/items/")
async def read_items(filter_query: Annotated[FilterParams, Query()]):
    return filter_query

This applies to Query, Header, and Cookie parameters, read the new docs:

Features
  • ✨ Add support for Pydantic models for parameters using Query, Cookie, Header. PR #​12199 by @​tiangolo.
Translations
  • 🌐 Add Portuguese translation for docs/pt/docs/advanced/security/http-basic-auth.md. PR #​12195 by @​ceb10n.
Internal

v0.114.2

Compare Source

Fixes
Translations
Internal

v0.114.1

Compare Source

Refactors
  • ⚡️ Improve performance in request body parsing with a cache for internal model fields. PR #​12184 by @​tiangolo.
Docs
  • 📝 Remove duplicate line in docs for docs/en/docs/environment-variables.md. PR #​12169 by @​prometek.
Translations
Internal

v0.114.0

Compare Source

You can restrict form fields to only include those declared in a Pydantic model and forbid any extra field sent in the request using Pydantic's model_config = {"extra": "forbid"}:

from typing import Annotated

from fastapi import FastAPI, Form
from pydantic import BaseModel

app = FastAPI()

class FormData(BaseModel):
    username: str
    password: str
    model_config = {"extra": "forbid"}

@&#8203;app.post("/login/")
async def login(data: Annotated[FormData, Form()]):
    return data

Read the new docs: Form Models - Forbid Extra Form Fields.

Features
Docs
Internal
  • ✅ Update internal tests for latest Pydantic, including CI tweaks to install the latest Pydantic. PR #​12147 by @​tiangolo.

v0.113.0

Compare Source

Now you can declare form fields with Pydantic models:

from typing import Annotated

from fastapi import FastAPI, Form
from pydantic import BaseModel

app = FastAPI()

class FormData(BaseModel):
    username: str
    password: str

@&#8203;app.post("/login/")
async def login(data: Annotated[FormData, Form()]):
    return data

Read the new docs: Form Models.

Features
Internal

v0.112.4

Compare Source

This release is mainly a big internal refactor to enable adding support for Pydantic models for Form fields, but that feature comes in the next release.

This release shouldn't affect apps using FastAPI in any way. You don't even have to upgrade to this version yet. It's just a checkpoint. 🤓

Refactors
  • ♻️ Refactor deciding if embed body fields, do not overwrite fields, compute once per router, refactor internals in preparation for Pydantic models in Form, Query and others. PR #​12117 by @​tiangolo.
Internal
  • ⏪️ Temporarily revert "✨ Add support for Pydantic models in Form parameters" to make a checkpoint release. PR #​12128 by @​tiangolo.
  • ✨ Add support for Pydantic models in Form parameters. PR #​12127 by @​tiangolo. Reverted to make a checkpoint release with only refactors.

v0.112.3

Compare Source

This release is mainly internal refactors, it shouldn't affect apps using FastAPI in any way. You don't even have to upgrade to this version yet. There are a few bigger releases coming right after. 🚀

Refactors
  • ♻️ Refactor internal check_file_field(), rename to ensure_multipart_is_installed() to clarify its purpose. PR #​12106 by @​tiangolo.
  • ♻️ Rename internal create_response_field() to create_model_field() as it's used for more than response models. PR #​12103 by @​tiangolo.
  • ♻️ Refactor and simplify internal data from solve_dependencies() using dataclasses. PR #​12100 by @​tiangolo.
  • ♻️ Refactor and simplify internal analyze_param() to structure data with dataclasses instead of tuple. PR #​12099 by @​tiangolo.
  • ♻️ Refactor and simplify dependencies data structures with dataclasses. PR #​12098 by @​tiangolo.
Docs
Translations
Internal

v0.112.2

Compare Source

Fixes
Refactors
Docs
Translations
Internal

v0.112.1

Compare Source

Upgrades
Docs
Translations
  • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/bigger-applications.md. PR #​11971 by @​marcelomarkus.
  • 🌐 Add Portuguese translation for docs/pt/docs/advanced/testing-websockets.md. PR #​11994 by @​ceb10n.
  • 🌐 Add Portuguese translation for docs/pt/docs/advanced/testing-dependencies.md. PR #​11995 by @​ceb10n.
  • 🌐 Add Portuguese translation for docs/pt/docs/advanced/using-request-directly.md. PR #​11956 by @​ceb10n.
  • 🌐 Add French translation for docs/fr/docs/tutorial/body-multiple-params.md. PR #​11796 by @​pe-brian.
  • 🌐 Update Chinese translation for docs/zh/docs/tutorial/query-params.md. PR #​11557 by @​caomingpei.
  • 🌐 Update typo in Chinese translation for docs/zh/docs/advanced/testing-dependencies.md. PR #​11944 by @​bestony.
  • 🌐 Add Portuguese translation for docs/pt/docs/advanced/sub-applications.md and docs/pt/docs/advanced/behind-a-proxy.md. PR #​11856 by @​marcelomarkus.
  • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/cors.md and docs/pt/docs/tutorial/middleware.md. PR #​11916 by @​wesinalves.
  • 🌐 Add French translation for docs/fr/docs/tutorial/path-params-numeric-validations.md. PR #​11788 by @​pe-brian.
Internal

v0.112.0

Compare Source

Breaking Changes
  • ♻️ Add support for pip install "fastapi[standard]" with standard dependencies and python -m fastapi. PR #​11935 by @​tiangolo.
Summary

Install with:

pip install "fastapi[standard]"
Other Changes
  • This adds support for calling the CLI as:
python -m fastapi
  • And it upgrades fastapi-cli[standard] >=0.0.5.
Technical Details

Before this, fastapi would include the standard dependencies, with Uvicorn and the fastapi-cli, etc.

And fastapi-slim would not include those standard dependencies.

Now fastapi doesn't include those standard dependencies unless you install with pip install "fastapi[standard]".

Before, you would install pip install fastapi, now you should include the standard optional dependencies (unless you want to exclude one of those): pip install "fastapi[standard]".

This change is because having the standard optional dependencies installed by default was being inconvenient to several users, and having to install instead fastapi-slim was not being a feasible solution.

Discussed here: #​11522 and here: #​11525

Docs
Translations
Internal

v0.111.1

Compare Source

Upgrades
  • ➖ Remove orjson and ujson from default dependencies. PR #​11842 by @​tiangolo.
    • These dependencies are still installed when you install with pip install "fastapi[all]". But they not included in pip install fastapi.
  • 📝 Restored Swagger-UI links to use the latest version possible. PR #​11459 by @​UltimateLobster.
Docs
Translations
Internal

v0.111.0

Compare Source

Features

Try it out with:

$ pip install --upgrade fastapi

$ fastapi dev main.py

 ╭────────── FastAPI CLI - Development mode ───────────╮
 │                                                     │
 │  Serving at: http://127.0.0.1:8000                  │
 │                                                     │
 │  API docs: http://127.0.0.1:8000/docs               │
 │                                                     │
 │  Running in development mode, for production use:   │
 │                                                     │
 │  fastapi run                                        │
 │                                                     │
 ╰─────────────────────────────────────────────────────╯

INFO:     Will watch for changes in these directories: ['/home/user/code/awesomeapp']
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [2248755] using WatchFiles
INFO:     Started server process [2248757]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
Refactors
  • 🔧 Add configs and setup for fastapi-slim including optional extras fastapi-slim[standard], and fastapi including by default the same standard extras. PR #​11503 by @​tiangolo.

v0.110.3

Compare Source

Latest Changes

Docs
Translations
  • 🌐 Add Traditional Chinese translation for docs/zh-hant/benchmarks.md. PR #​11484 by @​KNChiu.
  • 🌐 Update Chinese translation for docs/zh/docs/fastapi-people.md. PR #​11476 by @​billzhong.
  • 🌐 Add Chinese translation for docs/zh/docs/how-to/index.md and docs/zh/docs/how-to/general.md. PR #​11443 by @​billzhong.
  • 🌐 Add Spanish translation for cookie-params docs/es/docs/tutorial/cookie-params.md. PR #​11410 by @​fabianfalon.
Internal

v0.110.2

Compare Source

Fixes

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.


  • If you want to rebase/retry this PR, check this box

@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 950bf77 to ace5b9e Compare January 7, 2023 17:27
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.89 Update dependency fastapi to <0.90 Jan 7, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from ace5b9e to 2f9f283 Compare February 8, 2023 16:32
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.90 Update dependency fastapi to <0.91 Feb 8, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 2f9f283 to 9fac539 Compare February 10, 2023 21:42
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.91 Update dependency fastapi to <0.92 Feb 10, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 9fac539 to 4434f34 Compare February 15, 2023 00:30
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.92 Update dependency fastapi to <0.93 Feb 15, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 4434f34 to 6425059 Compare March 7, 2023 20:50
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.93 Update dependency fastapi to <0.94 Mar 7, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 6425059 to 5c7172b Compare March 11, 2023 01:30
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.94 Update dependency fastapi to <0.95 Mar 11, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 5c7172b to 5b407d5 Compare March 19, 2023 01:19
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.95 Update dependency fastapi to <0.96 Mar 19, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 5b407d5 to c6af85d Compare June 3, 2023 20:48
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.96 Update dependency fastapi to <0.97 Jun 3, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from c6af85d to 39ef32c Compare June 12, 2023 06:12
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.97 Update dependency fastapi to <0.98 Jun 12, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 39ef32c to 5a0f59a Compare June 22, 2023 21:04
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.98 Update dependency fastapi to <0.99 Jun 22, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 5a0f59a to 5112c22 Compare June 30, 2023 20:40
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.99 Update dependency fastapi to <0.100 Jun 30, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 5112c22 to 019cdcf Compare July 7, 2023 20:37
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.100 Update dependency fastapi to <0.101 Jul 7, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 019cdcf to ef21c97 Compare August 5, 2023 02:19
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.101 Update dependency fastapi to <0.102 Aug 5, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from ef21c97 to b707bd7 Compare October 26, 2023 12:17
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.102 Update dependency fastapi to <0.105 Oct 26, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from b707bd7 to ed58240 Compare December 12, 2023 04:39
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.105 Update dependency fastapi to <0.106 Dec 12, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from ed58240 to 72272cb Compare December 26, 2023 04:13
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.106 Update dependency fastapi to <0.107 Dec 26, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 72272cb to f66a734 Compare December 27, 2023 05:20
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.107 Update dependency fastapi to <0.109 Dec 27, 2023
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from f66a734 to 8de3be2 Compare January 12, 2024 05:46
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.109 Update dependency fastapi to <0.110 Jan 12, 2024
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 8de3be2 to c3a6bf1 Compare February 25, 2024 04:53
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.110 Update dependency fastapi to <0.111 Feb 25, 2024
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from c3a6bf1 to e0ca560 Compare May 3, 2024 04:58
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.111 Update dependency fastapi to <0.112 May 3, 2024
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from e0ca560 to 55b7618 Compare August 2, 2024 06:16
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.112 Update dependency fastapi to <0.113 Aug 2, 2024
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 55b7618 to da2fc2a Compare September 6, 2024 05:52
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.113 Update dependency fastapi to <0.114 Sep 6, 2024
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from da2fc2a to 78fde5a Compare September 7, 2024 05:29
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.114 Update dependency fastapi to <0.115 Sep 7, 2024
@mend-for-github-com mend-for-github-com Bot force-pushed the whitesource-remediate/fastapi-0.x branch from 78fde5a to 6631208 Compare September 18, 2024 05:51
@mend-for-github-com mend-for-github-com Bot changed the title Update dependency fastapi to <0.115 Update dependency fastapi to <0.116 Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants