Generate Class & Decorators for your FastAPI project ✨🚀

Overview

Fastapi-Class 🦜

codecov Downloads


Source Code: https://github.com/yezz123/fastapi-class

Install the project: pip install fastapi-class


Classes and Decorators to use FastAPI with class based routing. In particular this allows you to construct an instance of a class and have methods of that instance be route handlers for FastAPI & Python 3.8.

  • Older Versions of Python:
    • Unfortunately this does not work with async routes with Python versions less than 3.8 due to bugs in inspect.iscoroutinefunction. Specifically with older versions of Python iscoroutinefunction incorrectly returns false so async routes aren't await'd. We therefore only support Python versions >= 3.8.

Example 🐢

None: """Constructor. The pong is injected here.""" self.__pong = pong @get('/user/{name}') def get_user_by_name(name: str) -> User: # Use our injected pong instance. return self.__pong.get_user_by_name(name) @delete('/user/{name}') def delete_user(name: str) -> None: self.__pong.delete(name) def main(): args = parse_args() # Configure the pong per command line arguments pong = pong(args.url, args.user, args.password) # Simple intuitive injection user_routes = UserRoutes(pong) app = FastAPI() # router member inherited from Routable and configured per the annotations. app.include_router(user_routes.router) ">
from ping import pong
# Some fictional ping pong class
from fastapi_class import Routable, get, delete

def parse_arg() -> argparse.Namespace:
   """parse command line arguments."""
   ...


class UserRoutes(Routable):
   """Inherits from Routable."""

   # Note injection here by simply passing values to the constructor.
   # Other injection frameworks also work.
   # supported as there's nothing special about this __init__ method.
   def __init__(self, pong: pong) -> None:
      """Constructor. The pong is injected here."""
      self.__pong = pong

   @get('/user/{name}')
   def get_user_by_name(name: str) -> User:
      # Use our injected pong instance.
      return self.__pong.get_user_by_name(name)

   @delete('/user/{name}')
   def delete_user(name: str) -> None:
      self.__pong.delete(name)


def main():
    args = parse_args()
    # Configure the pong per command line arguments
    pong = pong(args.url, args.user, args.password)
    # Simple intuitive injection
    user_routes = UserRoutes(pong)

    app = FastAPI()
    # router member inherited from Routable and configured per the annotations.
    app.include_router(user_routes.router)

Why 🐣

FastAPI generally has one define routes like:

app = FastAPI()

@app.get('/echo/{x}')
def echo(x: int) -> int:
   return x

Note: that app is a global. Furthermore, FastAPI's suggested way of doing dependency injection is handy for things like pulling values out of header in the HTTP request. However, they don't work well for more standard dependency injection scenarios where we'd like to do something like inject a Data Access Object or database connection. For that, FastAPI suggests their parameterized dependencies which might look something like:

app = FastAPI()

class ValueToInject:
   # Value to inject into the function.
   def __init__(self, y: int) -> None:
      self.y = y

   def __call__(self) -> int:
      return self.y

to_add = ValueToInject(2)

@app.get('/add/{x}')
def add(x: int, y: Depends(to_add)) -> int:
   return x + y

Development 🚧

You should create a virtual environment and activate it:

python -m venv venv/
source venv/bin/activate

And then install the development dependencies:

pip install -r requirements.dev.txt

Format the code 💅

Execute the following command to apply pre-commit formatting:

make lint

License 🍻

This project is licensed under the terms of the MIT license.

