A utility that allows you to use DI in fastapi without Depends()

Overview

fastapi-better-di

What is this ?

fastapi-better-di is a utility that allows you to use DI in fastapi without Depends()

Installation

pip install fastapi_better_di

Examples

# app.py
import uvicorn
from fastapi import FastAPI
from fastapi_better_di.patcher.auto import is_pathed
# functions were patched immediately after import

assert is_pathed(), "Something went wrong"


class MyType:
    def __init__(self, value):
        self.value = value


app = FastAPI()
app.dependency_overrides[MyType] = lambda: MyType(123)


@app.get("/")
def handler(my_type: MyType):  # <- DI without `Depends()`
    assert my_type.value == 123
    return my_type


if __name__ == "__main__":
    uvicorn.run(app)

See all examples

Usage

  1. Patching:
    • Auto patching: patches classes when importing:

      from fastapi_better_di.patcher.auto import is_pathed # The classes were patched immediately after import
      
      # To check if everything is OK, use assert
      assert is_pathed(), "Something went wrong"
    • Manual patching: you need to call patch() by yourself:

      from fastapi_better_di.patcher.manual import patch, is_pathed
      
      patch()
      
      # To check if everything is OK, use assert
      assert is_pathed(), "Something went wrong"
    • Examples

  • IMPORTANT: You can still use = Depends() without a function as an argument, and it won't add unnecessary arguments to the swagger.

  • IMPORTANT: The main app(FastAPI) and dependency_overrides must be initialized before importing routers!

How it works

fastapi-better-di simply patch the handler function and add = Depends(func) as the default argument

