Reusable utilities for FastAPI

Overview

Reusable utilities for FastAPI

Build Coverage Netlify status
Package version


Documentation: https://fastapi-utils.davidmontague.xyz

Source Code: https://github.com/dmontagu/fastapi-utils


FastAPI is a modern, fast web framework for building APIs with Python 3.6+.

But if you're here, you probably already knew that!


Features

This package includes a number of utilities to help reduce boilerplate and reuse common functionality across projects:

  • Class Based Views: Stop repeating the same dependencies over and over in the signature of related endpoints.
  • Response-Model Inferring Router: Let FastAPI infer the response_model to use based on your return type annotation.
  • Repeated Tasks: Easily trigger periodic tasks on server startup
  • Timing Middleware: Log basic timing information for every request
  • SQLAlchemy Sessions: The FastAPISessionMaker class provides an easily-customized SQLAlchemy Session dependency
  • OpenAPI Spec Simplification: Simplify your OpenAPI Operation IDs for cleaner output from OpenAPI Generator

It also adds a variety of more basic utilities that are useful across a wide variety of projects:

  • APIModel: A reusable pydantic.BaseModel-derived base class with useful defaults
  • APISettings: A subclass of pydantic.BaseSettings that makes it easy to configure FastAPI through environment variables
  • String-Valued Enums: The StrEnum and CamelStrEnum classes make string-valued enums easier to maintain
  • CamelCase Conversions: Convenience functions for converting strings from snake_case to camelCase or PascalCase and back
  • GUID Type: The provided GUID type makes it easy to use UUIDs as the primary keys for your database tables

See the docs for more details and examples.

Requirements

This package is intended for use with any recent version of FastAPI (depending on pydantic>=1.0), and Python 3.6+.

Installation

pip install fastapi-utils

License

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