Comments
  • Bump pytest from 7.1.0 to 7.1.1

    Bump pytest from 7.1.0 to 7.1.1

    Bumps pytest from 7.1.0 to 7.1.1.

    Release notes

    Sourced from pytest's releases.

    7.1.1

    pytest 7.1.1 (2022-03-17)

    Bug Fixes

    • #9767: Fixed a regression in pytest 7.1.0 where some conftest.py files outside of the source tree (e.g. in the [site-packages]{.title-ref} directory) were not picked up.
    Commits
    • 0ffe9e0 Prepare release version 7.1.1
    • 6f2c1ec Merge pull request #9784 from pytest-dev/backport-9768-to-7.1.x
    • a65c47a Merge pull request #9783 from pytest-dev/backport-9780-to-7.1.x
    • 30d995e [pre-commit.ci] auto fixes from pre-commit.com hooks
    • 10a14d1 [7.1.x] testing: fix tests when run under -v or -vv
    • f4cfc59 [pre-commit.ci] auto fixes from pre-commit.com hooks
    • f1df807 [7.1.x] config: restore pre-pytest 7.1.0 confcutdir exclusion behavior
    • 7d4d1ec Merge pull request #9758 from pytest-dev/release-7.1.0
    • See full diff in compare view

    Dependabot compatibility score

    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)
    Extra Small dependencies 
    opened by dependabot[bot] 3
  • Bump mkdocs-material from 8.2.3 to 8.2.4

    Bump mkdocs-material from 8.2.3 to 8.2.4

    Bumps mkdocs-material from 8.2.3 to 8.2.4.

    Release notes

    Sourced from mkdocs-material's releases.

    mkdocs-material-8.2.4

    • Fixed malformed Google Fonts URL when a font setting was omitted
    • Fixed #3648: Fixed specificity issue with admonitions in lists
    • Fixed #3653: Invalid outdated version banner URL when using instant loading
    Changelog

    Sourced from mkdocs-material's changelog.

    mkdocs-material-8.2.4+insiders-4.10.1 (2022-03-02)

    • Added missing build dependencies to Dockerfile
    • Fixed encoding issues in privacy plugin, now forcing UTF-8 encoding
    • Fixed #3624: Scroll to active navigation item unreliable in Firefox
    • Fixed #3642: Privacy plugin errors when font setting was omitted

    mkdocs-material-8.2.4 (2022-03-02)

    • Fixed malformed Google Fonts URL when a font setting was omitted
    • Fixed #3648: Fixed specificity issue with admonitions in lists
    • Fixed #3653: Invalid outdated version banner URL when using instant loading

    mkdocs-material-8.2.3+insiders-4.10.0 (2022-02-27)

    • Added support for offline plugin (supersedes offline search support)
    • Improved built-in privacy plugin to download nested JavaScript assets
    • Refactored configuration of built-in privacy plugin

    mkdocs-material-8.2.3 (2022-02-27)

    • Fixed #3578: Active element in table of contents off-by-one on large screens

    mkdocs-material-8.2.2 (2022-02-26)

    • Added automatic removal of query parameter when search is closed
    • Fixed #3599: Anchors always overriden when using navigation tracking

    mkdocs-material-8.2.1+insiders-4.9.1 (2022-02-21)

    • Fixed #3610: missing lxml dependency for privacy plugin
    • Fixed error when charset is missing in content-type header

    mkdocs-material-8.2.1+insiders-4.9.0 (2022-02-20)

    • Added privacy plugin: automatic downloading of external assets

    mkdocs-material-8.2.1 (2022-02-17)

    • Fixed module 'material.plugins' not being found (8.2.0 regression)

    mkdocs-material-8.2.0 (2022-02-17)

    • Added native support for Mermaid.js diagrams
    • Added native support for tags (with search integration)
    • Added support for staying on page when switching versions

    mkdocs-material-8.1.11+insiders-4.8.3 (2022-02-13)

    • Fixed #3560: Mermaid diagrams don't render for file:// locations

    ... (truncated)

    Commits
    • 2b32493 Prepare 8.2.4 release
    • cb95798 Documentation
    • a8c8c22 Added Elli to premium sponsors
    • bcc2c18 Fixed invalid outdated version banner URL when using instant loading
    • 1cc2506 Fixed specificity issue with admonitions in lists (#3648)
    • 60f586f Documentation
    • 64e5ed0 Fixed malformed Google Fonts url when a font setting was omitted
    • 791c69a Documentation
    • dfeb962 Updated dependencies
    • f7a1111 Documentation
    • Additional commits viewable in compare view

    Dependabot compatibility score

    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)
    Extra Small dependencies 
    opened by dependabot[bot] 3
  • Bump fastapi from 0.73.0 to 0.74.0

    Bump fastapi from 0.73.0 to 0.74.0

    Bumps fastapi from 0.73.0 to 0.74.0.

    Release notes

    Sourced from fastapi's releases.

    0.74.0

    Breaking Changes

    • ✨ Update internal AsyncExitStack to fix context for dependencies with yield. PR #4575 by @​tiangolo.

    Dependencies with yield can now catch HTTPException and custom exceptions. For example:

    async def get_database():
        with Session() as session:
            try:
                yield session
            except HTTPException:
                session.rollback()
                raise
            finally:
                session.close()
    

    After the dependency with yield handles the exception (or not) the exception is raised again. So that any exception handlers can catch it, or ultimately the default internal ServerErrorMiddleware.

    If you depended on exceptions not being received by dependencies with yield, and receiving an exception breaks the code after yield, you can use a block with try and finally:

    async def do_something():
        try:
            yield something
        finally:
            some_cleanup()
    

    ...that way the finally block is run regardless of any exception that might happen.

    Features

    • The same PR #4575 from above also fixes the contextvars context for the code before and after yield. This was the main objective of that PR.

    This means that now, if you set a value in a context variable before yield, the value would still be available after yield (as you would intuitively expect). And it also means that you can reset the context variable with a token afterwards.

    For example, this works correctly now:

    from contextvars import ContextVar
    from typing import Any, Dict, Optional
    

    legacy_request_state_context_var: ContextVar[Optional[Dict[str, Any]]] = ContextVar( "legacy_request_state_context_var", default=None )

    </tr></table>

    ... (truncated)

    Commits
    • 1ce16c2 🔖 Release version 0.74.0
    • 03d4d4c 📝 Update release notes
    • 2d2f1de 📝 Update release notes
    • 59e3648 🔧 Add Striveworks sponsor (#4596)
    • 4fcb003 📝 Update release notes
    • 9d56a3c ✨ Update internal AsyncExitStack to fix context for dependencies with `yiel...
    • 78b07cb 📝 Update release notes
    • 6034f80 💚 Only build docs on push when on master to avoid duplicate runs from PRs (#4...
    • b93f8a7 📝 Update release notes
    • 618c99d 👥 Update FastAPI People (#4502)
    • See full diff in compare view

    Dependabot compatibility score

    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)
    Extra Small dependencies 
    opened by dependabot[bot] 3
  • Bump mkdocs-material from 8.1.10 to 8.1.11

    Bump mkdocs-material from 8.1.10 to 8.1.11

    Bumps mkdocs-material from 8.1.10 to 8.1.11.

    Release notes

    Sourced from mkdocs-material's releases.

    mkdocs-material-8.1.11

    • Added Portuguese (Brasilian) translations
    • Fixed #3545: Color palette toggle and search overlaying version selector
    Changelog

    Sourced from mkdocs-material's changelog.

    mkdocs-material-8.1.11+insiders-4.8.2 (2022-02-10)

    • Fixed #3559: Mermaid diagrams don't render inside closed details

    mkdocs-material-8.1.11 (2022-02-10)

    • Added Portuguese (Brasilian) translations
    • Fixed #3545: Color palette toggle and search overlaying version selector

    mkdocs-material-8.1.10+insiders-4.8.1 (2022-02-06)

    • Fixed jump back to top on mobile when using anchor following

    mkdocs-material-8.1.10+insiders-4.8.0 (2022-02-06)

    • Added support for anchor following table of contents (= auto scroll)

    mkdocs-material-8.1.10 (2022-02-06)

    • Fixed cutoff of very wide logos in the sidebar on mobile

    mkdocs-material-8.1.9+insiders-4.7.2 (2022-02-02)

    • Fixed #3526: Transparent sidebar title due to Safari bug
    • Fixed #3528: Firefox sometimes clips text in flow chart diagrams

    mkdocs-material-8.1.9+insiders-4.7.1 (2022-01-30)

    • Fixed #3506: Tags index not respecting title set via front matter

    mkdocs-material-8.1.9 (2022-01-30)

    • Added support for mkdocs.yml validation and auto-complete
    • Fixed errors in Latvian translations

    mkdocs-material-8.1.8+insiders-4.7.0 (2022-01-25)

    • Added native support for offline search

    mkdocs-material-8.1.8 (2022-01-23)

    • Added Latvian translations
    • Updated Giscus example integration with dynamic theme change support
    • Fixed #3479: Back-to-top button not hidden when using sticky navigation tabs
    • Fixed #3491: Logo in header and drawer doesn't honor aspect ratio

    mkdocs-material-8.1.7+insiders-4.6.1 (2022-01-16)

    • Fixed #3459: Section index pages picking up wrong title

    ... (truncated)

    Commits
    • 81af7dc Prepare 8.1.11 release
    • 2754652 Added Portuguese (Brasilian) translations
    • 3d9fd71 Merge branch 'master' of github.com:squidfunk/mkdocs-material
    • 1f8ad09 Added Zenoss to premium sponsors
    • 40b6676 Added schema for RSS plugin (#3571)
    • 4da48e0 Added Datadog to premium sponsors
    • cf7f045 Fixed linter errors
    • f2fc90a Merge branch 'master' of github.com:squidfunk/mkdocs-material
    • ca9862c Updated dependencies
    • 079e18a Bump actions/setup-python from 2.3.1 to 2.3.2 (#3558)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    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)
    Extra Small dependencies 
    opened by dependabot[bot] 3
  • Bump fastapi from 0.70.1 to 0.72.0

    Bump fastapi from 0.70.1 to 0.72.0

    Bumps fastapi from 0.70.1 to 0.72.0.

    Release notes

    Sourced from fastapi's releases.

    0.72.0

    Features

    Docs

    • 📝 Update Python Types docs, add missing 3.6 / 3.9 example. PR #4434 by @​tiangolo.

    Translations

    Internal

    0.71.0

    Features

    • ✨ Add docs and tests for Python 3.9 and Python 3.10. PR #3712 by @​tiangolo.
      • You can start with Python Types Intro, it explains what changes between different Python versions, in Python 3.9 and in Python 3.10.
      • All the FastAPI docs are updated. Each code example in the docs that could use different syntax in Python 3.9 or Python 3.10 now has all the alternatives in tabs.
    • ⬆️ Upgrade Starlette to 0.17.1. PR #4145 by @​simondale00.

    Internal

    Commits
    • f038891 🔖 Release version 0.72.0
    • 9e2f5c6 📝 Update release notes
    • 93e4a19 📝 Update release notes
    • e1c6d7d 🌐 Update Chinese translation for docs/help-fastapi.md (#3847)
    • d23b295 📝 Update release notes
    • 26e9411 🌐 Fix Korean translation for docs/ko/docs/index.md (#4195)
    • 2496893 📝 Update release notes
    • 5c5b889 🌐 Add Polish translation for docs/pl/docs/index.md (#4245)
    • 436261b 📝 Update release notes
    • 5c62a59 🌐 Add Chinese translation for docs\tutorial\path-operation-configuration.md...
    • Additional commits viewable in compare view

    Dependabot compatibility score

    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)
    Extra Small dependencies 
    opened by dependabot[bot] 3
  • Bump mkdocs-material from 8.1.4 to 8.1.7

    Bump mkdocs-material from 8.1.4 to 8.1.7

    Bumps mkdocs-material from 8.1.4 to 8.1.7.

    Release notes

    Sourced from mkdocs-material's releases.

    mkdocs-material-8.1.7

    • Improved back-to-top button behavior - now not shown on anchor jump

    mkdocs-material-8.1.6

    • Fixed spacing of blockquotes (8.1.5 regression)
    • Fixed edge cases for rounded corners on code blocks (8.1.5 regression)
    • Fixed issues with code annotation line heights

    mkdocs-material-8.1.5

    • Improved browser support: Chrome 49+, Safari 10+, Firefox 53+, Edge 79+
    • Improved rendering of inline code blocks in headlines
    • Added Bahasa Malaysian translations
    • Fixed #3354: MathJax formulas show vertical scrollbar
    Changelog

    Sourced from mkdocs-material's changelog.

    mkdocs-material-8.1.7+insiders-4.6.1 (2022-01-16)

    • Fixed #3459: Section index pages picking up wrong title

    mkdocs-material-8.1.7 (2022-01-16)

    • Improved back-to-top button behavior - now not shown on anchor jump

    mkdocs-material-8.1.6-insiders-4.6.0 (2022-01-11)

    • Added support for annotations (outside of code blocks)

    mkdocs-material-8.1.6 (2022-01-11)

    • Fixed spacing of blockquotes (8.1.5 regression)
    • Fixed edge cases for rounded corners on code blocks (8.1.5 regression)
    • Fixed rendering issues with code annotation line heights

    mkdocs-material-8.1.5 (2022-01-09)

    • Improved browser support: Chrome 49+, Safari 10+, Firefox 53+, Edge 79+
    • Improved rendering of inline code blocks in headlines
    • Added Bahasa Malaysian translations
    • Fixed #3354: MathJax formulas show vertical scrollbar

    mkdocs-material-8.1.4+insiders-4.5.2 (2022-01-08)

    • Fixed #3440: Content tab indicator not moving when using linking
    • Fixed #3445: Content tab switch flickers/jitters when using linking

    mkdocs-material-8.1.4+insiders-4.5.1 (2022-01-02)

    • Added support for setting initial state of cookie consent
    • Fixed #3396: Disappearing link in navigation due to Safari bug

    mkdocs-material-8.1.4 (2022-01-02)

    • Added indicator to navigation expander icon
    • Improved support for reduced motion preference
    • Fixed jitter of active content tab indicator

    mkdocs-material-8.1.3 (2021-12-19)

    • Added animation to active content tab indicator
    • Fixed #3360: Highlighted lines add blank lines in copied text
    • Fixed usage of subsequent index files when using section index pages

    mkdocs-material-8.1.2+insiders-4.5.0 (2021-12-16)

    • Added support for navigation icons

    ... (truncated)

    Commits
    • a919199 Updated Insiders changelog
    • c74a886 Prepare 8.1.7 release
    • 014ab60 Improved back-to-top button behavior on anchor jump
    • 0a08e67 Added missing extends pragmas
    • 2231aab Added extension pragma
    • 749c19c Fixed endless redirect in palette change example
    • f9e9418 Added guide for setting up Giscus
    • 29cc1dd Documentation
    • 9511569 Added dark mode support for Giscus
    • 09c0e1c Removed feedback section in blog for Giscus integration
    • Additional commits viewable in compare view

    Dependabot compatibility score

    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)
    Extra Small dependencies 
    opened by dependabot[bot] 3
  • Bump mkdocs-material from 8.1.4 to 8.1.6

    Bump mkdocs-material from 8.1.4 to 8.1.6

    Bumps mkdocs-material from 8.1.4 to 8.1.6.

    Release notes

    Sourced from mkdocs-material's releases.

    mkdocs-material-8.1.6

    • Fixed spacing of blockquotes (8.1.5 regression)
    • Fixed edge cases for rounded corners on code blocks (8.1.5 regression)
    • Fixed issues with code annotation line heights

    mkdocs-material-8.1.5

    • Improved browser support: Chrome 49+, Safari 10+, Firefox 53+, Edge 79+
    • Improved rendering of inline code blocks in headlines
    • Added Bahasa Malaysian translations
    • Fixed #3354: MathJax formulas show vertical scrollbar
    Changelog

    Sourced from mkdocs-material's changelog.

    mkdocs-material-8.1.6-insiders-4.6.0 (2022-01-11)

    • Added support for annotations (outside of code blocks)

    mkdocs-material-8.1.6 (2022-01-11)

    • Fixed spacing of blockquotes (8.1.5 regression)
    • Fixed edge cases for rounded corners on code blocks (8.1.5 regression)
    • Fixed rendering issues with code annotation line heights

    mkdocs-material-8.1.5 (2022-01-09)

    • Improved browser support: Chrome 49+, Safari 10+, Firefox 53+, Edge 79+
    • Improved rendering of inline code blocks in headlines
    • Added Bahasa Malaysian translations
    • Fixed #3354: MathJax formulas show vertical scrollbar

    mkdocs-material-8.1.4+insiders-4.5.2 (2022-01-08)

    • Fixed #3440: Content tab indicator not moving when using linking
    • Fixed #3445: Content tab switch flickers/jitters when using linking

    mkdocs-material-8.1.4+insiders-4.5.1 (2022-01-02)

    • Added support for setting initial state of cookie consent
    • Fixed #3396: Disappearing link in navigation due to Safari bug

    mkdocs-material-8.1.4 (2022-01-02)

    • Added indicator to navigation expander icon
    • Improved support for reduced motion preference
    • Fixed jitter of active content tab indicator

    mkdocs-material-8.1.3 (2021-12-19)

    • Added animation to active content tab indicator
    • Fixed #3360: Highlighted lines add blank lines in copied text
    • Fixed usage of subsequent index files when using section index pages

    mkdocs-material-8.1.2+insiders-4.5.0 (2021-12-16)

    • Added support for navigation icons

    mkdocs-material-8.1.2 (2021-12-15)

    • Switched CSS sources to logical properties
    • Added transformation of logical properties to ltr/rtl equivalents
    • Fixed spacing for admonitions inside lists (8.1.1 regression)

    mkdocs-material-8.1.1 (2021-12-13)

    ... (truncated)

    Commits
    • f5a98fc Prepare 8.1.6 release
    • bcf2f78 Fixed blockquote spacing (8.1.5 regression)
    • 73331ee Fixed edge cases for rounded borders on code blocks
    • aa34402 Fixed overflow/clearfix issues for code result blocks
    • 50408bf Added new code block styles to reference documentation
    • ca1996b Updated distribution files
    • 9655c3a Updated dependencies and bumped copyright year
    • cd0eb23 Added missing entry to changelog
    • 97c920a Fixed issues with code annotation line height
    • d5fb8f1 Prepare 8.1.5 release
    • Additional commits viewable in compare view

    Dependabot compatibility score

    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)
    Extra Small dependencies 
    opened by dependabot[bot] 3
  • Bump mkdocs-material from 8.1.4 to 8.1.5

    Bump mkdocs-material from 8.1.4 to 8.1.5

    Bumps mkdocs-material from 8.1.4 to 8.1.5.

    Release notes

    Sourced from mkdocs-material's releases.

    mkdocs-material-8.1.5

    • Improved browser support: Chrome 49+, Safari 10+, Firefox 53+, Edge 79+
    • Improved rendering of inline code blocks in headlines
    • Added Bahasa Malaysian translations
    • Fixed #3354: MathJax formulas show vertical scrollbar
    Changelog

    Sourced from mkdocs-material's changelog.

    mkdocs-material-8.1.5 (2022-01-09)

    • Improved browser support: Chrome 49+, Safari 10+, Firefox 53+, Edge 79+
    • Improved rendering of inline code blocks in headlines
    • Added Bahasa Malaysian translations
    • Fixed #3354: MathJax formulas show vertical scrollbar

    mkdocs-material-8.1.4+insiders-4.5.2 (2022-01-08)

    • Fixed #3440: Content tab indicator not moving when using linking
    • Fixed #3445: Content tab switch flickers/jitters when using linking

    mkdocs-material-8.1.4+insiders-4.5.1 (2022-01-02)

    • Added support for setting initial state of cookie consent
    • Fixed #3396: Disappearing link in navigation due to Safari bug

    mkdocs-material-8.1.4 (2022-01-02)

    • Added indicator to navigation expander icon
    • Improved support for reduced motion preference
    • Fixed jitter of active content tab indicator

    mkdocs-material-8.1.3 (2021-12-19)

    • Added animation to active content tab indicator
    • Fixed #3360: Highlighted lines add blank lines in copied text
    • Fixed usage of subsequent index files when using section index pages

    mkdocs-material-8.1.2+insiders-4.5.0 (2021-12-16)

    • Added support for navigation icons

    mkdocs-material-8.1.2 (2021-12-15)

    • Switched CSS sources to logical properties
    • Added transformation of logical properties to ltr/rtl equivalents
    • Fixed spacing for admonitions inside lists (8.1.1 regression)

    mkdocs-material-8.1.1 (2021-12-13)

    • Added support for #only-light and #only-dark image hash fragments
    • Fixed copy-to-clipboard adding blank lines when using line anchors
    • Fixed code annotation directionality for right-to-left languages
    • Fixed header title positioning for right-to-left languages
    • Fixed admonition borders for right-to-left languages (8.0.0 regression)
    • Fixed footer navigation link positioning (8.0.0 regression)
    • Fixed footer navigation title breaking out of container when too long
    • Fixed shrinking arrow in navigation title when too long
    • Fixed #3343: Filtered stopwords appear as missing search terms

    ... (truncated)

    Commits
    • d5fb8f1 Prepare 8.1.5 release
    • e063108 Fixed scrollbars on MathJax formulas
    • cffb403 Added Bahasa Malaysian translations
    • 24c8519 Documentation
    • db4648f Fixed remaining issues and added docs for browser support
    • 48bb814 Improved browser compatibility
    • 463e4b1 Disabled navigation.instant
    • ea02f33 Merge branch 'master' into refactor/compatibility
    • 0a43974 Documentation
    • 1712664 Documentation
    • Additional commits viewable in compare view

    Dependabot compatibility score

    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)
    Extra Small dependencies 
    opened by dependabot[bot] 3
  • Bump fastapi from 0.70.1 to 0.71.0

    Bump fastapi from 0.70.1 to 0.71.0

    Bumps fastapi from 0.70.1 to 0.71.0.

    Release notes

    Sourced from fastapi's releases.

    0.71.0

    Features

    • ✨ Add docs and tests for Python 3.9 and Python 3.10. PR #3712 by @​tiangolo.
      • You can start with Python Types Intro, it explains what changes between different Python versions, in Python 3.9 and in Python 3.10.
      • All the FastAPI docs are updated. Each code example in the docs that could use different syntax in Python 3.9 or Python 3.10 now has all the alternatives in tabs.
    • ⬆️ Upgrade Starlette to 0.17.1. PR #4145 by @​simondale00.

    Internal

    Commits

    Dependabot compatibility score

    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)
    Extra Small dependencies 
    opened by dependabot[bot] 3
  • Bump fastapi from 0.75.0 to 0.75.1

    Bump fastapi from 0.75.0 to 0.75.1

    Bumps fastapi from 0.75.0 to 0.75.1.

    Release notes

    Sourced from fastapi's releases.

    0.75.1

    Translations

    Internal

    Commits

    Dependabot compatibility score

    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] 2
  • Bump mkdocs from 1.2.3 to 1.3.0

    Bump mkdocs from 1.2.3 to 1.3.0

    Bumps mkdocs from 1.2.3 to 1.3.0.

    Release notes

    Sourced from mkdocs's releases.

    1.3.0

    Feature upgrades

    • ReadTheDocs theme updated from v0.4.1 to v1.0.0 according to upstream (#2585)

      The most notable changes:

      • New option logo: Rather than displaying the site_name in the title, one can specify a path to an image to display instead.
      • New option anonymize_ip for Google Analytics.
      • Dependencies were upgraded: jQuery upgraded to 3.6.0, Modernizr.js dropped, and others.

      See documentation of config options for the theme

    • Built-in themes now also support these languages:

    • Support custom directories to watch when running mkdocs serve (#2642)

      MkDocs by default watches the docs directory and the config file. Now there is a way to add more directories to watch for changes, either via the YAML watch key or the command line flag --watch.

      Normally MkDocs never reaches into any other directories (so this feature shouldn't be necessary), but some plugins and extensions may do so.

      See documentation.

    • New --no-history option for gh_deploy (#2594)

      Allows to discard the history of commits when deploying, and instead replace it with one root commit

    Bug fixes

    • An XSS vulnerability when using the search function in built-in themes was fixed (#2791)

    • Setting the edit_uri option no longer erroneously adds a trailing slash to repo_url (#2733)

    Miscellaneous

    • Breaking change: the pages config option that was deprecated for a very long time now causes an error when used (#2652)

      To fix the error, just change from pages to nav.

    • Performance optimization: during startup of MkDocs, code and dependencies of other commands will not be imported (#2714)

      The most visible effect of this is that dependencies of mkdocs serve will not be imported when mkdocs build is used.

    • Recursively validate nav (#2680)

      Validation of the nested nav structure has been reworked to report errors early and reliably. Some edge cases have been declared invalid.

    Other small improvements; see commit log.

    ... (truncated)

    Commits

    Dependabot compatibility score

    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] 2
Releases(1.1.2)
  • 1.1.2(Nov 30, 2021)

    What's Changed

    • Chore: Uncover some Functions by @yezz123 in https://github.com/yezz123/fastapi-class/pull/8
    • Bump mkdocs-material from 7.2.6 to 8.0.2 by @dependabot in https://github.com/yezz123/fastapi-class/pull/9
    • Bump fastapi from 0.68.1 to 0.70.0 by @dependabot in https://github.com/yezz123/fastapi-class/pull/11

    Full Changelog: https://github.com/yezz123/fastapi-class/compare/1.1.1...1.1.2

    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Oct 17, 2021)

    What's Changed

    Pull Requests

    • Create FastAPI Class Documentation ✨ by @yezz123 in https://github.com/yezz123/fastapi-class/pull/6
    • Bump to 1.1.1 ✨ by @yezz123 in https://github.com/yezz123/fastapi-class/pull/7

    Full Changelog: https://github.com/yezz123/fastapi-class/compare/1.1.0...1.1.1

    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Oct 10, 2021)

    What's Changed

    • Add More Classifiers & Fix Typo ✨ by @yezz123 in https://github.com/yezz123/fastapi-class/pull/3

    Full Changelog: https://github.com/yezz123/fastapi-class/compare/1.0.0...1.1.0

    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Oct 7, 2021)

    Classes and Decorators to use FastAPI with class based routing. In particular this allows you to construct an instance of a class and have methods of that instance be route handlers for FastAPI & Python 3.8.

    • Older Versions of Python:
      • Unfortunately this does not work with async routes with Python versions less than 3.8 due to bugs in inspect.iscoroutinefunction. Specifically with older versions of Python iscoroutinefunction incorrectly returns false so async routes aren't await'd. We therefore only support Python versions >= 3.8.

    Example 🐢

    from ping import pong
    # Some fictional ping pong class
    from fastapi_class import Routable, get, delete
    
    def parse_arg() -> argparse.Namespace:
       """parse command line arguments."""
       ...
    
    
    class UserRoutes(Routable):
       """Inherits from Routable."""
    
       # Note injection here by simply passing values to the constructor. Other injection frameworks also
       # supported as there's nothing special about this __init__ method.
       def __init__(self, pong: pong) -> None:
          """Constructor. The pong is injected here."""
          self.__pong = pong
    
       @get('/user/{name}')
       def get_user_by_name(name: str) -> User:
          # Use our injected pong instance.
          return self.__pong.get_user_by_name(name)
    
       @delete('/user/{name}')
       def delete_user(name: str) -> None:
          self.__pong.delete(name)
    
    
    def main():
        args = parse_args()
        # Configure the pomg per command line arguments
        pong = pong(args.url, args.user, args.password)
        # Simple intuitive injection
        user_routes = UserRoutes(pong)
    
        app = FastAPI()
        # router member inherited from Routable and configured per the annotations.
        app.include_router(user_routes.router)
    
    Source code(tar.gz)
    Source code(zip)
Owner
Yasser Tahiri
API Ninja / Backend Developer who speaks @python. Creator of @BnademOverflow. I love Open Source & Ancient Greece.
Yasser Tahiri
FastAPI interesting concepts.

fastapi_related_stuffs FastAPI interesting concepts. FastAPI version :- 0.70 Python3 version :- 3.9.x Steps Test Django Like settings export FASTAPI_S

Mohd Mujtaba 3 Feb 06, 2022
Prometheus integration for Starlette.

Starlette Prometheus Introduction Prometheus integration for Starlette. Requirements Python 3.6+ Starlette 0.9+ Installation $ pip install starlette-p

José Antonio Perdiguero 229 Dec 21, 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 01, 2022
Formatting of dates and times in Flask templates using moment.js.

Flask-Moment This extension enhances Jinja2 templates with formatting of dates and times using moment.js. Quick Start Step 1: Initialize the extension

Miguel Grinberg 358 Nov 28, 2022
FastAPI Socket.io with first-class documentation using AsyncAPI

fastapi-sio Socket.io FastAPI integration library with first-class documentation using AsyncAPI The usage of the library is very familiar to the exper

Marián Hlaváč 9 Jan 02, 2023
Asynchronous event dispatching/handling library for FastAPI and Starlette

fastapi-events An event dispatching/handling library for FastAPI, and Starlette. Features: straightforward API to emit events anywhere in your code ev

Melvin 238 Jan 07, 2023
Sample project showing reliable data ingestion application using FastAPI and dramatiq

Create and deploy a reliable data ingestion service with FastAPI, SQLModel and Dramatiq This is the source code for the data ingestion service explain

François Voron 31 Nov 30, 2022
Hook Slinger acts as a simple service that lets you send, retry, and manage event-triggered POST requests, aka webhooks

Hook Slinger acts as a simple service that lets you send, retry, and manage event-triggered POST requests, aka webhooks. It provides a fully self-contained docker image that is easy to orchestrate, m

Redowan Delowar 96 Jan 02, 2023
Ansible Inventory Plugin, created to get hosts from HTTP API.

ansible-ws-inventory-plugin Ansible Inventory Plugin, created to get hosts from HTTP API. Features: Database compatible with MongoDB and Filesystem (J

Carlos Neto 0 Feb 05, 2022
Stac-fastapi built on Tile38 and Redis to support caching

stac-fastapi-caching Stac-fastapi built on Tile38 to support caching. This code is built on top of stac-fastapi-elasticsearch 0.1.0 with pyle38, a Pyt

Jonathan Healy 4 Apr 11, 2022
Basic fastapi blockchain - An api based blockchain with full functionality

Basic fastapi blockchain - An api based blockchain with full functionality

1 Nov 27, 2021
Flood Detection with Google Earth Engine

ee-fastapi: Flood Detection System A ee-fastapi is a simple FastAPI web application for performing flood detection using Google Earth Engine in the ba

Cesar Aybar 69 Jan 06, 2023
Generate Class & Decorators for your FastAPI project ✨🚀

Classes and Decorators to use FastAPI with class based routing. In particular this allows you to construct an instance of a class and have methods of that instance be route handlers for FastAPI & Pyt

Yasser Tahiri 34 Oct 27, 2022
FastAPI application and service structure for a more maintainable codebase

Abstracting FastAPI Services See this article for more information: https://camillovisini.com/article/abstracting-fastapi-services/ Poetry poetry inst

Camillo Visini 309 Jan 04, 2023
Opentracing support for Starlette and FastApi

Starlette-OpenTracing OpenTracing support for Starlette and FastApi. Inspired by: Flask-OpenTracing OpenTracing implementations exist for major distri

Rene Dohmen 63 Dec 30, 2022
Cookiecutter API for creating Custom Skills for Azure Search using Python and Docker

cookiecutter-spacy-fastapi Python cookiecutter API for quick deployments of spaCy models with FastAPI Azure Search The API interface is compatible wit

Microsoft 379 Jan 03, 2023
Boilerplate code for quick docker implementation of REST API with JWT Authentication using FastAPI, PostgreSQL and PgAdmin ⭐

FRDP Boilerplate code for quick docker implementation of REST API with JWT Authentication using FastAPI, PostgreSQL and PgAdmin ⛏ . Getting Started Fe

BnademOverflow 53 Dec 29, 2022
Opinionated authorization package for FastAPI

FastAPI Authorization Installation pip install fastapi-authorization Usage Currently, there are two models available: RBAC: Role-based Access Control

Marcelo Trylesinski 18 Jul 04, 2022
An extension library for FastAPI framework

FastLab An extension library for FastAPI framework Features Logging Models Utils Routers Installation use pip to install the package: pip install fast

Tezign Lab 10 Jul 11, 2022
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 04, 2023