Comments
  • build(deps): update fastapi requirement from <0.86.1 to <0.87.1

    build(deps): update fastapi requirement from <0.86.1 to <0.87.1

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.87.0

    Highlights of this release:

    • Upgraded Starlette
      • Now the TestClient is based on HTTPX instead of Requests. 🚀
      • There are some possible breaking changes in the TestClient usage, but @​Kludex built bump-testclient to help you automatize migrating your tests. Make sure you are using Git and that you can undo any unnecessary changes (false positive changes, etc) before using bump-testclient.
    • New WebSocketException (and docs), re-exported from Starlette.
    • Upgraded and relaxed dependencies for package extras all (including new Uvicorn version), when you install "fastapi[all]".
    • New docs about how to Help Maintain FastAPI.

    Features

    Docs

    Translations

    • 🌐 Fix highlight lines for Japanese translation for docs/tutorial/query-params.md. PR #2969 by @​ftnext.
    • 🌐 Add French translation for docs/fr/docs/advanced/additional-status-code.md. PR #5477 by @​axel584.
    • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/request-forms-and-files.md. PR #5579 by @​batlopes.
    • 🌐 Add Japanese translation for docs/ja/docs/advanced/websockets.md. PR #4983 by @​xryuseix.

    Internal

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • build(deps): update fastapi requirement from <0.82.1 to <0.83.1

    build(deps): update fastapi requirement from <0.82.1 to <0.83.1

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.83.0

    🚨 This is probably the last release (or one of the last releases) to support Python 3.6. 🔥

    Python 3.6 reached the end-of-life and is no longer supported by Python since around a year ago.

    You hopefully updated to a supported version of Python a while ago. If you haven't, you really should.

    Features

    • ✨ Add support in jsonable_encoder for include and exclude with dataclasses. PR #4923 by @​DCsunset.

    Fixes

    • 🐛 Fix RuntimeError raised when HTTPException has a status code with no content. PR #5365 by @​iudeen.
    • 🐛 Fix empty reponse body when default status_code is empty but the a Response parameter with response.status_code is set. PR #5360 by @​tmeckel.

    Docs

    Internal

    Commits
    • b2aa359 📝 Update release notes
    • ed0fcba 🔖 Release version 0.83.0
    • 22a155e 📝 Update release notes
    • 306326a 📝 Update release notes
    • 4fec12b 📝 Update SECURITY.md (#5377)
    • 275306c 📝 Update release notes
    • 4d27046 🐛Fix RuntimeError raised when HTTPException has a status code with no con...
    • 6620273 📝 Update release notes
    • 0b4fe10 🐛 Fix empty reponse body when default status_code is empty but the a `Respo...
    • c4007cb 📝 Update release notes
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • build(deps): update fastapi requirement from <0.79.2 to <0.80.1

    build(deps): update fastapi requirement from <0.79.2 to <0.80.1

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.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]:

    </tr></table> 
    

    ... (truncated)

    Commits
    • 7d6e707 🔖 Release version 0.80.0
    • 18819f9 📝 Update release notes
    • ad65e72 📝 Update release notes
    • ec072d7 ⬆ Upgrade Swagger UI copy of oauth2-redirect.html to include fixes for flav...
    • 09acce4 📝 Update release notes
    • f6808e7 ♻ Strip empty whitespace from description extracted from docstrings (#2821)
    • f8f5281 📝 Update release notes
    • b993b4a 🐛 Fix cached dependencies when using a dependency in Security() and other p...
    • 982911f 📝 Update release notes
    • 634cf22 🐛 Fix response_model not invalidating None (#2725)
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • build(deps): update fastapi requirement from <0.85.3 to <0.86.1

    build(deps): update fastapi requirement from <0.85.3 to <0.86.1

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.86.0

    Features

    Fixes

    • 🐛 Close FormData (uploaded files) after the request is done. PR #5465 by @​adriangb.

    Docs

    Translations

    • 🌐 Update wording in Chinese translation for docs/zh/docs/python-types.md. PR #5416 by @​supercaizehua.
    • 🌐 Add Russian translation for docs/ru/docs/deployment/index.md. PR #5336 by @​Xewus.
    • 🌐 Update Chinese translation for docs/tutorial/security/oauth2-jwt.md. PR #3846 by @​jaystone776.

    Internal

    Commits
    • ccd2423 🔖 Release version 0.86.0
    • 066cfae 📝 Update release notes
    • 51e768e 📝 Update release notes
    • 10fbfd6 ⬆ Add Python 3.11 to the officially supported versions (#5587)
    • 85e602d 📝 Update release notes
    • fbc13d1 📝 Update release notes
    • d4e2bdb ✏ Fix typo in docs/en/docs/tutorial/security/oauth2-jwt.md (#5584)
    • 8a5befd 📝 Update release notes
    • 9a442c9 👷 Update FastAPI People to exclude bots: pre-commit-ci, dependabot (#5586)
    • 4fa4965 📝 Update coverage badge to use Samuel Colvin's Smokeshow (#5585)
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • build(deps): update fastapi requirement from <0.85.2 to <0.85.3

    build(deps): update fastapi requirement from <0.85.2 to <0.85.3

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.85.2

    Note: this release doesn't affect final users, it's mainly internal. It unlocks Pydanitc work with the integration that runs FastAPI's tests in Pydantic's CI.

    Docs

    • ✏ Fix grammar and add helpful links to dependencies in docs/en/docs/async.md. PR #5432 by @​pamelafox.
    • ✏ Fix broken link in alternatives.md. PR #5455 by @​su-shubham.
    • ✏ Fix typo in docs about contributing, for compatibility with pip in Zsh. PR #5523 by @​zhangbo2012.
    • 📝 Fix typo in docs with examples for Python 3.10 instead of 3.9. PR #5545 by @​feliciss.

    Translations

    • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/request-forms.md. PR #4934 by @​batlopes.
    • 🌐 Add Chinese translation for docs/zh/docs/tutorial/dependencies/classes-as-dependencies.md. PR #4971 by @​Zssaer.
    • ?? Add French translation for deployment/deta.md. PR #3692 by @​rjNemo.
    • 🌐 Update Chinese translation for docs/zh/docs/tutorial/query-params-str-validations.md. PR #5255 by @​hjlarry.
    • 🌐 Add Chinese translation for docs/zh/docs/tutorial/sql-databases.md. PR #4999 by @​Zssaer.
    • 🌐 Add Chinese translation for docs/zh/docs/advanced/wsgi.md. PR #4505 by @​ASpathfinder.
    • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/body-multiple-params.md. PR #4111 by @​lbmendes.
    • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/path-params-numeric-validations.md. PR #4099 by @​lbmendes.
    • 🌐 Add French translation for deployment/versions.md. PR #3690 by @​rjNemo.
    • 🌐 Add French translation for docs/fr/docs/help-fastapi.md. PR #2233 by @​JulianMaurin.
    • 🌐 Fix typo in Chinese translation for docs/zh/docs/tutorial/security/first-steps.md. PR #5530 by @​yuki1sntSnow.
    • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/response-status-code.md. PR #4922 by @​batlopes.
    • 🔧 Add config for Tamil translations. PR #5563 by @​tiangolo.

    Internal

    Commits
    • d0917ce 🔖 Release version 0.85.2
    • 6002290 📝 Update release notes
    • e92a864 📝 Update release notes
    • c28337e 🌐 Add Portuguese translation for docs/pt/docs/tutorial/request-forms.md (#4...
    • f4aea58 📝 Update release notes
    • fcab59b 🌐 Add Chinese translation for `docs/zh/docs/tutorial/dependencies/classes-as-...
    • 6aa9ef0 📝 Update release notes
    • c7fe6fe 🌐 Add French translation for deployment/deta.md (#3692)
    • c53e5bd 📝 Update release notes
    • db4452d 🌐 Update Chinese translation for `docs/zh/docs/tutorial/query-params-str-vali...
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • build(deps): update fastapi requirement from <0.85.1 to <0.85.2

    build(deps): update fastapi requirement from <0.85.1 to <0.85.2

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.85.1

    Fixes

    • 🐛 Fix support for strings in OpenAPI status codes: default, 1XX, 2XX, 3XX, 4XX, 5XX. PR #5187 by @​JarroVGIT.

    Docs

    • 📝 Add WayScript x FastAPI Tutorial to External Links section. PR #5407 by @​moneeka.

    Internal

    Commits
    • 90fc429 🔖 Release version 0.85.1
    • a3a37a4 📝 Update release notes
    • 3c65284 👥 Update FastAPI People (#5447)
    • 5ba0c8c 📝 Update release notes
    • 0ae8db4 🐛 Fix support for strings in OpenAPI status codes: default, 1XX, 2XX, `...
    • 9c6086e 📝 Update release notes
    • ebe6991 🔧 Disable Material for MkDocs search plugin (#5495)
    • 81115db 📝 Update release notes
    • 1d18596 🔇 Ignore Trio warning in tests for CI (#5483)
    • c6aa28b 📝 Update release notes
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • build(deps): update fastapi requirement from <0.82.1 to <0.85.1

    build(deps): update fastapi requirement from <0.82.1 to <0.85.1

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.85.0

    Features

    • ⬆ Upgrade version required of Starlette from 0.19.1 to 0.20.4. Initial PR #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. PR #5401 by @​tiangolo.

    Internal

    • ⬆️ Upgrade dependencies for doc and dev internal extras: Typer, Uvicorn. PR #5400 by @​tiangolo.
    • ⬆️ Upgrade test dependencies: Black, HTTPX, databases, types-ujson. PR #5399 by @​tiangolo.
    • ⬆️ Upgrade mypy and tweak internal type annotations. PR #5398 by @​tiangolo.
    • 🔧 Update test dependencies, upgrade Pytest, move dependencies from dev to test. PR #5396 by @​tiangolo.
    Commits
    • 1213227 🔖 Release version 0.85.0
    • e782ba4 📝 Update release notes
    • 6ddd0c6 📝 Update release notes
    • a05e8b4 ⬆️ Upgrade Uvicorn in public extras: all (#5401)
    • e83aa43 📝 Update release notes
    • 95cbb43 ⬆️ Upgrade dependencies for doc and dev internal extras: Typer, Uvicorn (#5400)
    • babe2f9 📝 Update release notes
    • add7c48 ⬆️ Upgrade test dependencies: Black, HTTPX, databases, types-ujson (#5399)
    • b741ea7 📝 Update release notes
    • 74ce220 ⬆️ Upgrade mypy and tweak internal type annotations (#5398)
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • build(deps): update fastapi requirement from <0.81.1 to <0.82.1

    build(deps): update fastapi requirement from <0.81.1 to <0.82.1

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.82.0

    🚨 This is probably the last release (or one of the last releases) to support Python 3.6. 🔥

    Python 3.6 reached the end-of-life and is no longer supported by Python since around a year ago.

    You hopefully updated to a supported version of Python a while ago. If you haven't, you really should.

    Features

    • ✨ Export WebSocketState in fastapi.websockets. PR #4376 by @​matiuszka.
    • ✨ Support Python internal description on Pydantic model's docstring. PR #3032 by @​Kludex.
    • ✨ Update ORJSONResponse to support non str keys and serializing Numpy arrays. PR #3892 by @​baby5.

    Fixes

    • 🐛 Allow exit code for dependencies with yield to always execute, by removing capacity limiter for them, to e.g. allow closing DB connections without deadlocks. PR #5122 by @​adriangb.
    • 🐛 Fix FastAPI People GitHub Action: set HTTPX timeout for GraphQL query request. PR #5222 by @​iudeen.
    • 🐛 Make sure a parameter defined as required is kept required in OpenAPI even if defined as optional in another dependency. PR #4319 by @​cd17822.
    • 🐛 Fix support for path parameters in WebSockets. PR #3879 by @​davidbrochart.

    Docs

    • ✏ Update Hypercorn link, now pointing to GitHub. PR #5346 by @​baconfield.
    • ✏ Tweak wording in docs/en/docs/advanced/dataclasses.md. PR #3698 by @​pfackeldey.
    • 📝 Add note about Python 3.10 X | Y operator in explanation about Response Models. PR #5307 by @​MendyLanda.
    • 📝 Add link to New Relic article: "How to monitor FastAPI application performance using Python agent". PR #5260 by @​sjyothi54.
    • 📝 Update docs for ORJSONResponse with details about improving performance. PR #2615 by @​falkben.
    • 📝 Add docs for creating a custom Response class. PR #5331 by @​tiangolo.
    • 📝 Add tip about using alias for form data fields. PR #5329 by @​tiangolo.

    Translations

    • 🌐 Add Russian translation for docs/ru/docs/features.md. PR #5315 by @​Xewus.
    • 🌐 Update Chinese translation for docs/zh/docs/tutorial/request-files.md. PR #4529 by @​ASpathfinder.
    • 🌐 Add Chinese translation for docs/zh/docs/tutorial/encoder.md. PR #4969 by @​Zssaer.
    • 🌐 Fix MkDocs file line for Portuguese translation of background-task.md. PR #5242 by @​ComicShrimp.

    Internal

    Commits
    • 3079ba9 🔖 Release version 0.82.0
    • ddf6dae 📝 Update release notes
    • f3efaf6 📝 Update release notes
    • f8460a8 🐛 Allow exit code for dependencies with yield to always execute, by removin...
    • d0cc996 📝 Update release notes
    • c70fab3 👥 Update FastAPI People (#5347)
    • 80d68a6 📝 Update release notes
    • dacb689 ✨ Export WebSocketState in fastapi.websockets (#4376)
    • dd2f759 📝 Update release notes
    • 4cff206 🐛 Fix FastAPI People GitHub Action: set HTTPX timeout for GraphQL query reque...
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • build(deps): update fastapi requirement from <0.79.2 to <0.81.1

    build(deps): update fastapi requirement from <0.79.2 to <0.81.1

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.81.0

    Features

    • ✨ Add ReDoc <noscript> warning when JS is disabled. PR #5074 by @​evroon.
    • ✨ Add support for FrozenSet in parameters (e.g. query). PR #2938 by @​juntatalor.
    • ✨ Allow custom middlewares to raise HTTPExceptions and propagate them. PR #2036 by @​ghandic.
    • ✨ Preserve json.JSONDecodeError information when handling invalid JSON in request body, to support custom exception handlers that use its information. PR #4057 by @​UKnowWhoIm.

    Fixes

    • 🐛 Fix jsonable_encoder for dataclasses with pydantic-compatible fields. PR #3607 by @​himbeles.
    • 🐛 Fix support for extending openapi_extras with parameter lists. PR #4267 by @​orilevari.

    Docs

    • ✏ Fix a simple typo in docs/en/docs/python-types.md. PR #5193 by @​GlitchingCore.
    • ✏ Fix typos in tests/test_schema_extra_examples.py. PR #5126 by @​supraaxdd.
    • ✏ Fix typos in docs/en/docs/tutorial/path-params-numeric-validations.md. PR #5142 by @​invisibleroads.
    • 📝 Add step about upgrading pip in the venv to avoid errors when installing dependencies docs/en/docs/contributing.md. PR #5181 by @​edisnake.
    • ✏ Reword and clarify text in tutorial docs/en/docs/tutorial/body-nested-models.md. PR #5169 by @​papb.
    • ✏ Fix minor typo in docs/en/docs/features.md. PR #5206 by @​OtherBarry.
    • ✏ Fix minor typos in docs/en/docs/async.md. PR #5125 by @​Ksenofanex.
    • 📝 Add external link to docs: "Fastapi, Docker(Docker compose) and Postgres". PR #5033 by @​krishnardt.
    • 📝 Simplify example for docs for Additional Responses, remove unnecessary else. PR #4693 by @​adriangb.
    • 📝 Update docs, compare enums with identity instead of equality. PR #4905 by @​MicaelJarniac.
    • ✏ Fix typo in docs/en/docs/python-types.md. PR #4886 by @​MicaelJarniac.
    • 🎨 Fix syntax highlighting in docs for OpenAPI Callbacks. PR #4368 by @​xncbf.
    • ✏ Reword confusing sentence in docs file typo-fix-path-params-numeric-validations.md. PR #3219 by @​ccrenfroe.
    • 📝 Update docs for handling HTTP Basic Auth with secrets.compare_digest() to account for non-ASCII characters. PR #3536 by @​lewoudar.
    • 📝 Update docs for testing, fix examples with relative imports. PR #5302 by @​tiangolo.

    Translations

    • 🌐 Add Russian translation for docs/ru/docs/index.md. PR #5289 by @​impocode.
    • 🌐 Add Russian translation for docs/ru/docs/deployment/versions.md. PR #4985 by @​emp7yhead.
    • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/header-params.md. PR #4921 by @​batlopes.
    • 🌐 Update ko/mkdocs.yml for a missing link. PR #5020 by @​dalinaum.

    Internal

    ... (truncated)

    Commits
    • 0bb8920 🔖 Release version 0.81.0
    • 95c182a 📝 Update release notes
    • 165d57d 📝 Update release notes
    • ae5280e ✏ Fix a simple typo in docs/en/docs/python-types.md (#5193)
    • d4b2ef8 📝 Update release notes
    • fd2080a 🌐 Add Russian translation for docs/ru/docs/index.md (#5289)
    • 3c8d8c3 📝 Update release notes
    • fa92dbf 🌐 Add Russian translation for docs/ru/docs/deployment/versions.md (#4985)
    • cd8854c 📝 Update release notes
    • b63398f 🌐 Add Portuguese translation for docs/pt/docs/tutorial/header-params.md (#4...
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • build(deps): update fastapi requirement from <0.79.1 to <0.79.2

    build(deps): update fastapi requirement from <0.79.1 to <0.79.2

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.79.1

    Fixes

    • 🐛 Fix jsonable_encoder using include and exclude parameters for non-Pydantic objects. PR #2606 by @​xaviml.
    • 🐛 Fix edge case with repeated aliases names not shown in OpenAPI. PR #2351 by @​klaa97.
    • 📝 Add misc dependency installs to tutorial docs. PR #2126 by @​TeoZosa.

    Docs

    Translations

    • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/query-params.md. PR #4775 by @​batlopes.
    • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/security/first-steps.md. PR #4954 by @​FLAIR7.
    • 🌐 Add translation for docs/zh/docs/advanced/response-cookies.md. PR #4638 by @​zhangbo2012.
    • 🌐 Add French translation for docs/fr/docs/deployment/index.md. PR #3689 by @​rjNemo.
    • 🌐 Add Portuguese translation for tutorial/handling-errors.md. PR #4769 by @​frnsimoes.
    • 🌐 Add French translation for docs/fr/docs/history-design-future.md. PR #3451 by @​rjNemo.
    • 🌐 Add Russian translation for docs/ru/docs/tutorial/background-tasks.md. PR #4854 by @​AdmiralDesu.
    • 🌐 Add Chinese translation for docs/tutorial/security/first-steps.md. PR #3841 by @​jaystone776.
    • 🌐 Add Japanese translation for docs/ja/docs/advanced/nosql-databases.md. PR #4205 by @​sUeharaE4.
    • 🌐 Add Indonesian translation for docs/id/docs/tutorial/index.md. PR #4705 by @​bas-baskara.
    • 🌐 Add Persian translation for docs/fa/docs/index.md and tweak right-to-left CSS. PR #2395 by @​mohsen-mahmoodi.

    Internal

    Commits
    • ab8988f 🔖 Release version 0.79.1
    • 09381ba 📝 Update release notes
    • 767df02 📝 Update release notes
    • a21c315 📝 Add note giving credit for illustrations to Ketrina Thompson (#5284)
    • 7f0e2f6 📝 Update release notes
    • 94bbb91 📝 Update release notes
    • 2f9c6ab 🔧 Update Jina sponsorship (#5283)
    • 74638fc 📝 Update release notes
    • eb2e183 🐛 Fix jsonable_encoder using include and exclude parameters for non-Pyd...
    • 8a9a117 📝 Update release notes
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • build(deps): update fastapi requirement from <0.78.1 to <0.79.1

    build(deps): update fastapi requirement from <0.78.1 to <0.79.1

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.79.0

    Fixes - Breaking Changes

    • 🐛 Fix removing body from status codes that do not support it. PR #5145 by @​tiangolo.
      • Setting status_code to 204, 304, or any code below 200 (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.

    Translations

    Internal

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • build(deps): update fastapi requirement from <0.86.1 to <0.88.1

    build(deps): update fastapi requirement from <0.86.1 to <0.88.1

    Updates the requirements on fastapi to permit the latest version.

    Release notes

    Sourced from fastapi's releases.

    0.88.0

    Upgrades

    • ⬆ Bump Starlette to version 0.22.0 to fix bad encoding for query parameters in new TestClient. PR #5659 by @​azogue.

    Docs

    Translations

    • 🌐 Add Portuguese translation for docs/pt/docs/deployment/docker.md. PR #5663 by @​ayr-ton.

    Internal

    Commits
    • 612b8ff 🔖 Release version 0.88.0
    • 46bb5d2 📝 Update release notes
    • c458ca6 📝 Update release notes
    • 46974c5 ⬆ Bump Starlette to version 0.22.0 to fix bad encoding for query parameters...
    • 89ec1f2 📝 Update release notes
    • 128c925 📝 Update release notes
    • 8842036 👷 Tweak build-docs to improve CI performance (#5699)
    • 9b4e85f ⬆ [pre-commit.ci] pre-commit autoupdate (#5566)
    • 991db7b 📝 Update release notes
    • ebd917a 🌐 Add Portuguese translation for docs/pt/docs/deployment/docker.md (#5663)
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
Releases(0.3.4)
  • 0.3.4(Nov 12, 2022)

    What's Changed

    • build(deps): update fastapi requirement from <0.85.3 to <0.86.1 by @dependabot in https://github.com/MaximZayats/fastapi-better-di/pull/15
    • feat(ci): update ci & add python3.11 tests by @MaximZayats in https://github.com/MaximZayats/fastapi-better-di/pull/16

    Full Changelog: https://github.com/MaximZayats/fastapi-better-di/compare/0.3.3...0.3.4

    Source code(tar.gz)
    Source code(zip)
  • 0.3.3(Nov 1, 2022)

    What's Changed

    • build(deps): update fastapi requirement from <0.85.2 to <0.85.3 by @dependabot in https://github.com/MaximZayats/fastapi-better-di/pull/14

    Full Changelog: https://github.com/MaximZayats/fastapi-better-di/compare/0.3.2...0.3.3

    Source code(tar.gz)
    Source code(zip)
  • 0.3.2(Oct 18, 2022)

    What's Changed

    • build(deps): update fastapi requirement from <=0.75.1 to <0.85.2 by @dependabot

    Full Changelog: https://github.com/MaximZayats/fastapi-better-di/commits/0.3.2

    Source code(tar.gz)
    Source code(zip)
Owner
Maxim
Maxim
Middleware for Starlette that allows you to store and access the context data of a request. Can be used with logging so logs automatically use request headers such as x-request-id or x-correlation-id.

starlette context Middleware for Starlette that allows you to store and access the context data of a request. Can be used with logging so logs automat

Tomasz Wójcik 300 Dec 26, 2022
Middleware for Starlette that allows you to store and access the context data of a request. Can be used with logging so logs automatically use request headers such as x-request-id or x-correlation-id.

starlette context Middleware for Starlette that allows you to store and access the context data of a request. Can be used with logging so logs automat

Tomasz Wójcik 110 Feb 16, 2021
:rocket: CLI tool for FastAPI. Generating new FastAPI projects & boilerplates made easy.

Project generator and manager for FastAPI. Source Code: View it on Github Features ?? Creates customizable project boilerplate. Creates customizable a

Yagiz Degirmenci 1k Jan 2, 2023
Simple FastAPI Example : Blog API using FastAPI : Beginner Friendly

fastapi_blog FastAPI : Simple Blog API with CRUD operation Steps to run the project: git clone https://github.com/mrAvi07/fastapi_blog.git cd fastapi-

Avinash Alanjkar 1 Oct 8, 2022
Пример использования GraphQL Ariadne с FastAPI и сравнение его с GraphQL Graphene FastAPI

FastAPI Ariadne Example Пример использования GraphQL Ariadne с FastAPI и сравнение его с GraphQL Graphene FastAPI - GitHub ###Запуск на локальном окру

ZeBrains Team 9 Nov 10, 2022
Flask-vs-FastAPI - Understanding Flask vs FastAPI Web Framework. A comparison of two different RestAPI frameworks.

Flask-vs-FastAPI Understanding Flask vs FastAPI Web Framework. A comparison of two different RestAPI frameworks. IntroductionIn Flask is a popular mic

Mithlesh Navlakhe 1 Jan 1, 2022
FastAPI Server Session is a dependency-based extension for FastAPI that adds support for server-sided session management

FastAPI Server-sided Session FastAPI Server Session is a dependency-based extension for FastAPI that adds support for server-sided session management.

DevGuyAhnaf 5 Dec 23, 2022
fastapi-admin2 is an upgraded fastapi-admin, that supports ORM dialects, true Dependency Injection and extendability

FastAPI2 Admin Introduction fastapi-admin2 is an upgraded fastapi-admin, that supports ORM dialects, true Dependency Injection and extendability. Now

Glib 14 Dec 5, 2022
Code Specialist 27 Oct 16, 2022
Fastapi-ml-template - Fastapi ml template with python

FastAPI ML Template Run Web API Local $ sh run.sh # poetry run uvicorn app.mai

Yuki Okuda 29 Nov 20, 2022
FastAPI-Amis-Admin is a high-performance, efficient and easily extensible FastAPI admin framework. Inspired by django-admin, and has as many powerful functions as django-admin.

简体中文 | English 项目介绍 FastAPI-Amis-Admin fastapi-amis-admin是一个拥有高性能,高效率,易拓展的fastapi管理后台框架. 启发自Django-Admin,并且拥有不逊色于Django-Admin的强大功能. 源码 · 在线演示 · 文档 · 文

AmisAdmin 318 Dec 31, 2022
A FastAPI WebSocket application that makes use of ncellapp package by @hemantapkh

ncellFastAPI author: @awebisam Used FastAPI to create WS application. Ncellapp module by @hemantapkh NOTE: Not following best practices and, needs ref

Aashish Bhandari 7 Oct 1, 2021
A dynamic FastAPI router that automatically creates CRUD routes for your models

⚡ Create CRUD routes with lighting speed ⚡ A dynamic FastAPI router that automatically creates CRUD routes for your models

Adam Watkins 950 Jan 8, 2023
Adds simple SQLAlchemy support to FastAPI

FastAPI-SQLAlchemy FastAPI-SQLAlchemy provides a simple integration between FastAPI and SQLAlchemy in your application. It gives access to useful help

Michael Freeborn 465 Jan 7, 2023
Opinionated set of utilities on top of FastAPI

FastAPI Contrib Opinionated set of utilities on top of FastAPI Free software: MIT license Documentation: https://fastapi-contrib.readthedocs.io. Featu

identix.one 543 Jan 5, 2023
Reusable utilities for FastAPI

Reusable utilities for FastAPI Documentation: https://fastapi-utils.davidmontague.xyz Source Code: https://github.com/dmontagu/fastapi-utils FastAPI i

David Montague 1.3k Jan 4, 2023
This code generator creates FastAPI app from an openapi file.

fastapi-code-generator This code generator creates FastAPI app from an openapi file. This project is an experimental phase. fastapi-code-generator use

Koudai Aono 632 Jan 5, 2023
FastAPI framework plugins

Plugins for FastAPI framework, high performance, easy to learn, fast to code, ready for production fastapi-plugins FastAPI framework plugins Cache Mem

RES 239 Dec 28, 2022
Prometheus exporter for Starlette and FastAPI

starlette_exporter Prometheus exporter for Starlette and FastAPI. The middleware collects basic metrics: Counter: starlette_requests_total Histogram:

Steve Hillier 225 Jan 5, 2023