Comments
  • [BUG] Unable to resolve multiple handlers for the same HTTP action but with different routes

    [BUG] Unable to resolve multiple handlers for the same HTTP action but with different routes

    Describe the bug

    I have a BlogCBV where I have a few handler functions, three of which are GETs:

    • get_drafts
    • get_blogs
    • get_blog

    get_drafts has a path of blogs/drafts get_blog has a path of blogs/{blog_id}

    However, when I want to reach the endpoint get_drafts by hitting blogs/drafts, get_blog will be reached instead.

    Below is the code snippet:

    # blog.py
    
    from typing import List
    
    from fastapi import APIRouter, Depends, Path
    from fastapi_utils.cbv import cbv
    from fastapi_utils.inferring_router import InferringRouter
    from sqlalchemy.orm import Session
    
    from app.api.utils.db import get_db
    from app.api.utils.security import get_current_active_user
    from app.db import crud
    from app.db.orm.blog import Blog
    from app.db.orm.user import User
    from app.dtos.blog import BlogForDetail, BlogForEdit, BlogForList, BlogForNew
    from app.dtos.msg import Msg
    
    router = APIRouter()
    
    BLOG_DEFAULT_PAGE_SIZE = 10
    
    
    router = InferringRouter()
    
    
    @cbv(router)
    class BlogCBV:
        session: Session = Depends(get_db)
        current_user: User = Depends(get_current_active_user)
    
        @router.get("/drafts")
        def get_drafts(
            self, *, page: int = 1, page_size: int = BLOG_DEFAULT_PAGE_SIZE,
        ) -> List[BlogForList]:
            """
            Retrieve blog drafts for the current user.
            """
            drafts = crud.blog.get_drafts(
                self.session, author=self.current_user, page=page, page_size=page_size
            )
            return [BlogForList.from_orm(draft) for draft in drafts]
    
        @router.get("/{blog_id}")
        def get_blog(
            self, *, blog_id: int = Path(..., title="The ID of the blog to be returned."),
        ) -> BlogForDetail:
            """
            Retrieve a published blog.
            """
            blog = crud.blog.get(self.session, id=blog_id)
            return BlogForDetail.from_orm(blog)
    
        @router.get("/",)
        def get_blogs(
            self, *, page: int = 1, page_size: int = BLOG_DEFAULT_PAGE_SIZE,
        ) -> List[BlogForList]:
            """
            Retrieve published blogs by all users.
            """
            blogs = crud.blog.get_multi(self.session, page=page, page_size=page_size)
            return [BlogForList.from_orm(blog) for blog in blogs]
    
    # api.py
    
    from fastapi import APIRouter
    
    from app.api.api_v1.endpoints import blogs, login, users, utils, profile
    
    api_router.include_router(blogs.router, prefix="/blogs", tags=["blogs"])
    
    # main.py
    
    app = FastAPI(title=config.PROJECT_NAME, openapi_url="/api/v1/openapi.json")
    app.include_router(api_router, prefix=config.API_V1_STR)
    

    Expected behavior get_drafts should be correctly resolved and reached.

    Environment:

    • OS: Linux (Fedora 31)
    • FastAPI Utils, FastAPI, and Pydantic versions:
    0.1.1
    0.49.0
                 pydantic version: 1.4
                pydantic compiled: True
                     install path: /usr/local/lib/python3.7/site-packages/pydantic
                   python version: 3.7.4 (default, Sep 12 2019, 15:40:15)  [GCC 8.3.0]
                         platform: Linux-5.5.5-200.fc31.x86_64-x86_64-with-debian-10.1
         optional deps. installed: ['email-validator', 'devtools']
    
    • Python version: 3.7.4

    Additional context In my test:

        def test_get_all_my_drafts(self, session, test_user_token_headers):
            batch_create_random_blogs(session, is_published=False, num=3)
            batch_create_random_blogs(session, is_published=True, num=2)
            url = app.url_path_for("get_drafts")
    
            r = client.get(url, headers=test_user_token_headers)
            drafts = r.json()
    
            debug(drafts)
    
            assert r.status_code == 200
            assert len(drafts) == 3
    

    The url can be correctly resolved: url: '/api/v1/blogs/drafts'

    bug 
    opened by HymanZHAN 6
  • [BUG]/[FEATURE] multiple path's on the same method results in errors

    [BUG]/[FEATURE] multiple path's on the same method results in errors

    Not quite clear to me if this is a bug or a feature request as I may be doing something out of the ordinary.

    Using class based views, my tests return errors using methods (inside cbv) that have multiple path decorators attached to them. When using vanilla FastAPI without cbv the tests pass.

    To Reproduce

    Credit to @smparekh for the demo below, which I modified slightly to show the issue.

    Simple main.py app:

    from fastapi import FastAPI, APIRouter
    
    from fastapi_utils.cbv import cbv
    
    router = APIRouter()
    
    
    fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
    
    
    @cbv(router)
    class RootHandler:
        @router.get("/items/?")
        @router.get("/items/{item_path:path}")
        @router.get("/database/{item_path:path}")
        def root(self, item_path: str = None, item_query: str = None):
            if item_path:
                return {"item_path": item_path}
            elif item_query:
                return {"item_query": item_query}
            else:
                return fake_items_db
    
    
    app = FastAPI()
    app.include_router(router)
    

    simple test_main.py

    from .main import router
    
    
    from starlette.testclient import TestClient
    from .main import fake_items_db
    
    client = TestClient(router)
    
    
    def test_item_path():
        resp = client.get("items/Bar")
        assert resp.status_code == 200
        assert resp.json() == {"item_path": "Bar"}
    
    
    def test_item_query():
        resp = client.get("items/?item_query=Bar")
        assert resp.status_code == 200
        assert resp.json() == {"item_query": "Bar"}
    
    
    def test_list():
        resp = client.get("items/")
        assert resp.status_code == 200
        assert resp.json() == fake_items_db
    
    
    def test_database():
        resp = client.get("database/")
        assert resp.status_code == 200
        assert resp.json() == fake_items_db
    

    traceback

    traceback from the first test (others are the same)

    =================================== FAILURES ===================================
    ________________________________ test_item_path ________________________________
    
        def test_item_path():
    >       resp = client.get("items/Bar")
    
    app/test_main_mult_decorators.py:11: 
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    ../../../miniconda3/envs/web-server-eval/lib/python3.8/site-packages/requests/sessions.py:546: in get
        return self.request('GET', url, **kwargs)
    ../../../miniconda3/envs/web-server-eval/lib/python3.8/site-packages/starlette/testclient.py:413: in request
        return super().request(
    ../../../miniconda3/envs/web-server-eval/lib/python3.8/site-packages/requests/sessions.py:533: in request
        resp = self.send(prep, **send_kwargs)
    ../../../miniconda3/envs/web-server-eval/lib/python3.8/site-packages/requests/sessions.py:646: in send
        r = adapter.send(request, **kwargs)
    ../../../miniconda3/envs/web-server-eval/lib/python3.8/site-packages/starlette/testclient.py:243: in send
        raise exc from None
    ../../../miniconda3/envs/web-server-eval/lib/python3.8/site-packages/starlette/testclient.py:240: in send
        loop.run_until_complete(self.app(scope, receive, send))
    ../../../miniconda3/envs/web-server-eval/lib/python3.8/asyncio/base_events.py:612: in run_until_complete
        return future.result()
    ../../../miniconda3/envs/web-server-eval/lib/python3.8/site-packages/starlette/routing.py:550: in __call__
        await route.handle(scope, receive, send)
    ../../../miniconda3/envs/web-server-eval/lib/python3.8/site-packages/starlette/routing.py:227: in handle
        await self.app(scope, receive, send)
    ../../../miniconda3/envs/web-server-eval/lib/python3.8/site-packages/starlette/routing.py:41: in app
        response = await func(request)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    
    request = <starlette.requests.Request object at 0x118cd3670>
    
        async def app(request: Request) -> Response:
            try:
                body = None
                if body_field:
                    if is_body_form:
                        body = await request.form()
                    else:
                        body_bytes = await request.body()
                        if body_bytes:
                            body = await request.json()
            except Exception as e:
                logger.error(f"Error getting request body: {e}")
                raise HTTPException(
                    status_code=400, detail="There was an error parsing the body"
                ) from e
            solved_result = await solve_dependencies(
                request=request,
                dependant=dependant,
                body=body,
                dependency_overrides_provider=dependency_overrides_provider,
            )
            values, errors, background_tasks, sub_response, _ = solved_result
            if errors:
    >           raise RequestValidationError(errors, body=body)
    E           fastapi.exceptions.RequestValidationError: 1 validation error for Request
    E           query -> self
    E             field required (type=value_error.missing)
    
    ../../../miniconda3/envs/web-server-eval/lib/python3.8/site-packages/fastapi/routing.py:145: RequestValidationError
    

    Expected behavior Ideally tests work as in vanilla FastAPI without cbv.

    Environment:

    • OS: tested on macOS and Linux
    >>> import fastapi_utils
    >>> import fastapi
    >>> import pydantic.utils
    >>> import pytest
    >>>
    >>> print(fastapi_utils.__version__)
    0.2.0
    >>> print(fastapi.__version__)
    0.52.0
    >>> print(pydantic.utils.version_info())
                 pydantic version: 1.4
                pydantic compiled: False
                     install path: /Users/bfalk/miniconda3/envs/web-server-eval/lib/python3.8/site-packages/pydantic
                   python version: 3.8.1 (default, Jan  8 2020, 16:15:59)  [Clang 4.0.1 (tags/RELEASE_401/final)]
                         platform: macOS-10.14.6-x86_64-i386-64bit
         optional deps. installed: ['typing-extensions']
    >>> print(pytest.__version__)
    5.3.5
    
    bug 
    opened by falkben 4
  • How get application state in periodic task?

    How get application state in periodic task?

    I need to get app.state to retrieve the Postgres pool driver in my periodic task. Because task repeating every 5 sec.

    How can I do this with the fastapi routing case (when app.state is available only in request object)?

    In this example, I'm forced to create gspread and asyncpg connections every 5 seconds this is a terrible decision.

    question 
    opened by Korolev-Oleg 2
  • Bump sqlalchemy from 1.3.13 to 1.4.0

    Bump sqlalchemy from 1.3.13 to 1.4.0

    Bumps sqlalchemy from 1.3.13 to 1.4.0.

    Release notes

    Sourced from sqlalchemy's releases.

    1.4.0

    Released: March 15, 2021

    orm

    • [orm] [bug] Removed very old warning that states that passive_deletes is not intended for many-to-one relationships. While it is likely that in many cases placing this parameter on a many-to-one relationship is not what was intended, there are use cases where delete cascade may want to be disallowed following from such a relationship.

      This change is also backported to: 1.3.24

      References: #5983

    • [orm] [bug] Fixed issue where the process of joining two tables could fail if one of the tables had an unrelated, unresolvable foreign key constraint which would raise _exc.NoReferenceError within the join process, which nonetheless could be bypassed to allow the join to complete. The logic which tested the exception for significance within the process would make assumptions about the construct which would fail.

      This change is also backported to: 1.3.24

      References: #5952

    • [orm] [bug] Fixed issue where the _mutable.MutableComposite construct could be placed into an invalid state when the parent object was already loaded, and then covered by a subsequent query, due to the composite properties' refresh handler replacing the object with a new one not handled by the mutable extension.

      This change is also backported to: 1.3.24

      References: #6001

    • [orm] [bug] Fixed regression where the _orm.relationship.query_class parameter stopped being functional for "dynamic" relationships. The AppenderQuery remains dependent on the legacy _orm.Query class; users are encouraged to migrate from the use of "dynamic" relationships to using _orm.with_parent() instead.

      References: #5981

    • [orm] [bug] [regression] Fixed regression where _orm.Query.join() would produce no effect if the query itself as well as the join target were against a _schema.Table object, rather than a mapped class. This was part of a more systemic issue where the legacy ORM query compiler would not be

    ... (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)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 2
  • [BUG] @repeat_every will have no stack trace in terminal

    [BUG] @repeat_every will have no stack trace in terminal

    Describe the bug No error will show

    To Reproduce

    from fastapi import FastAPI
    
    from fastapi_utils.tasks import repeat_every
    
    
    app = FastAPI()
    
    items = {}
    
    
    @app.on_event("startup")
    @repeat_every(seconds=60)
    async def startup_event():
        raise Exception
        items["foo"] = {"name": "Fighters"}
        items["bar"] = {"name": "Tenders"}
    
    
    @app.get("/items/{item_id}")
    async def read_items(item_id: str):
        return items[item_id]
    

    uvicorn app.main:app --reload, the raise Exception should produce a stack trace in terminal, but none.

    Environment:

    • Windows
    Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import fastapi_utils
    >>> import fastapi
    >>> import pydantic.utils
    >>> print(fastapi_utils.__version__)
    0.2.1
    >>> print(fastapi.__version__)
    0.58.0
    >>> print(pydantic.utils.version_info())
                 pydantic version: 1.5.1
                pydantic compiled: True
                     install path: D:\git\testFastapiutils\venv\Lib\site-packages\pydantic
                   python version: 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)]
                         platform: Windows-10-10.0.18362-SP0
         optional deps. installed: []
    
    bug 
    opened by shizidushu 2
  • Bump sqlalchemy from 1.3.13 to 1.3.17

    Bump sqlalchemy from 1.3.13 to 1.3.17

    Bumps sqlalchemy from 1.3.13 to 1.3.17.

    Release notes

    Sourced from sqlalchemy's releases.

    1.3.17

    Released: May 13, 2020

    orm

    • [orm] [bug] Fixed bug where using with_polymorphic() as the target of a join via RelationshipComparator.of_type() on a mapper that already has a subquery-based with_polymorphic setting that's equivalent to the one requested would not correctly alias the ON clause in the join.

      References: #5288

    • [orm] [bug] Fixed issue in the area of where loader options such as selectinload() interact with the baked query system, such that the caching of a query is not supposed to occur if the loader options themselves have elements such as with_polymorphic() objects in them that currently are not cache-compatible. The baked loader could sometimes not fully invalidate itself in these some of these scenarios leading to missed eager loads.

      References: #5303

    • [orm] [bug] Modified the internal "identity set" implementation, which is a set that hashes objects on their id() rather than their hash values, to not actually call the __hash__() method of the objects, which are typically user-mapped objects. Some methods were calling this method as a side effect of the implementation.

      References: #5304

    • [orm] [bug] An informative error message is raised when an ORM many-to-one comparison is attempted against an object that is not an actual mapped instance. Comparisons such as those to scalar subqueries aren't supported; generalized comparison with subqueries is better achieved using ~.RelationshipProperty.Comparator.has().

      References: #5269

    • [orm] [usecase] Added an accessor ColumnProperty.Comparator.expressions which provides access to the group of columns mapped under a multi-column ColumnProperty attribute.

      References: #5262

    • [orm] [usecase] Introduce _orm.relationship.sync_backref flag in a relationship to control if the synchronization events that mutate the in-Python attributes are added. This supersedes the previous change #5149, which warned that viewonly=True relationship target of a back_populates or backref configuration would be disallowed.

    ... (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)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 2
  • Bump flake8 from 3.7.9 to 3.8.1

    Bump flake8 from 3.7.9 to 3.8.1

    Bumps flake8 from 3.7.9 to 3.8.1.

    Commits
    • f94e009 Release 3.8.1
    • 00985a6 Merge branch 'issue638-ouput-file' into 'master'
    • e6d8a90 options: Forward --output-file to be reparsed for BaseFormatter
    • b4d2850 Release 3.8.0
    • 03c7dd3 Merge branch 'exclude_dotfiles' into 'master'
    • 9e67511 Fix using --exclude=.* to not match . and ..
    • 6c4b5c8 Merge branch 'linters_py3' into 'master'
    • 309db63 switch dogfood to use python3
    • 8905a7a Merge branch 'logical_position_out_of_bounds' into 'master'
    • 609010c Fix logical checks which report position out of bounds
    • 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)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 2
  • Bump mkdocs-material from 4.6.3 to 5.1.6

    Bump mkdocs-material from 4.6.3 to 5.1.6

    Bumps mkdocs-material from 4.6.3 to 5.1.6.

    Release notes

    Sourced from mkdocs-material's releases.

    mkdocs-material-5.1.6

    • Added Burmese translations
    • Added general anchor offset solution using scroll-margin-top
    • Fixed #1653: Instant loading shouldn't intercept links to *.html files

    mkdocs-material-5.1.5

    • Added name attribute for social links to set link title
    • Fixed #1623: Allow arbitrary links in social links
    • Fixed #1664: Height of iframe is not adjustable
    • Fixed #1667: Sidebars are scrolled to bottom on load (bug in Chrome 81+)

    mkdocs-material-5.1.4

    • Switched to @mdi/svg Material Design icon package
    • Fixed #1655: Navigation may disappear after switching viewports
    • Fixed #1659: Unnecessary scrollbar for search results on Windows
    • Fixed occasional distortions for images with explicit dimensions
    • Fixed errors in German translations

    mkdocs-material-5.1.3

    • Fixed overflowing content area after switch to flexbox

    mkdocs-material-5.1.2

    • Added status information to search observable
    • Added status information to search modal
    • Removed announcement bar from print media
    • Removed media query packing logic due to race conditions
    • Fixed #1520: Gracefully disable search on file:// if Worker fails
    • Fixed re-submission of query after search is initialized
    • Fixed jitter of sidebars on all browsers by switching to sticky

    mkdocs-material-5.1.1

    • Added new FontAwesome icons
    • Fixed #1609: Instant loading doesn't honor target=_blank
    • Fixed GitHub stars count rounding errors
    • Fixed GitLab stars count retrieval

    mkdocs-material-5.1.0

    mkdocs-material-5.0.2

    • Added CSS source maps to distribution files
    • Fixed errors in Chinese (Traditional) translations
    • Fixed creation of stale directory on installation from git
    • Improved overflow scrolling behavior on iOS (reduced bundle size by 4kb)

    mkdocs-material-5.0.1

    • Fixed syntax error in Spanish translation
    ... (truncated)
    Changelog

    Sourced from mkdocs-material's changelog.

    mkdocs-material-5.1.6 (2020-05-09)

    • Added Burmese translations
    • Added general anchor offset solution using scroll-margin-top
    • Fixed #1653: Instant loading shouldn't intercept links to *.html files

    mkdocs-material-5.1.5 (2020-05-03)

    • Added name attribute for social links to set link title
    • Fixed #1623: Allow arbitrary links in social links
    • Fixed #1664: Height of iframe is not adjustable
    • Fixed #1667: Sidebars are scrolled to bottom on load (bug in Chrome 81+)

    mkdocs-material-5.1.4 (2020-04-30)

    • Switched to @mdi/svg Material Design icon package
    • Fixed #1655: Navigation may disappear after switching viewports
    • Fixed #1659: Unnecessary scrollbar for search results on Windows
    • Fixed occasional distortions for images with explicit dimensions
    • Fixed errors in German translations

    mkdocs-material-5.1.3 (2020-04-26)

    • Fixed overflowing content area after switch to flexbox

    mkdocs-material-5.1.2 (2020-04-26)

    • Added status information to search observable
    • Added status information to search modal
    • Removed announcement bar from print media
    • Removed media query packing logic due to race conditions
    • Fixed #1520: Gracefully disable search on file:// if Worker fails
    • Fixed re-submission of query after search is initialized
    • Fixed jitter of sidebars on all browsers by switching to sticky

    mkdocs-material-5.1.1 (2020-04-17)

    • Added new FontAwesome icons
    • Fixed #1609: Instant loading doesn't honor target=_blank
    • Fixed GitHub stars count rounding errors
    • Fixed GitLab stars count retrieval

    mkdocs-material-5.1.0 (2020-04-12)

    • Added support for icons from Markdown through mkdocs-material-extensions

    mkdocs-material-5.0.2 (2020-04-10)

    • Added CSS source maps to distribution files
    • Fixed errors in Chinese (Traditional) translations
    ... (truncated)
    Commits
    • bebf63d Prepare 5.1.6 release
    • 62abdd1 Added distribution files
    • bf43fa3 Fixed whitelisting for instant loading on localhost and Netlify previews
    • 481e511 Added Burmese translations
    • bbfaa57 Merge branch 'master' of github.com:squidfunk/mkdocs-material
    • de74821 Fixed fallback translation in case of empty string
    • 252db13 Added loading of sitemap to filter instant loading requests
    • 9a0c3e9 Added general anchor offset solution using scroll-margin-top
    • 7634369 Updated dependencies, as depandabot doesn't seem to merge automatically
    • 828877c Prepare 5.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)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 2
  • Bump pytest from 5.3.5 to 5.4.2

    Bump pytest from 5.3.5 to 5.4.2

    Bumps pytest from 5.3.5 to 5.4.2.

    Release notes

    Sourced from pytest's releases.

    5.4.2

    pytest 5.4.2 (2020-05-08)

    Bug Fixes

    • #6871: Fix crash with captured output when using the capsysbinary fixture <capsysbinary>.
    • #6924: Ensure a unittest.IsolatedAsyncioTestCase is actually awaited.
    • #6925: Fix TerminalRepr instances to be hashable again.
    • #6947: Fix regression where functions registered with TestCase.addCleanup were not being called on test failures.
    • #6951: Allow users to still set the deprecated TerminalReporter.writer attribute.
    • #6992: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist.
    • #7110: Fixed regression: asyncbase.TestCase tests are executed correctly again.
    • #7143: Fix File.from_constructor so it forwards extra keyword arguments to the constructor.
    • #7145: Classes with broken __getattribute__ methods are displayed correctly during failures.
    • #7180: Fix _is_setup_py for files encoded differently than locale.

    5.4.1

    pytest 5.4.1 (2020-03-13)

    Bug Fixes

    • #6909: Revert the change introduced by #6330, which required all arguments to @pytest.mark.parametrize to be explicitly defined in the function signature.

      The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted.

    • #6910: Fix crash when plugins return an unknown stats while using the --reportlog option.

    pytest 5.4.0 (2020-03-12)

    Breaking Changes

    • #6316: Matching of -k EXPRESSION to test names is now case-insensitive.

    • #6443: Plugins specified with -p are now loaded after internal plugins, which results in their hooks being called before the internal ones.

      This makes the -p behavior consistent with PYTEST_PLUGINS.

    • #6637: Removed the long-deprecated pytest_itemstart hook.

      This hook has been marked as deprecated and not been even called by pytest for over 10 years now.

    • #6673: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result.

    • #6737: The cached_result attribute of FixtureDef is now set to None when the result is unavailable, instead of being deleted.

    ... (truncated)
    Changelog

    Sourced from pytest's changelog.

    Commits
    • f838c7b Preparing release version 5.4.2
    • 25b53c4 Merge pull request #7188 from asottile/backport_7179
    • fc27171 Merge pull request #7189 from asottile/backport-7186
    • d18e426 Merge pull request #7186 from asottile/is_setup_py_encoding_agnostic
    • e83fa48 Merge pull request #7179 from asottile/py39
    • c53d52c Merge pull request #7174 from nicoddemus/backport-7168
    • 3886c6d Merge pull request #7168 from nicoddemus/saferepr-getattr-fail-7145
    • 80936b6 Merge pull request #7156 from nicoddemus/backport-7151
    • 5ca08e9 Merge pull request #7151 from nicoddemus/unittest-cleanup-6947
    • ba2c49e Merge pull request #7149 from nicoddemus/backport-7144
    • 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)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 2
  • Bump mkdocs-material from 4.6.3 to 5.1.5

    Bump mkdocs-material from 4.6.3 to 5.1.5

    Bumps mkdocs-material from 4.6.3 to 5.1.5.

    Release notes

    Sourced from mkdocs-material's releases.

    mkdocs-material-5.1.5

    • Added name attribute for social links to set link title
    • Fixed #1623: Allow arbitrary links in social links
    • Fixed #1664: Height of iframe is not adjustable
    • Fixed #1667: Sidebars are scrolled to bottom on load (bug in Chrome 81+)

    mkdocs-material-5.1.4

    • Switched to @mdi/svg Material Design icon package
    • Fixed #1655: Navigation may disappear after switching viewports
    • Fixed #1659: Unnecessary scrollbar for search results on Windows
    • Fixed occasional distortions for images with explicit dimensions
    • Fixed errors in German translations

    mkdocs-material-5.1.3

    • Fixed overflowing content area after switch to flexbox

    mkdocs-material-5.1.2

    • Added status information to search observable
    • Added status information to search modal
    • Removed announcement bar from print media
    • Removed media query packing logic due to race conditions
    • Fixed #1520: Gracefully disable search on file:// if Worker fails
    • Fixed re-submission of query after search is initialized
    • Fixed jitter of sidebars on all browsers by switching to sticky

    mkdocs-material-5.1.1

    • Added new FontAwesome icons
    • Fixed #1609: Instant loading doesn't honor target=_blank
    • Fixed GitHub stars count rounding errors
    • Fixed GitLab stars count retrieval

    mkdocs-material-5.1.0

    mkdocs-material-5.0.2

    • Added CSS source maps to distribution files
    • Fixed errors in Chinese (Traditional) translations
    • Fixed creation of stale directory on installation from git
    • Improved overflow scrolling behavior on iOS (reduced bundle size by 4kb)

    mkdocs-material-5.0.1

    • Fixed syntax error in Spanish translation

    mkdocs-material-5.0.0

    • Reactive architecture – try app.dialog$.next("Hi!") in the console
    • Instant loading – make Material behave like a Single Page Application
    • Improved CSS customization with CSS variables – set your brand's colors
    • Improved CSS resilience, e.g. proper sidebar locking for customized headers
    ... (truncated)
    Changelog

    Sourced from mkdocs-material's changelog.

    mkdocs-material-5.1.5 (2020-05-03)

    • Added name attribute for social links to set link title
    • Fixed #1623: Allow arbitrary links in social links
    • Fixed #1664: Height of iframe is not adjustable
    • Fixed #1667: Sidebars are scrolled to bottom on load (bug in Chrome 81+)

    mkdocs-material-5.1.4 (2020-04-30)

    • Switched to @mdi/svg Material Design icon package
    • Fixed #1655: Navigation may disappear after switching viewports
    • Fixed #1659: Unnecessary scrollbar for search results on Windows
    • Fixed occasional distortions for images with explicit dimensions
    • Fixed errors in German translations

    mkdocs-material-5.1.3 (2020-04-26)

    • Fixed overflowing content area after switch to flexbox

    mkdocs-material-5.1.2 (2020-04-26)

    • Added status information to search observable
    • Added status information to search modal
    • Removed announcement bar from print media
    • Removed media query packing logic due to race conditions
    • Fixed #1520: Gracefully disable search on file:// if Worker fails
    • Fixed re-submission of query after search is initialized
    • Fixed jitter of sidebars on all browsers by switching to sticky

    mkdocs-material-5.1.1 (2020-04-17)

    • Added new FontAwesome icons
    • Fixed #1609: Instant loading doesn't honor target=_blank
    • Fixed GitHub stars count rounding errors
    • Fixed GitLab stars count retrieval

    mkdocs-material-5.1.0 (2020-04-12)

    • Added support for icons from Markdown through mkdocs-material-extensions

    mkdocs-material-5.0.2 (2020-04-10)

    • Added CSS source maps to distribution files
    • Fixed errors in Chinese (Traditional) translations
    • Fixed creation of stale directory on installation from git
    • Improved overflow scrolling behavior on iOS (reduced bundle size by 4kb)

    mkdocs-material-5.0.1 (2020-04-07)

    • Fixed syntax error in Spanish translations
    ... (truncated)
    Commits
    • 828877c Prepare 5.1.5 release
    • db7c28b Added name attribute to social links and improved defaults
    • 1b72c9f Added workaround for Chrome bug with scroll snapping
    • 3a0b776 Fixed sidebar jumping on page load on active anchor
    • a14c68e Merge branch 'master' of github.com:squidfunk/mkdocs-material
    • 52c3daf Fixed iframe height not being adjustable
    • fcf105b Fixed link for tabbed docs (#1666)
    • 974e153 Improved filesize of banner.png (#1662)
    • 4545c17 Fixed links to issues in changelog
    • 261aa80 Update banner image
    • 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)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 2
  • Bump mkdocs-material from 4.6.3 to 5.1.4

    Bump mkdocs-material from 4.6.3 to 5.1.4

    Bumps mkdocs-material from 4.6.3 to 5.1.4.

    Release notes

    Sourced from mkdocs-material's releases.

    mkdocs-material-5.1.4

    • Switched to @mdi/svg Material Design icon package
    • Fixed #1655: Navigation may disappear after switching viewports
    • Fixed #1659: Unnecessary scrollbar for search results on Windows
    • Fixed occasional distortions for images with explicit dimensions
    • Fixed errors in German translations

    mkdocs-material-5.1.3

    • Fixed overflowing content area after switch to flexbox

    mkdocs-material-5.1.2

    • Added status information to search observable
    • Added status information to search modal
    • Removed announcement bar from print media
    • Removed media query packing logic due to race conditions
    • Fixed #1520: Gracefully disable search on file:// if Worker fails
    • Fixed re-submission of query after search is initialized
    • Fixed jitter of sidebars on all browsers by switching to sticky

    mkdocs-material-5.1.1

    • Added new FontAwesome icons
    • Fixed #1609: Instant loading doesn't honor target=_blank
    • Fixed GitHub stars count rounding errors
    • Fixed GitLab stars count retrieval

    mkdocs-material-5.1.0

    mkdocs-material-5.0.2

    • Added CSS source maps to distribution files
    • Fixed errors in Chinese (Traditional) translations
    • Fixed creation of stale directory on installation from git
    • Improved overflow scrolling behavior on iOS (reduced bundle size by 4kb)

    mkdocs-material-5.0.1

    • Fixed syntax error in Spanish translation

    mkdocs-material-5.0.0

    • Reactive architecture – try app.dialog$.next("Hi!") in the console
    • Instant loading – make Material behave like a Single Page Application
    • Improved CSS customization with CSS variables – set your brand's colors
    • Improved CSS resilience, e.g. proper sidebar locking for customized headers
    • Improved icon integration and configuration – now including over 5k icons
    • Added possibility to use any icon for logo, repository and social links
    • Search UI does not freeze anymore (moved to web worker)
    • Search index built only once when using instant loading
    • Improved extensible keyboard handling
    • Support for prebuilt search indexes
    ... (truncated)
    Changelog

    Sourced from mkdocs-material's changelog.

    mkdocs-material-5.1.4 (2020-04-30)

    • Switched to @mdi/svg Material Design icon package
    • Fixed #1655: Navigation may disappear after switching viewports
    • Fixed #1659: Unnecessary scrollbar for search results on Windows
    • Fixed occasional distortions for images with explicit dimensions
    • Fixed errors in German translations

    mkdocs-material-5.1.3 (2020-04-26)

    • Fixed overflowing content area after switch to flexbox

    mkdocs-material-5.1.2 (2020-04-26)

    • Added status information to search observable
    • Added status information to search modal
    • Removed announcement bar from print media
    • Removed media query packing logic due to race conditions
    • Fixed #1520: Gracefully disable search on file:// if Worker fails
    • Fixed re-submission of query after search is initialized
    • Fixed jitter of sidebars on all browsers by switching to sticky

    mkdocs-material-5.1.1 (2020-04-17)

    • Added new FontAwesome icons
    • Fixed #1609: Instant loading doesn't honor target=_blank
    • Fixed GitHub stars count rounding errors
    • Fixed GitLab stars count retrieval

    mkdocs-material-5.1.0 (2020-04-12)

    • Added support for icons from Markdown through mkdocs-material-extensions

    mkdocs-material-5.0.2 (2020-04-10)

    • Added CSS source maps to distribution files
    • Fixed errors in Chinese (Traditional) translations
    • Fixed creation of stale directory on installation from git
    • Improved overflow scrolling behavior on iOS (reduced bundle size by 4kb)

    mkdocs-material-5.0.1 (2020-04-07)

    • Fixed syntax error in Spanish translations

    mkdocs-material-5.0.0 (2020-04-07)

    • Reactive architecture – try app.dialog$.next("Hi!") in the console
    • Instant loading – make Material behave like a Single Page Application
    • Improved CSS customization with CSS variables – set your brand's colors
    • Improved CSS resilience, e.g. proper sidebar locking for customized headers
    ... (truncated)
    Commits
    • 36ce697 Prepare 5.1.4 release
    • 2cdddfc Fixed unnecessary scrollbar for search results on Windows
    • fe81490 Merge branch 'master' of github.com:squidfunk/mkdocs-material
    • d3452af Fixed navigation disappearing on screen after switching viewports
    • 82f2a0a Minified SVGs
    • aa8c176 Switched to community icons link
    • 384643d Adjusted icon counts
    • 0d4d5c5 Improved inlining of SVGs
    • 32d9862 Switched to @mdi/svg package for icon integration
    • 2b6359c Altered color of landing page
    • 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)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 2
  • Bump certifi from 2019.11.28 to 2022.12.7

    Bump certifi from 2019.11.28 to 2022.12.7

    Bumps certifi from 2019.11.28 to 2022.12.7.

    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)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • [BUG] cbv and path params create strange behaviour

    [BUG] cbv and path params create strange behaviour

    While using the @cbv i encountered the problem that i couldn't use the endpoint without path params on a similar path. It somehow messes with the validator, i think?

    from fastapi import APIRouter, FastAPI
    from fastapi_utils.cbv import cbv
    from pydantic.types import UUID4
    from starlette.testclient import TestClient
    
    router = APIRouter()
    
    
    @cbv(router)
    class CBV:
    
        @router.post("/test")
        def test_post(self):
            return ''
    
    
        @router.get("/test/{uuid}")
        def test_post(self, uuid: UUID4):
            return uuid
    
    
    app = FastAPI()
    app.include_router(router)
    client = TestClient(app)
    
    print(client.post("/test").json())
    

    output:

    {
      "detail":[
        {
          "loc":[
            "query",
            "self"
          ],
          "msg":"field required",
          "type":"value_error.missing"
        }
      ]
    }
    

    Expected behavior both endpoints should be just available

    Environment:

    fastapi_utils_version: 0.2.1
    fastapi_version: 0.85.2
    pydantic version: 1.10.2
    pydantic compiled: True
    install path: ...\fastapi_test\venv\Lib\site-packages\pydantic
    python version: 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)]
    platform: Windows-10-10.0.22621-SP0
    optional deps. installed: ['dotenv', 'typing-extensions']
    
    bug 
    opened by kickIDnoah 0
  • [QUESTION] What `Wall` means?

    [QUESTION] What `Wall` means?

    Description

    When you add a timing middlware I see this on the LOGs:

    INFO:app.engine:TIMING: Wall:  320.7ms | CPU:   12.7ms | app.app.users.router.create_user
    

    It is not clear what Wall means... A lot of routes the Wall and CPU values are the same, but sometimes not. I would appreciate any input why this is the case, and what wall means

    Additional context image

    question 
    opened by FilipeMarch 0
  • [QUESTION]

    [QUESTION]

    Trying to create generic CRUD class for all endpoints

    I am fairly new to FastAPI(migrating from Django) and I am trying to create a generic CRUD operations class that I can inherit and use across my CBV endpoints. Something like this :

    class AbstractCrud
          model: Base = NotImplemented
          session: Session = NotImplemented
      
          def get_items(self, limit,  **filters):
              """ Read operation """
      
          def get_item(self, pk: int):
      
      
          def create_item(self, obj: BaseModel):
              """ Create operation """
      
          def update_item(self, pk: int, **params):
              """ Update operation"""
    
    
          def delete_item(self, pk: int):
            """ Delete operation """
    
    
    router = InferringRouter()
    
    @cbv(router)
    class UserAPI(AbstractCrud):
        router.tags = ["User"]
        router.prefix = "/users"
       
        model = User
        session: Session = Depends(get_db)
    
       # my endpoints
       #e.g. @router.get(...)
    
    
    @cbv(router)
    class PostAPI(AbstractCrud):
        router.tags = ["Post"]
        router.prefix = "/posts"
    
        model = Post
        session: Session = Depends(get_db)
    
        # my endpoints
        #e.g. @router.get(...)
    
    

    I get the following error if I try to do the above: fastapi.exceptions.FastAPIError: Invalid args for response field! Hint: check that <class 'sqlalchemy.orm.decl_api.Base'> is a valid pydantic field type For now, I am able to achieve this as follows:

    class AbstractCrud
          model: Base = NotImplemented
          session: Session = NotImplemented
      
          def get_items(self, limit,  **filters):
              """ Read operation """
      
          def get_item(self, pk: int):
      
      
          def create_item(self, obj: BaseModel):
              """ Create operation """
      
          def update_item(self, pk: int, **params):
              """ Update operation"""
    
    
          def delete_item(self, pk: int):
            """ Delete operation """
            
    
    class UserCrud(AbstractCrud):
    
        def __init__(self, session: Session):
            self.session = session
            self.model = User
    
    
    class PostCrud(AbstractCrud):
    
        def __init__(self, session: Session):
            self.session = session
            self.model = Post
    
    
    router = InferringRouter()
    
    @cbv(router)
    class UserAPI:
        router.tags = ["User"]
        router.prefix = "/users"
       
        def __init__(self, session=Depends(get_db)):
            self.session = session
            self.crud = UserCrud(self.session)
    
       # my endpoints
       #e.g. @router.get(...)
    
    
    @cbv(router)
    class PostAPI:
        router.tags = ["Post"]
        router.prefix = "/posts"
    
        def __init__(self, session=Depends(get_db)):
            self.session = session
            self.crud = PostCrud(self.session)
    
        # my endpoints
        #e.g. @router.get(...)
    
    

    Although this is working fine for me now, I can't help but think if there is a better(or correct) way to do this.

    Also, Is my use of a single router variable across multiple classes correct?

    question 
    opened by nikhilnimbalkar1 0
  • [QUESTION] There's a way to add a custom decorator to a class-based view?

    [QUESTION] There's a way to add a custom decorator to a class-based view?

    I'm trying to do something like the following:

    @cbv(users_router)
    @ResponseHandler.class_decorator
    class Users:
    
        controller = UserController()
    
        @users_router.post("/users", status_code=201)
        async def create_user(self, user_data: Dict, response: Response) -> Dict:
            return self.controller.create_user(**user_data)
    
        @users_router.get("/users/{user_id}", status_code=302)
        async def get_user(self, user_id: int, response: Response) -> Dict:
            return self.controller.obtain_user(user_id)
    
        @users_router.get("/users", status_code=302)
        async def get_all_users(self, response: Response) -> Dict:
            return self.controller.obtain_all_users()
    

    The class_decorator decorator adds custom response for each one of the requests, but when I try to execute one of the services, then this error appears:

    {"detail":[{"loc":["query","self"],"msg":"field required","type":"value_error.missing"}]}
    
    question 
    opened by JesusFragoso 1
  • Don't infer `response_model` for invalid types

    Don't infer `response_model` for invalid types

    It is possible for inferring_router to raise an exception if a function uses a return type that is not a valid response_model. An example is an endpoint that returns Response instead of letting FastAPI construct one.

    This PR fixes that by only inferring the response_model if the return annotation is a valid response_model.

    Fixes #229 Fixes #172

    opened by nzig 0
Owner
David Montague
David Montague
Example app using FastAPI and JWT

FastAPI-Auth Example app using FastAPI and JWT virtualenv -p python3 venv source venv/bin/activate pip3 install -r requirements.txt mv config.yaml.exa

Sander 28 Oct 25, 2022
FastAPI Learning Example,对应中文视频学习教程:https://space.bilibili.com/396891097

视频教学地址 中文学习教程 1、本教程每一个案例都可以独立跑,前提是安装好依赖包。 2、本教程并未按照官方教程顺序,而是按照实际使用顺序编排。 Video Teaching Address FastAPI Learning Example 1.Each case in this tutorial c

null 381 Dec 11, 2022
🤪 FastAPI + Vue构建的Mall项目后台管理

Mall项目后台管理 前段时间学习Vue写了一个移动端项目 https://www.charmcode.cn/app/mall/home 然后教程到此就结束了, 我就总感觉少点什么,计划自己着手写一套后台管理。 相关项目 移动端Mall项目源码(Vue构建): https://github.com/

王小右 131 Jan 1, 2023
Backend, modern REST API for obtaining match and odds data crawled from multiple sites. Using FastAPI, MongoDB as database, Motor as async MongoDB client, Scrapy as crawler and Docker.

Introduction Apiestas is a project composed of a backend powered by the awesome framework FastAPI and a crawler powered by Scrapy. This project has fo

Fran Lozano 54 Dec 13, 2022
Backend Skeleton using FastAPI and Sqlalchemy ORM

Backend API Skeleton Based on @tiangolo's full stack postgres template, with some things added, some things removed, and some things changed. This is

David Montague 18 Oct 31, 2022
FastAPI on Google Cloud Run

cloudrun-fastapi Boilerplate for running FastAPI on Google Cloud Run with Google Cloud Build for deployment. For all documentation visit the docs fold

Anthony Corletti 139 Dec 27, 2022
FastAPI + Django experiment

django-fastapi-example This is an experiment to demonstrate one potential way of running FastAPI with Django. It won't be actively maintained. If you'

Jordan Eremieff 78 Jan 3, 2023
Auth for use with FastAPI

FastAPI Auth Pluggable auth for use with FastAPI Supports OAuth2 Password Flow Uses JWT access and refresh tokens 100% mypy and test coverage Supports

David Montague 95 Jan 2, 2023
FastAPI Boilerplate

FastAPI Boilerplate Features SQlAlchemy session Custom user class Top-level dependency Dependencies for specific permissions Celery SQLAlchemy for asy

Hide 417 Jan 7, 2023
Minimal example utilizing fastapi and celery with RabbitMQ for task queue, Redis for celery backend and flower for monitoring the celery tasks.

FastAPI with Celery Minimal example utilizing FastAPI and Celery with RabbitMQ for task queue, Redis for Celery backend and flower for monitoring the

Grega Vrbančič 371 Jan 1, 2023
A simple docker-compose app for orchestrating a fastapi application, a celery queue with rabbitmq(broker) and redis(backend)

fastapi - celery - rabbitmq - redis -> Docker A simple docker-compose app for orchestrating a fastapi application, a celery queue with rabbitmq(broker

Kartheekasasanka Kaipa 83 Dec 19, 2022
fastapi-crud-sync

Developing and Testing an API with FastAPI and Pytest Syncronous Example Want to use this project? Build the images and run the containers: $ docker-c

null 59 Dec 11, 2022
JSON-RPC server based on fastapi

Description JSON-RPC server based on fastapi: https://fastapi.tiangolo.com Motivation Autogenerated OpenAPI and Swagger (thanks to fastapi) for JSON-R

null 199 Dec 30, 2022
FastAPI Skeleton App to serve machine learning models production-ready.

FastAPI Model Server Skeleton Serving machine learning models production-ready, fast, easy and secure powered by the great FastAPI by Sebastián Ramíre

null 268 Jan 1, 2023
row level security for FastAPI framework

Row Level Permissions for FastAPI While trying out the excellent FastApi framework there was one peace missing for me: an easy, declarative way to def

Holger Frey 315 Dec 25, 2022
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
python fastapi example connection to mysql

Quickstart Then run the following commands to bootstrap your environment with poetry: git clone https://github.com/xiaozl/fastapi-realworld-example-ap

null 55 Dec 15, 2022
The template for building scalable web APIs based on FastAPI, Tortoise ORM and other.

FastAPI and Tortoise ORM. Powerful but simple template for web APIs w/ FastAPI (as web framework) and Tortoise-ORM (for working via database without h

prostomarkeloff 95 Jan 8, 2023
Ready-to-use and customizable users management for FastAPI

FastAPI Users Ready-to-use and customizable users management for FastAPI Documentation: https://frankie567.github.io/fastapi-users/ Source Code: https

François Voron 2.4k Jan 1, 2023