FastAPI framework, high performance, easy to learn, fast to code, ready for production

Overview

FastAPI

FastAPI framework, high performance, easy to learn, fast to code, ready for production

Test Coverage Package version


Documentation: https://fastapi.tiangolo.com

Source Code: https://github.com/tiangolo/fastapi


FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

The key features are:

  • Fast: Very high performance, on par with NodeJS and Go (thanks to Starlette and Pydantic). One of the fastest Python frameworks available.

  • Fast to code: Increase the speed to develop features by about 200% to 300%. *

  • Fewer bugs: Reduce about 40% of human (developer) induced errors. *

  • Intuitive: Great editor support. Completion everywhere. Less time debugging.

  • Easy: Designed to be easy to use and learn. Less time reading docs.

  • Short: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs.

  • Robust: Get production-ready code. With automatic interactive documentation.

  • Standards-based: Based on (and fully compatible with) the open standards for APIs: OpenAPI (previously known as Swagger) and JSON Schema.

* estimation based on tests on an internal development team, building production applications.

Gold Sponsors

Other sponsors

Opinions

"[...] I'm using FastAPI a ton these days. [...] I'm actually planning to use it for all of my team's ML services at Microsoft. Some of them are getting integrated into the core Windows product and some Office products."

Kabir Khan - Microsoft (ref)

"We adopted the FastAPI library to spawn a REST server that can be queried to obtain predictions. [for Ludwig]"

Piero Molino, Yaroslav Dudin, and Sai Sumanth Miryala - Uber (ref)

"Netflix is pleased to announce the open-source release of our crisis management orchestration framework: Dispatch! [built with FastAPI]"

Kevin Glisson, Marc Vilanova, Forest Monsen - Netflix (ref)

"I’m over the moon excited about FastAPI. It’s so fun!"

Brian Okken - Python Bytes podcast host (ref)

"Honestly, what you've built looks super solid and polished. In many ways, it's what I wanted Hug to be - it's really inspiring to see someone build that."

Timothy Crosley - Hug creator (ref)

"If you're looking to learn one modern framework for building REST APIs, check out FastAPI [...] It's fast, easy to use and easy to learn [...]"

"We've switched over to FastAPI for our APIs [...] I think you'll like it [...]"

Ines Montani - Matthew Honnibal - Explosion AI founders - spaCy creators (ref) - (ref)

Typer, the FastAPI of CLIs

If you are building a CLI app to be used in the terminal instead of a web API, check out Typer.

Typer is FastAPI's little sibling. And it's intended to be the FastAPI of CLIs. ⌨️ 🚀

Requirements

Python 3.6+

FastAPI stands on the shoulders of giants:

Installation

$ pip install fastapi

---> 100%

You will also need an ASGI server, for production such as Uvicorn or Hypercorn.

$ pip install uvicorn[standard]

---> 100%

Example

Create it

  • Create a file main.py with:
from typing import Optional

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
def read_root():
    return {"Hello": "World"}


@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
    return {"item_id": item_id, "q": q}
Or use async def...

If your code uses async / await, use async def:

from typing import Optional

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
async def read_root():
    return {"Hello": "World"}


@app.get("/items/{item_id}")
async def read_item(item_id: int, q: Optional[str] = None):
    return {"item_id": item_id, "q": q}

Note:

If you don't know, check the "In a hurry?" section about async and await in the docs.

Run it

Run the server with:

$ uvicorn main:app --reload

INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [28720]
INFO:     Started server process [28722]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
About the command uvicorn main:app --reload...

The command uvicorn main:app refers to:

  • main: the file main.py (the Python "module").
  • app: the object created inside of main.py with the line app = FastAPI().
  • --reload: make the server restart after code changes. Only do this for development.

Check it

Open your browser at http://127.0.0.1:8000/items/5?q=somequery.

You will see the JSON response as:

{"item_id": 5, "q": "somequery"}

You already created an API that:

  • Receives HTTP requests in the paths / and /items/{item_id}.
  • Both paths take GET operations (also known as HTTP methods).
  • The path /items/{item_id} has a path parameter item_id that should be an int.
  • The path /items/{item_id} has an optional str query parameter q.

Interactive API docs

Now go to http://127.0.0.1:8000/docs.

You will see the automatic interactive API documentation (provided by Swagger UI):

Swagger UI

Alternative API docs

And now, go to http://127.0.0.1:8000/redoc.

You will see the alternative automatic documentation (provided by ReDoc):

ReDoc

Example upgrade

Now modify the file main.py to receive a body from a PUT request.

Declare the body using standard Python types, thanks to Pydantic.

from typing import Optional

from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):
    name: str
    price: float
    is_offer: Optional[bool] = None


@app.get("/")
def read_root():
    return {"Hello": "World"}


@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
    return {"item_id": item_id, "q": q}


@app.put("/items/{item_id}")
def update_item(item_id: int, item: Item):
    return {"item_name": item.name, "item_id": item_id}

The server should reload automatically (because you added --reload to the uvicorn command above).

Interactive API docs upgrade

Now go to http://127.0.0.1:8000/docs.

  • The interactive API documentation will be automatically updated, including the new body:

Swagger UI

  • Click on the button "Try it out", it allows you to fill the parameters and directly interact with the API:

Swagger UI interaction

  • Then click on the "Execute" button, the user interface will communicate with your API, send the parameters, get the results and show them on the screen:

Swagger UI interaction

Alternative API docs upgrade

And now, go to http://127.0.0.1:8000/redoc.

  • The alternative documentation will also reflect the new query parameter and body:

ReDoc

Recap

In summary, you declare once the types of parameters, body, etc. as function parameters.

You do that with standard modern Python types.

You don't have to learn a new syntax, the methods or classes of a specific library, etc.

Just standard Python 3.6+.

For example, for an int:

item_id: int

or for a more complex Item model:

item: Item

...and with that single declaration you get:

  • Editor support, including:
    • Completion.
    • Type checks.
  • Validation of data:
    • Automatic and clear errors when the data is invalid.
    • Validation even for deeply nested JSON objects.
  • Conversion of input data: coming from the network to Python data and types. Reading from:
    • JSON.
    • Path parameters.
    • Query parameters.
    • Cookies.
    • Headers.
    • Forms.
    • Files.
  • Conversion of output data: converting from Python data and types to network data (as JSON):
    • Convert Python types (str, int, float, bool, list, etc).
    • datetime objects.
    • UUID objects.
    • Database models.
    • ...and many more.
  • Automatic interactive API documentation, including 2 alternative user interfaces:
    • Swagger UI.
    • ReDoc.

Coming back to the previous code example, FastAPI will:

  • Validate that there is an item_id in the path for GET and PUT requests.
  • Validate that the item_id is of type int for GET and PUT requests.
    • If it is not, the client will see a useful, clear error.
  • Check if there is an optional query parameter named q (as in http://127.0.0.1:8000/items/foo?q=somequery) for GET requests.
    • As the q parameter is declared with = None, it is optional.
    • Without the None it would be required (as is the body in the case with PUT).
  • For PUT requests to /items/{item_id}, Read the body as JSON:
    • Check that it has a required attribute name that should be a str.
    • Check that it has a required attribute price that has to be a float.
    • Check that it has an optional attribute is_offer, that should be a bool, if present.
    • All this would also work for deeply nested JSON objects.
  • Convert from and to JSON automatically.
  • Document everything with OpenAPI, that can be used by:
    • Interactive documentation systems.
    • Automatic client code generation systems, for many languages.
  • Provide 2 interactive documentation web interfaces directly.

We just scratched the surface, but you already get the idea of how it all works.

Try changing the line with:

    return {"item_name": item.name, "item_id": item_id}

...from:

        ... "item_name": item.name ...

...to:

        ... "item_price": item.price ...

...and see how your editor will auto-complete the attributes and know their types:

editor support

For a more complete example including more features, see the Tutorial - User Guide.

Spoiler alert: the tutorial - user guide includes:

  • Declaration of parameters from other different places as: headers, cookies, form fields and files.
  • How to set validation constraints as maximum_length or regex.
  • A very powerful and easy to use Dependency Injection system.
  • Security and authentication, including support for OAuth2 with JWT tokens and HTTP Basic auth.
  • More advanced (but equally easy) techniques for declaring deeply nested JSON models (thanks to Pydantic).
  • Many extra features (thanks to Starlette) as:
    • WebSockets
    • GraphQL
    • extremely easy tests based on requests and pytest
    • CORS
    • Cookie Sessions
    • ...and more.

Performance

Independent TechEmpower benchmarks show FastAPI applications running under Uvicorn as one of the fastest Python frameworks available, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)

To understand more about it, see the section Benchmarks.

Optional Dependencies

Used by Pydantic:

Used by Starlette:

  • requests - Required if you want to use the TestClient.
  • aiofiles - Required if you want to use FileResponse or StaticFiles.
  • jinja2 - Required if you want to use the default template configuration.
  • python-multipart - Required if you want to support form "parsing", with request.form().
  • itsdangerous - Required for SessionMiddleware support.
  • pyyaml - Required for Starlette's SchemaGenerator support (you probably don't need it with FastAPI).
  • graphene - Required for GraphQLApp support.
  • ujson - Required if you want to use UJSONResponse.

Used by FastAPI / Starlette:

  • uvicorn - for the server that loads and serves your application.
  • orjson - Required if you want to use ORJSONResponse.

You can install all of these with pip install fastapi[all].

License

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

Comments
  • CORSMiddleware not work

    CORSMiddleware not work

    Hi, I searched the FastAPI documentation( https://fastapi.tiangolo.com/tutorial/cors/). But get errors: Access to XMLHttpRequest at "http://127.0.0.1:8086/api" from origin "http://www.example.com" has been blocked by CORS policy:Response to preflight request doesn't pass access control check:No 'Access-Control-Allow-Origin' header is present on the requeste resource.

    "http://127.0.0.1:8086/api" and "http://www.example.com" are in same pc.

    from fastapi import FastAPI from starlette.middleware.cors import CORSMiddleware

    app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=["*"],
    allow_credentials=True, allow_methods=["*"], allow_headers=["*"], )

    question answered 
    opened by LYH8112 88
  • [FEATURE] msgpack response if client asks for application/x-msgpack

    [FEATURE] msgpack response if client asks for application/x-msgpack

    hi, we are in the process of evaling fastapi for a large app migration from flask. Quick question on a very interesting and useful piece of functionality. This builds upon the validations you have created for encoding json data and will be very useful for us out-of-the-box.

    https://msgpack.org/index.html is an enhancement to json which is highly compressed. There are some benchmarks that show it is as fast as protocol buffers...while making it a drop-in alternative to json.

    msgpack is very important for Asia which are highly internet bandwidth constrained. We are prepared to tradeoff speed in exchange for lesser bandwidth (e.g. http://indiegamr.com/cut-your-data-exchange-traffic-by-up-to-50-with-one-line-of-code-msgpack-vs-json/ )

    To be fair, it may be same size as gzipped json responses...but after having done android app deployments over a million devices in the field in asia, we realized that one has to write custom compression/decompression for gzipped json response handling. However msgpack has fairly well supported libraries.

    msgpack is fairly production ready. Lots of downstream python libraries use it in production - https://github.com/0rpc/zerorpc-python

    This enhancement request is for fastapi to respond in msgpack if the requesting client ask for the mimetype application/x-msgpack. The default behavior continues to be the same as currently.

    There is no impact to any client of a fastapi deployment unless they specifically ask for msgpack (in which case, they will get better performance).

    I'm also pasting some criticisms of msgpack and comparisons with competing/derived json formats like CBOR

    • https://news.ycombinator.com/item?id=14067747
    • http://zderadicka.eu/comparison-of-json-like-serializations-json-vs-ubjson-vs-messagepack-vs-cbor/
    • https://techtutorialsx.com/2019/06/20/esp32-arduinojson-messagepack-serialization/
    • https://gist.github.com/frsyuki/2908191
    • https://prataprc.github.io/msgpack-vs-cbor.html
    enhancement 
    opened by sandys 76
  • [QUESTION] Dependency Injection - Singleton?

    [QUESTION] Dependency Injection - Singleton?

    Don't you think the dependency injection framework needs a singleton type?

    I checked the documentation and as I can see there is no option for creating a class as a singleton. If I want to pass in a class as a dependency it will be created every time. So a feature to create singleton and if that already exists just pass it in as a dependency would be great. Because if you create a huge dependency tree than you have to specify one-by-one to make singletons.

    Maybe I missed something how to do that but if not that could be a new feature.

    question 
    opened by Gui-greg 44
  • BrokenResourceError

    BrokenResourceError

    First Check

    • [X] I added a very descriptive title to this issue.
    • [X] I used the GitHub search to find a similar issue and didn't find it.
    • [X] I searched the FastAPI documentation, with the integrated search.
    • [X] I already searched in Google "How to X in FastAPI" and didn't find any information.
    • [X] I already read and followed all the tutorial in the docs and didn't find an answer.
    • [X] I already checked if it is not related to FastAPI but to Pydantic.
    • [X] I already checked if it is not related to FastAPI but to Swagger UI.
    • [X] I already checked if it is not related to FastAPI but to ReDoc.

    Commit to Help

    • [x] I commit to help with one of those options 👆

    Example Code

    app.py

    import time
    import uvicorn
    from fastapi import FastAPI, Request
    from fastapi.middleware.cors import CORSMiddleware
    
    
    app = FastAPI()
    
    
    @app.middleware("http")
    async def middleware(request: Request, call_next):
        return await call_next(request)
    
    
    @app.get("/")
    def read_root():
        time.sleep(4)
        return {"Hello": "World"}
    
    
    if __name__ == "__main__":
        uvicorn.run(app="app:app", port=8000)
    

    script.py

    import requests as requests
    
    r = requests.get(f"http://127.0.0.1:8000", timeout=2)
    

    Description

    If you trigger script.py, error will appear. After upgrade fastapi to 0.70.0 In some requests in our application its apearing this error. So what we can do? What is problem?

    ERROR:    Exception in ASGI application
    Traceback (most recent call last):
      File "venv/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 398, in run_asgi
        result = await app(self.scope, self.receive, self.send)
      File "venv/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
        return await self.app(scope, receive, send)
      File "venv/lib/python3.8/site-packages/fastapi/applications.py", line 208, in __call__
        await super().__call__(scope, receive, send)
      File "venv/lib/python3.8/site-packages/starlette/applications.py", line 112, in __call__
        await self.middleware_stack(scope, receive, send)
      File "venv/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
        raise exc
      File "venv/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
        await self.app(scope, receive, _send)
      File "venv/lib/python3.8/site-packages/starlette/middleware/base.py", line 57, in __call__
        task_group.cancel_scope.cancel()
      File "venv/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 567, in __aexit__
        raise exceptions[0]
      File "venv/lib/python3.8/site-packages/starlette/middleware/base.py", line 30, in coro
        await self.app(scope, request.receive, send_stream.send)
      File "venv/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
        raise exc
      File "venv/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
        await self.app(scope, receive, sender)
      File "venv/lib/python3.8/site-packages/starlette/routing.py", line 656, in __call__
        await route.handle(scope, receive, send)
      File "venv/lib/python3.8/site-packages/starlette/routing.py", line 259, in handle
        await self.app(scope, receive, send)
      File "venv/lib/python3.8/site-packages/starlette/routing.py", line 64, in app
        await response(scope, receive, send)
      File "venv/lib/python3.8/site-packages/starlette/responses.py", line 139, in __call__
        await send({"type": "http.response.body", "body": self.body})
      File "venv/lib/python3.8/site-packages/starlette/exceptions.py", line 68, in sender
        await send(message)
      File "venv/lib/python3.8/site-packages/anyio/streams/memory.py", line 205, in send
        raise BrokenResourceError
    anyio.BrokenResourceError
    

    Operating System

    Linux

    Operating System Details

    No response

    FastAPI Version

    0.70.0

    Python Version

    3.8

    Additional Context

    No response

    question answered 
    opened by SarloAkrobata 43
  • [QUESTION] Using pydantic models for GET request query params? Currently not possible, have to use dataclasses or normal classes.

    [QUESTION] Using pydantic models for GET request query params? Currently not possible, have to use dataclasses or normal classes.

    Description

    Is there a way to use pydantic models for GET requests? I would like to have a similar interface for both query params and for the body. So for instance, an example could look like this:

    class PingArgs(BaseModel):
        """Model input for PingArgs."""
    
        dt: datetime.datetime = ...
        to_sum: List[int] = ...
    
        @validator("dt", pre=False, always=True, whole=True)
        def validate_dt(cls, v, values):
            """Validate dt."""
            parsed_dt = v.replace(tzinfo=None)
            return parsed_dt
    
    @router.get("/ping", tags=["basic"])
    def ping(args: PingArgs, request: Request):
        """Example."""
        return JSONResponse(
            status_code=starlette.status.HTTP_200_OK,
            content={"detail": "pong", "dt": args.dt.isoformat() "summed": sum(x for x in args.to_sum)},
        )
    

    Where as, right now I think you would have to do something like this:

    @router.get("/ping", tags=["basic"])
    def ping(dt: datetime.datetime = Query(None), to_sum: List[int] = Query(None), request: Request):
        """Example."""
        parsed_dt = dt.replace(tzinfo=None)
        
        return JSONResponse(
            status_code=starlette.status.HTTP_200_OK,
            content={"detail": "pong", "dt": dt.isoformat() "summed": sum(x for x in to_sum)},
        )
    

    Hope this can be clarified.

    question 
    opened by LasseGravesen 42
  • Add startup/shutdown dependencies and dependency caching lifespan control

    Add startup/shutdown dependencies and dependency caching lifespan control

    Issues this addresses

    • #2057
    • #617
    • #2697

    To address these issues, this PR provides for more advanced dependency injection concepts. In particular:

    • Gives users the ability to set a cache scope so that values can be cached for the app's lifetime instead of just a single request.
    • Give users control over when teardown is run for dependencies with yield. It can now be run during app shutdown, after the response is sent (current default) or right before the response is sent (#2697)

    Finally, this PR gives lifespan events (startup/shutdown) the dependency injection.

    These changes are presented together for cohesiveness (they aren't very useful individually), but they can easily be split into multiple smaller PRs for easier review.

    Here's a small motivating example:

    from asyncpg import create_pool, Connection, Pool
    from fastapi import Depends, FastAPI
    from pydantic import BaseSettings
    
    
    class Config(BaseSettings):
        dsn: str
    
    
    def get_config() -> Config:
        return Config()
    
    
    async def get_connection_pool(cfg: Config = Depends(get_config)) -> Pool:
        async with create_pool(dsn=cfg.dsn) as pool:
            yield pool
    
    
    async def get_connection(pool: Pool = Depends(get_connection_pool, lifetime="app", cache="app")) -> Connection:
        async with pool.acquire() as conn:
            yield conn
    
    
    async def check_db_connection(conn: Connection = get_connection()) -> None:
        assert (await conn.execute("SELECT 1;")) == 1
    
    
    app = FastAPI(on_startup=[check_db_connection])
    
    
    @app.get("/")
    async def root(conn: Connection = get_connection()) -> int:
        return await conn.execute("SELECT 2;")  # or some other real query
    
    
    opened by adriangb 39
  • 🐛 Prefer custom encoder over defaults if specified in `jsonable_encoder`

    🐛 Prefer custom encoder over defaults if specified in `jsonable_encoder`

    In encoders.py/jsonable_encoder, default encoders for each type are specified first & are used in preference to custom encoders.

    This affects custom encoders specified for certain types like enums such that the default encoder is always executed and any custom encoders specified are ignored. See - https://github.com/tiangolo/fastapi/issues/1986 - for a description of this issue and example code as well that illustrates the problem.

    This PR adds a change to prefer custom encoders if specified in preference to default encoders.

    Disclaimer - I am completely new to this code base :-)

    opened by viveksunder 38
  • [QUESTION] Are there plans to make class-based-views a first-class feature?

    [QUESTION] Are there plans to make class-based-views a first-class feature?

    Description

    Hi @tiangolo! First off kudos on FastAPI, beautiful stuff. My team (about a dozen backenders, pinging one here @gvbgduh) are in the midst of porting out Py2 services to Py3 and thought it'd be a good time to move away from Flask and Flask-RESTful and into something that makes better use of the Py3 features (predominantly async). Thus far FastAPI/Starlette is the top contender but the one feature we're missing the most is class-based-views (CBVs) as opposed to the defacto function-based-views (FBVs). Thus we were wondering if there's any plans to introduce CBVs as a first-class feature in FastAPI.

    While we know Starlette plays well with CBVs we looove the automagical features FastAPI offers like validation, OpenAPI generation, etc, things we had to do in very round-about ways prior.

    Way we see it CBVs have the following primary perks:

    • Centralised routing since you tend to declare the different routes in one place, typically after instantiating the application.
    • Code reusability since you can easily do OOP and inherit (eg through mixins) or compose common functionality around.
    • Would make it much easier to port existing CBVs to FastAPI since we'd be coming from Flask-RESTful.

    Thus far we've found we can 'hack' CBVs into FastAPI as such:

    from typing import Dict
    
    import fastapi
    from starlette.endpoints import HTTPEndpoint
    
    from app.services.api.models import Something
    
    
    app = fastapi.FastAPI(debug=True)
    
    
    class ResourceRoot(HTTPEndpoint):
        def get(self):
            # do stuff
    
    
    class ResourceSomething(HTTPEndpoint):
    
        def get(self, some_id: str) -> Dict:
            # do stuff
    
        def post(self, something: Something) -> None:
            # do stuff
    
    
    resource_root = ResourceRoot(scope={"type": "http"})
    resource_something = ResourceSomething(scope={"type": "http"})
    app.add_api_route(
        path="/",
        endpoint=resource_root.get,
        methods=["GET"],
    )
    app.add_api_route(
        path="/something",
        endpoint=resource_something.post,
        methods=["POST"]
    )
    app.add_api_route(
        path="/something/{some_id}",
        endpoint=resource_something.get,
        methods=["GET"]
    )
    

    and as far as we can tell we're maintaining the FastAPI fanciness but it might be a little confusing for our devs. Is there a better way to do this?

    question 
    opened by somada141 38
  • Very poor performance does not align with marketing

    Very poor performance does not align with marketing

    I wanted to check the temperature of this project and so I ran a quick, very simple, benchmark with wrk and the default example:

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    

    Everything default with wrk, regular Ubuntu Linux, Python 3.8.2, latest FastAPI as of now.

    wrk http://localhost:8000

    Uvicorn with logging disabled (obviously), as per the README:

    python3 -m uvicorn fast:app --log-level critical

    I get very poor performance, way worse than Node.js and really, really far from Golang:

    Running 10s test @ http://localhost:8000
      2 threads and 10 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency     1.83ms  365.59us   3.90ms   75.34%
        Req/Sec     2.74k   116.21     2.98k    65.00%
      54447 requests in 10.00s, 7.37MB read
    Requests/sec:   5442.89
    Transfer/sec:    754.78KB
    

    This machine can do 400k req/sec on one single thread using other software, so 5k is not at all fast. Even Node.js does 20-30k on this machine, so this does not align at all with the README:

    The key features are:
    
    Fast: Very high performance, on par with NodeJS and Go (thanks to Starlette and Pydantic). One of the fastest Python frameworks available.
    

    Where do you post benchmarks? How did you come to that conclusion? I cannot see you have posted any benchmarks at all?

    Please fix marketing, it is not at all true.

    question 
    opened by ghost 37
  • 🙏 Find maintainers for FastAPI

    🙏 Find maintainers for FastAPI

    First Check

    • [X] I added a very descriptive title to this issue.
    • [X] I used the GitHub search to find a similar issue and didn't find it.
    • [X] I searched the FastAPI documentation, with the integrated search.
    • [X] I already searched in Google "How to X in FastAPI" and didn't find any information.
    • [X] I already read and followed all the tutorial in the docs and didn't find an answer.
    • [X] I already checked if it is not related to FastAPI but to Pydantic.
    • [X] I already checked if it is not related to FastAPI but to Swagger UI.
    • [X] I already checked if it is not related to FastAPI but to ReDoc.

    Commit to Help

    • [X] I commit to help with one of those options 👆

    Description

    At the moment, all contributions to the FastAPI are made with @tiangolo (directly or through a PR review).

    @tiangolo is doing a great job 💪, but fast developing project with great community like FastAPI demand much more time.
    (It can be seen by the number of open issues and pull request)

    Wanted Solution

    Suggestion is to find several active community members and add them to the repository maintainers, as other projects (e.g. Flask and Django) do. 👨‍👩‍👧‍👦

    This will help the development of the project and make the atmosphere for third-party contributors much more pleasant. 👾

    Hope @tiangolo will consider this possibility

    upd: discussion on this #3970

    Wanted Code

    from fastapi.community import active_members  
    
    active_members.make_maintainers()
    
    enhancement answered 
    opened by k4black 36
  • Implement OAuth2 authorization_code integration

    Implement OAuth2 authorization_code integration

    FastAPI currently implements the password flow grant. While this is sufficient for building applications that self-host identity, it is not the recommended OAuth2 implementation. It is also not preferred when attempting to use external identity providers. This PR would allow three-legged OAuth to be utilized by FastAPI with the OpenAPI integration.

    This is a working implementation: https://github.com/kuwv/python-microservices https://tools.ietf.org/html/draft-ietf-oauth-security-topics-13#section-3.4 (edit: grammar, references)

    opened by kuwv 34
  • Add Armenian translation for docs/index.md

    Add Armenian translation for docs/index.md

    Hi, Ողջույն !!! HY

    This is a PR to translate docs/index.md to armenian .

    It includes only main page translation as recommended in 📝 Development - Contributing docs

    You can track armenianHY translations on this issue: https://github.com/tiangolo/fastapi/issues/5839.

    opened by har8 2
  • Initiate Armenian translation

    Initiate Armenian translation

    Hi, Ողջույն !!! HY

    This is a PR to initiate the armenian documentation. It includes only files generated by python ./scripts/docs.py new-lang hy according to 📝 Development - Contributing docs

    You can track armenianHY translations on this issue: https://github.com/tiangolo/fastapi/issues/5839.

    opened by har8 1
  • Only one of multiple Background Tasks is ever being run per request

    Only one of multiple Background Tasks is ever being run per request

    First Check

    • [X] I added a very descriptive title to this issue.
    • [X] I used the GitHub search to find a similar issue and didn't find it.
    • [X] I searched the FastAPI documentation, with the integrated search.
    • [X] I already searched in Google "How to X in FastAPI" and didn't find any information.
    • [X] I already read and followed all the tutorial in the docs and didn't find an answer.
    • [X] I already checked if it is not related to FastAPI but to Pydantic.
    • [X] I already checked if it is not related to FastAPI but to Swagger UI.
    • [X] I already checked if it is not related to FastAPI but to ReDoc.

    Commit to Help

    • [X] I commit to help with one of those options 👆

    Example Code

    from fastapi import APIRouter, BackgroundTasks
    
    router = APIRouter()
    
    def test_func(s: str) -> bool:
        print(f"~~~ test_func: {s}")
        return True
    
    
    @router.get(
        "/test",
    )
    def get_test(background_tasks: BackgroundTasks) -> dict:
        background_tasks.add_task(test_func, "one") # Only this task's output will be logged
        background_tasks.add_task(test_func, "two")
        background_tasks.add_task(test_func, "three")
        return {"message": "test"}
    

    Description

    • I add multiple background tasks when calling my API endpoint
    • I expect each added task to be performed
    • Instead, only the first task added appears to ever be run, as indicated by only the first log message appearing

    Operating System

    Linux

    Operating System Details

    Running via Docker on the python:3.10.2 base image.

    FastAPI Version

    0.85.0

    Python Version

    3.10.2

    Additional Context

    Uvicorn command being used to start the app is:

    uvicorn --host=0.0.0.0 --port=8002 app.main:app
    
    question 
    opened by EthanML 2
  • ⬆ Bump dawidd6/action-download-artifact from 2.24.2 to 2.24.3

    ⬆ Bump dawidd6/action-download-artifact from 2.24.2 to 2.24.3

    Bumps dawidd6/action-download-artifact from 2.24.2 to 2.24.3.

    Commits
    • bd10f38 Merge pull request #218 from dawidd6/dependabot-npm_and_yarn-adm-zip-0.5.10
    • 61a654a build(deps): bump adm-zip from 0.5.9 to 0.5.10
    • dcadc4b Merge pull request #211 from koplo199/master
    • ceeb280 Remove unnecessary semicolon
    • 806bb52 Catch 'Artifact has expired' error
    • 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)
    dependencies github_actions 
    opened by dependabot[bot] 0
  • Required Body argument with None is not supported

    Required Body argument with None is not supported

    First Check

    • [X] I added a very descriptive title to this issue.
    • [X] I used the GitHub search to find a similar issue and didn't find it.
    • [X] I searched the FastAPI documentation, with the integrated search.
    • [X] I already searched in Google "How to X in FastAPI" and didn't find any information.
    • [X] I already read and followed all the tutorial in the docs and didn't find an answer.
    • [X] I already checked if it is not related to FastAPI but to Pydantic.
    • [X] I already checked if it is not related to FastAPI but to Swagger UI.
    • [X] I already checked if it is not related to FastAPI but to ReDoc.

    Commit to Help

    • [x] I commit to help with one of those options 👆

    Example Code

    from fastapi import FastAPI, Body
    from typing import Optional
    
    app = FastAPI()
    
    @app.post("/")
    def post_data(data: Union[str, None] = Body(...)):
          pass
    

    Description

    According to the documentation, it is possible to handle a None value for required argument provided by the user. First of all, the example in the documentation doesn't really make sense, since a Python None (i.e. a JSON null) can not be provided in the query a GET request, but has to be sent through the body of a POST/PUT request. Nevertheless, this is my use case: I have a POST endpoint, with a required (without default) argument, but I want the user to be able to send a null value. There has been a issue (https://github.com/tiangolo/fastapi/issues/1661) for 2 years exactly about this point. It has been claimed, that this is solved in 0.85.1, but I claim that this is not. I report here below more or less the same MWE:

    • store the above code in a file example.py
    • start the fastapi server with uvicorn example:app
    • send a POST request with:
    $ curl -X POST "http://localhost:8000/" -d 'null' -H "Content-Type: application/json"
    {"detail":[{"loc":["body"],"msg":"field required","type":"value_error.missing"}]}
    

    Expected would be:

    $ curl -X POST "http://localhost:8000/" -d 'null' -H "Content-Type: application/json"
    null
    

    I tried with other (more recent) versions of fastapi without more success.

    Operating System

    Linux

    Operating System Details

    No response

    FastAPI Version

    0.85.1

    Python Version

    Python 3.9.2

    Additional Context

    No response

    question 
    opened by roynico 1
  • [FEATURE] Armenian translations

    [FEATURE] Armenian translations

    First Check

    • [X] I added a very descriptive title to this issue.
    • [X] I used the GitHub search to find a similar issue and didn't find it.
    • [X] I searched the FastAPI documentation, with the integrated search.
    • [X] I already searched in Google "How to X in FastAPI" and didn't find any information.
    • [X] I already read and followed all the tutorial in the docs and didn't find an answer.
    • [X] I already checked if it is not related to FastAPI but to Pydantic.
    • [X] I already checked if it is not related to FastAPI but to Swagger UI.
    • [X] I already checked if it is not related to FastAPI but to ReDoc.

    Commit to Help

    • [X] I commit to help with one of those options 👆

    Example Code

    from typing import Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: Union[bool, None] = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Union[str, None] = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    def update_item(item_id: int, item: Item):
        return {"item_name": item.name, "item_id": item_id}
    

    Description

    Hi - Ողջույն HY Welcome to the issue that coordinates the Armenian translation effort.

    Purpose Avoiding several people working on the same document at the same time. The first person who declares that he/she is working on a translation gets the responsibility to carry it out. If a PR seems to be stalled, we can discuss a transfer of responsibility here.

    Enforcing best practices Best practices are listed later in this description. You can propose your practice at any time, ideally with a supporting source and an example.

    Defining and sharing best practices will help to avoid common mistakes and will allow faster and easier reviews.

    Help and build the community Do not hesitate to ask any questions regarding the Armenian translation effort here. The stronger the community, the more effective we will be and the more we will enjoy.

    Provide an Armenian translation for this awesome library (last but not least) If you are here, you probably like FastAPI, and maybe you even speak Armenian. Giving more people the opportunity to get started using the documentation in its native language will encourage adoption. In that spirit, let's contribute to the magic of open source in this way.

    How to contribute Review Keep in mind that the easiest way to participate is to review the PRs. We need to avoid accumulating PRs waiting for review.

    Translate If you are not familiar with contributing to open source projects have a look at https://github.com/firstcontributions/first-contributions.

    In any case, take a look at the documentation section related to the contribution and more precisely the part about the documentation.

    Once you are decided to translate a document, make yourself known here by leaving a message here.

    Organize If you wish, your energy is welcome to help with the organization. Bringing together motivated people and helping them get the job done is essential. Moreover, we can surely learn a lot from the translation work of other languages that are much more advanced and we can have a significant impact if we put good processes in place that can help the whole community

    Good practices technical terms Technical terms do not need to be translated. It is also a question of common sense, in certain conditions English can be preferred because the Armenian version is not in use.

    structure the PR by commit Splitting the commit will ease the review and helps to track the change on the original documentation while the PR is open.

    The first commit should only contain the copy of the English version of the document to the Armenian one. With the exact same content.

    The second one is dedicated the index update.

    Also, if the English document got updated, we just have to update the first commit and the conflicts will reveal updated part of the document 🪄

    Wanted Solution

    Support to FastAPI open source framework by translating the documentations into Armenian.

    Wanted Code

    from typing import Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: Union[bool, None] = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Union[str, None] = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    def update_item(item_id: int, item: Item):
        return {"item_name": item.name, "item_id": item_id}
    

    Alternatives

    No response

    Operating System

    Linux

    Operating System Details

    Ubuntu 22.10 x 64

    FastAPI Version

    0.88.0

    Python Version

    3.10.7

    Additional Context

    No response

    enhancement 
    opened by har8 2
Releases(0.88.0)
  • 0.88.0(Nov 27, 2022)

    Upgrades

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

    Docs

    • ✏️ Fix typo in docs for docs/en/docs/advanced/middleware.md. PR #5376 by @rifatrakib.

    Translations

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

    Internal

    Source code(tar.gz)
    Source code(zip)
  • 0.87.0(Nov 13, 2022)

    Highlights of this release:

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

    Features

    Docs

    Translations

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

    Internal

    Source code(tar.gz)
    Source code(zip)
  • 0.86.0(Nov 3, 2022)

    Features

    Fixes

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

    Docs

    Translations

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

    Internal

    • 👷 Update FastAPI People to exclude bots: pre-commit-ci, dependabot. PR #5586 by @tiangolo.
    • 🎨 Format OpenAPI JSON in test_starlette_exception.py. PR #5379 by @iudeen.
    • 👷 Switch from Codecov to Smokeshow plus pytest-cov to pure coverage for internal tests. PR #5583 by @tiangolo.
    • 👥 Update FastAPI People. PR #5571 by @github-actions[bot].
    Source code(tar.gz)
    Source code(zip)
  • 0.85.2(Oct 31, 2022)

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

    Docs

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

    Translations

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

    Internal

    Source code(tar.gz)
    Source code(zip)
  • 0.85.1(Oct 14, 2022)

  • 0.85.0(Sep 15, 2022)

    Features

    • ⬆ Upgrade version required of Starlette from 0.19.1 to 0.20.4. Initial PR #4820 by @Kludex.
      • This includes several bug fixes in Starlette.
    • ⬆️ Upgrade Uvicorn max version in public extras: all. From >=0.12.0,<0.18.0 to >=0.12.0,<0.19.0. PR #5401 by @tiangolo.

    Internal

    • ⬆️ Upgrade dependencies for doc and dev internal extras: Typer, Uvicorn. PR #5400 by @tiangolo.
    • ⬆️ Upgrade test dependencies: Black, HTTPX, databases, types-ujson. PR #5399 by @tiangolo.
    • ⬆️ Upgrade mypy and tweak internal type annotations. PR #5398 by @tiangolo.
    • 🔧 Update test dependencies, upgrade Pytest, move dependencies from dev to test. PR #5396 by @tiangolo.
    Source code(tar.gz)
    Source code(zip)
  • 0.84.0(Sep 14, 2022)

    Breaking Changes

    This version of FastAPI drops support for Python 3.6. 🔥 Please upgrade to a supported version of Python (3.7 or above), Python 3.6 reached the end-of-life a long time ago. 😅☠

    • 🔧 Update package metadata, drop support for Python 3.6, move build internals from Flit to Hatch. PR #5240 by @ofek.
    Source code(tar.gz)
    Source code(zip)
  • 0.83.0(Sep 11, 2022)

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

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

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

    Features

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

    Fixes

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

    Docs

    Internal

    Source code(tar.gz)
    Source code(zip)
  • 0.82.0(Sep 4, 2022)

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

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

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

    Features

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

    Fixes

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

    Docs

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

    Translations

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

    Internal

    Source code(tar.gz)
    Source code(zip)
  • 0.81.0(Aug 26, 2022)

    Features

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

    Fixes

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

    Docs

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

    Translations

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

    Internal

    • ⬆ Bump dawidd6/action-download-artifact from 2.21.1 to 2.22.0. PR #5258 by @dependabot[bot].
    • ⬆ [pre-commit.ci] pre-commit autoupdate. PR #5196 by @pre-commit-ci[bot].
    • 🔥 Delete duplicated tests in tests/test_tutorial/test_sql_databases/test_sql_databases.py. PR #5040 by @raccoonyy.
    • ♻ Simplify internal RegEx in fastapi/utils.py. PR #5057 by @pylounge.
    • 🔧 Fix Type hint of auto_error which does not need to be Optional[bool]. PR #4933 by @DavidKimDY.
    • 🔧 Update mypy config, use strict = true instead of manual configs. PR #4605 by @michaeloliverx.
    • ♻ Change a dict() for {} in fastapi/utils.py. PR #3138 by @ShahriyarR.
    • ♻ Move internal variable for errors in jsonable_encoder to put related code closer. PR #4560 by @GuilleQP.
    • ♻ Simplify conditional assignment in fastapi/dependencies/utils.py. PR #4597 by @cikay.
    • ⬆ Upgrade version pin accepted for Flake8, for internal code, to flake8 >=3.8.3,<6.0.0. PR #4097 by @jamescurtin.
    • 🍱 Update Jina banner, fix typo. PR #5301 by @tiangolo.
    Source code(tar.gz)
    Source code(zip)
  • 0.80.0(Aug 23, 2022)

    Breaking Changes - Fixes

    • 🐛 Fix response_model not invalidating None. PR #2725 by @hukkin.

    If you are using response_model with some type that doesn't include None but the function is returning None, it will now raise an internal server error, because you are returning invalid data that violates the contract in response_model. Before this release it would allow breaking that contract returning None.

    For example, if you have an app like this:

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    class Item(BaseModel):
        name: str
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    app = FastAPI()
    
    @app.get("/items/invalidnone", response_model=Item)
    def get_invalid_none():
        return None
    

    ...calling the path /items/invalidnone will raise an error, because None is not a valid type for the response_model declared with Item.

    You could also be implicitly returning None without realizing, for example:

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    class Item(BaseModel):
        name: str
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    app = FastAPI()
    
    @app.get("/items/invalidnone", response_model=Item)
    def get_invalid_none():
        if flag:
            return {"name": "foo"}
        # if flag is False, at this point the function will implicitly return None
    

    If you have path operations using response_model that need to be allowed to return None, make it explicit in response_model using Union[Something, None]:

    from typing import Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    class Item(BaseModel):
        name: str
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    app = FastAPI()
    
    @app.get("/items/invalidnone", response_model=Union[Item, None])
    def get_invalid_none():
        return None
    

    This way the data will be correctly validated, you won't have an internal server error, and the documentation will also reflect that this path operation could return None (or null in JSON).

    Fixes

    • ⬆ Upgrade Swagger UI copy of oauth2-redirect.html to include fixes for flavors of authorization code flows in Swagger UI. PR #3439 initial PR by @koonpeng.
    • ♻ Strip empty whitespace from description extracted from docstrings. PR #2821 by @and-semakin.
    • 🐛 Fix cached dependencies when using a dependency in Security() and other places (e.g. Depends()) with different OAuth2 scopes. PR #2945 by @laggardkernel.
    • 🎨 Update type annotations for response_model, allow things like Union[str, None]. PR #5294 by @tiangolo.

    Translations

    • 🌐 Fix typos in German translation for docs/de/docs/features.md. PR #4533 by @0xflotus.
    • 🌐 Add missing navigator for encoder.md in Korean translation. PR #5238 by @joonas-yoon.
    • (Empty PR merge by accident) #4913.
    Source code(tar.gz)
    Source code(zip)
  • 0.79.1(Aug 18, 2022)

    Fixes

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

    Docs

    Translations

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

    Internal

    Source code(tar.gz)
    Source code(zip)
  • 0.79.0(Jul 14, 2022)

    Fixes - Breaking Changes

    • 🐛 Fix removing body from status codes that do not support it. PR #5145 by @tiangolo.
      • Setting status_code to 204, 304, or any code below 200 (1xx) will remove the body from the response.
      • This fixes an error in Uvicorn that otherwise would be thrown: RuntimeError: Response content longer than Content-Length.
      • This removes fastapi.openapi.constants.STATUS_CODES_WITH_NO_BODY, it is replaced by a function in utils.

    Translations

    • 🌐 Start of Hebrew translation. PR #5050 by @itay-raveh.
    • 🔧 Add config for Swedish translations notification. PR #5147 by @tiangolo.
    • 🌐 Start of Swedish translation. PR #5062 by @MrRawbin.
    • 🌐 Add Japanese translation for docs/ja/docs/advanced/index.md. PR #5043 by @wakabame.
    • 🌐🇵🇱 Add Polish translation for docs/pl/docs/tutorial/first-steps.md. PR #5024 by @Valaraucoo.

    Internal

    Source code(tar.gz)
    Source code(zip)
  • 0.78.0(May 14, 2022)

    Features

    • ✨ Add support for omitting ... as default value when declaring required parameters with:

    • Path()

    • Query()

    • Header()

    • Cookie()

    • Body()

    • Form()

    • File()

    New docs at Tutorial - Query Parameters and String Validations - Make it required. PR #4906 by @tiangolo.

    Up to now, declaring a required parameter while adding additional validation or metadata needed using ... (Ellipsis).

    For example:

    from fastapi import Cookie, FastAPI, Header, Path, Query
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    def main(
        item_id: int = Path(default=..., gt=0),
        query: str = Query(default=..., max_length=10),
        session: str = Cookie(default=..., min_length=3),
        x_trace: str = Header(default=..., title="Tracing header"),
    ):
        return {"message": "Hello World"}
    

    ...all these parameters are required because the default value is ... (Ellipsis).

    But now it's possible and supported to just omit the default value, as would be done with Pydantic fields, and the parameters would still be required.

    ✨ For example, this is now supported:

    from fastapi import Cookie, FastAPI, Header, Path, Query
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    def main(
        item_id: int = Path(gt=0),
        query: str = Query(max_length=10),
        session: str = Cookie(min_length=3),
        x_trace: str = Header(title="Tracing header"),
    ):
        return {"message": "Hello World"}
    

    To declare parameters as optional (not required), you can set a default value as always, for example using None:

    from typing import Union
    from fastapi import Cookie, FastAPI, Header, Path, Query
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    def main(
        item_id: int = Path(gt=0),
        query: Union[str, None] = Query(default=None, max_length=10),
        session: Union[str, None] = Cookie(default=None, min_length=3),
        x_trace: Union[str, None] = Header(default=None, title="Tracing header"),
    ):
        return {"message": "Hello World"}
    

    Docs

    • 📝 Add docs recommending Union over Optional and migrate source examples. New docs at Python Types Intro - Using Union or Optional. PR #4908 by @tiangolo.
    • 🎨 Fix default value as set in tutorial for Path Operations Advanced Configurations. PR #4899 by @tiangolo.
    • 📝 Add documentation for redefined path operations. PR #4864 by @madkinsz.
    • 📝 Updates links for Celery documentation. PR #4736 by @sammyzord.
    • ✏ Fix example code with sets in tutorial for body nested models. PR #3030 by @hitrust.
    • ✏ Fix links to Pydantic docs. PR #4670 by @kinuax.
    • 📝 Update docs about Swagger UI self-hosting with newer source links. PR #4813 by @Kastakin.
    • 📝 Add link to external article: Building the Poll App From Django Tutorial With FastAPI And React. PR #4778 by @jbrocher.
    • 📝 Add OpenAPI warning to "Body - Fields" docs with extra schema extensions. PR #4846 by @ml-evs.

    Translations

    • 🌐 Fix code examples in Japanese translation for docs/ja/docs/tutorial/testing.md. PR #4623 by @hirotoKirimaru.

    Internal

    • ♻ Refactor dict value extraction to minimize key lookups fastapi/utils.py. PR #3139 by @ShahriyarR.
    • ✅ Add tests for required nonable parameters and body fields. PR #4907 by @tiangolo.
    • 👷 Fix installing Material for MkDocs Insiders in CI. PR #4897 by @tiangolo.
    • 👷 Add pre-commit CI instead of custom GitHub Action. PR #4896 by @tiangolo.
    • 👷 Add pre-commit GitHub Action workflow. PR #4895 by @tiangolo.
    • 📝 Add dark mode auto switch to docs based on OS preference. PR #4869 by @ComicShrimp.
    • 🔥 Remove un-used old pending tests, already covered in other places. PR #4891 by @tiangolo.
    • 🔧 Add Python formatting hooks to pre-commit. PR #4890 by @tiangolo.
    • 🔧 Add pre-commit with first config and first formatting pass. PR #4888 by @tiangolo.
    • 👷 Disable CI installing Material for MkDocs in forks. PR #4410 by @dolfinus.
    Source code(tar.gz)
    Source code(zip)
  • 0.77.1(May 10, 2022)

    Upgrades

    • ⬆ Upgrade Starlette from 0.19.0 to 0.19.1. PR #4819 by @Kludex.

    Docs

    • 📝 Add link to german article: REST-API Programmieren mittels Python und dem FastAPI Modul. PR #4624 by @fschuermeyer.
    • 📝 Add external link: PyCharm Guide to FastAPI. PR #4512 by @mukulmantosh.
    • 📝 Add external link to article: Building an API with FastAPI and Supabase and Deploying on Deta. PR #4440 by @aUnicornDev.
    • ✏ Fix small typo in docs/en/docs/tutorial/security/first-steps.md. PR #4515 by @KikoIlievski.

    Translations

    Internal

    • 🔧 Add notifications in issue for Uzbek translations. PR #4884 by @tiangolo.
    Source code(tar.gz)
    Source code(zip)
  • 0.77.0(May 10, 2022)

    Upgrades

    • ⬆ Upgrade Starlette from 0.18.0 to 0.19.0. PR #4488 by @Kludex.
      • When creating an explicit JSONResponse the content argument is now required.

    Docs

    • 📝 Add external link to article: Seamless FastAPI Configuration with ConfZ. PR #4414 by @silvanmelchior.
    • 📝 Add external link to article: 5 Advanced Features of FastAPI You Should Try. PR #4436 by @kaustubhgupta.
    • ✏ Reword to improve legibility of docs about TestClient. PR #4389 by @rgilton.
    • 📝 Add external link to blog post about Kafka, FastAPI, and Ably. PR #4044 by @Ugbot.
    • ✏ Fix typo in docs/en/docs/tutorial/sql-databases.md. PR #4875 by @wpyoga.
    • ✏ Fix typo in docs/en/docs/async.md. PR #4726 by @Prezu.

    Translations

    • 🌐 Update source example highlights for docs/zh/docs/tutorial/query-params-str-validations.md. PR #4237 by @caimaoy.
    • 🌐 Remove translation docs references to aiofiles as it's no longer needed since AnyIO. PR #3594 by @alonme.
    • ✏ 🌐 Fix typo in Portuguese translation for docs/pt/docs/tutorial/path-params.md. PR #4722 by @CleoMenezesJr.
    • 🌐 Fix live docs server for translations for some languages. PR #4729 by @wakabame.
    • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/cookie-params.md. PR #4112 by @lbmendes.
    • 🌐 Fix French translation for docs/tutorial/body.md. PR #4332 by @Smlep.
    • 🌐 Add Japanese translation for docs/ja/docs/advanced/conditional-openapi.md. PR #2631 by @sh0nk.
    • 🌐 Fix Japanese translation of docs/ja/docs/tutorial/body.md. PR #3062 by @a-takahashi223.
    • 🌐 Add Portuguese translation for docs/pt/docs/tutorial/background-tasks.md. PR #2170 by @izaguerreiro.
    • 🌐 Add Portuguese translation for docs/deployment/deta.md. PR #4442 by @lsglucas.
    • 🌐 Add Russian translation for docs/async.md. PR #4036 by @Winand.
    • 🌐 Add Portuguese translation for docs/tutorial/body.md. PR #3960 by @leandrodesouzadev.
    • 🌐 Add Portuguese translation of tutorial/extra-data-types.md. PR #4077 by @luccasmmg.
    • 🌐 Update German translation for docs/features.md. PR #3905 by @jomue.
    Source code(tar.gz)
    Source code(zip)
  • 0.76.0(May 5, 2022)

  • 0.75.2(Apr 17, 2022)

    This release includes upgrades to third-party packages that handle security issues. Although there's a chance these issues don't affect you in particular, please upgrade as soon as possible.

    Fixes

    • ✅ Fix new/recent tests with new fixed ValidationError JSON Schema. PR #4806 by @tiangolo.
    • 🐛 Fix JSON Schema for ValidationError at field loc. PR #3810 by @dconathan.
    • 🐛 Fix support for prefix on APIRouter WebSockets. PR #2640 by @Kludex.

    Upgrades

    • ⬆️ Update ujson ranges for CVE-2021-45958. PR #4804 by @tiangolo.
    • ⬆️ Upgrade dependencies upper range for extras "all". PR #4803 by @tiangolo.
    • ⬆ Upgrade Swagger UI - swagger-ui-dist@4. This handles a security issue in Swagger UI itself where it could be possible to inject HTML into Swagger UI. Please upgrade as soon as you can, in particular if you expose your Swagger UI (/docs) publicly to non-expert users. PR #4347 by @RAlanWright.

    Internal

    • 🔧 Update sponsors, add: ExoFlare, Ines Course; remove: Dropbase, Vim.so, Calmcode; update: Striveworks, TalkPython and TestDriven.io. PR #4805 by @tiangolo.
    • ⬆️ Upgrade Codecov GitHub Action. PR #4801 by @tiangolo.
    Source code(tar.gz)
    Source code(zip)
  • 0.75.1(Apr 1, 2022)

    Translations

    Internal

    Source code(tar.gz)
    Source code(zip)
  • 0.75.0(Mar 4, 2022)

  • 0.74.1(Feb 21, 2022)

  • 0.74.0(Feb 17, 2022)

    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
    )
    
    async def set_up_request_state_dependency():
        request_state = {"user": "deadpond"}
        contextvar_token = legacy_request_state_context_var.set(request_state)
        yield request_state
        legacy_request_state_context_var.reset(contextvar_token)
    

    ...before this change it would raise an error when resetting the context variable, because the contextvars context was different, because of the way it was implemented.

    Note: You probably don't need contextvars, and you should probably avoid using them. But they are powerful and useful in some advanced scenarios, for example, migrating from code that used Flask's g semi-global variable.

    Technical Details: If you want to know more of the technical details you can check out the PR description #4575.

    Internal

    Source code(tar.gz)
    Source code(zip)
  • 0.73.0(Jan 23, 2022)

    Features

    Docs

    • 📝 Tweak and improve docs for Request Files. PR #4470 by @tiangolo.

    Fixes

    Internal

    • 🐛 Fix docs dependencies cache, to get the latest Material for MkDocs. PR #4466 by @tiangolo.
    • 🔧 Add sponsor Dropbase. PR #4465 by @tiangolo.
    Source code(tar.gz)
    Source code(zip)
  • 0.72.0(Jan 16, 2022)

    Features

    Docs

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

    Translations

    • 🌐 Update Chinese translation for docs/help-fastapi.md. PR #3847 by @jaystone776.
    • 🌐 Fix Korean translation for docs/ko/docs/index.md. PR #4195 by @kty4119.
    • 🌐 Add Polish translation for docs/pl/docs/index.md. PR #4245 by @MicroPanda123.
    • 🌐 Add Chinese translation for docs\tutorial\path-operation-configuration.md. PR #3312 by @jaystone776.

    Internal

    • 🔧 Enable MkDocs Material Insiders' content.tabs.link. PR #4399 by @tiangolo.
    Source code(tar.gz)
    Source code(zip)
  • 0.71.0(Jan 7, 2022)

    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

    Source code(tar.gz)
    Source code(zip)
  • 0.70.1(Dec 12, 2021)

    There's nothing interesting in this particular FastAPI release. It is mainly to enable/unblock the release of the next version of Pydantic that comes packed with features and improvements. 🤩

    Fixes

    • 🐛 Fix JSON Schema for dataclasses, supporting the fixes in Pydantic 1.9. PR #4272 by @PrettyWood.

    Translations

    • 🌐 Add Korean translation for docs/tutorial/request-forms-and-files.md. PR #3744 by @NinaHwang.
    • 🌐 Add Korean translation for docs/tutorial/request-files.md. PR #3743 by @NinaHwang.
    • 🌐 Add portuguese translation for docs/tutorial/query-params-str-validations.md. PR #3965 by @leandrodesouzadev.
    • 🌐 Add Korean translation for docs/tutorial/response-status-code.md. PR #3742 by @NinaHwang.
    • 🌐 Add Korean translation for Tutorial - JSON Compatible Encoder. PR #3152 by @NEONKID.
    • 🌐 Add Korean translation for Tutorial - Path Parameters and Numeric Validations. PR #2432 by @hard-coders.
    • 🌐 Add Korean translation for docs/ko/docs/deployment/versions.md. PR #4121 by @DevDae.
    • 🌐 Fix Korean translation for docs/ko/docs/tutorial/index.md. PR #4193 by @kimjaeyoonn.
    • 🔧 Add CryptAPI sponsor. PR #4264 by @tiangolo.
    • 📝 Update docs/tutorial/dependencies/classes-as-dependencies: Add type of query parameters in a description of Classes as dependencies. PR #4015 by @0417taehyun.
    • 🌐 Add French translation for Tutorial - First steps. PR #3455 by @Smlep.
    • 🌐 Add French translation for docs/tutorial/path-params.md. PR #3548 by @Smlep.
    • 🌐 Add French translation for docs/tutorial/query-params.md. PR #3556 by @Smlep.
    • 🌐 Add Turkish translation for docs/python-types.md. PR #3926 by @BilalAlpaslan.

    Internal

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

    This release just upgrades Starlette to the latest version, 0.16.0, which includes several bug fixes and some small breaking changes.

    These last three consecutive releases are independent so that you can migrate gradually:

    • First to FastAPI 0.68.2, with no breaking changes, but upgrading all the sub-dependencies.
    • Next to FastAPI 0.69.0, which upgrades Starlette to 0.15.0, with AnyIO support, and a higher chance of having breaking changes in your code.
    • Finally to FastAPI 0.70.0, just upgrading Starlette to the latest version 0.16.0 with additional bug fixes.

    This way, in case there was a breaking change for your code in one of the releases, you can still benefit from the previous upgrades. ✨

    Breaking Changes - Upgrade

    Also upgrades the ranges of optional dependencies:

    • "jinja2 >=2.11.2,<4.0.0"
    • "itsdangerous >=1.1.0,<3.0.0"
    Source code(tar.gz)
    Source code(zip)
  • 0.69.0(Oct 7, 2021)

    Breaking Changes - Upgrade

    This release adds support for Trio. ✨

    It upgrades the version of Starlette to 0.15.0, now based on AnyIO, and the internal async components in FastAPI are now based on AnyIO as well, making it compatible with both asyncio and Trio.

    You can read the docs about running FastAPI with Trio using Hypercorn.

    This release also removes graphene as an optional dependency for GraphQL. If you need to work with GraphQL, the recommended library now is Strawberry. You can read the new FastAPI with GraphQL docs.

    Features

    • ✨ Add support for Trio via AnyIO, upgrading Starlette to 0.15.0. PR #3372 by @graingert.
    • ➖ Remove graphene as an optional dependency. PR #4007 by @tiangolo.

    Docs

    • 📝 Add docs for using Trio with Hypercorn. PR #4014 by @tiangolo.
    • ✏ Fix typos in Deployment Guide. PR #3975 by @ghandic.
    • 📝 Update docs with pip install calls when using extras with brackets, use quotes for compatibility with Zsh. PR #3131 by @tomwei7.
    • 📝 Add external link to article: Deploying ML Models as API Using FastAPI and Heroku. PR #3904 by @kaustubhgupta.
    • ✏ Fix typo in file paths in docs/en/docs/contributing.md. PR #3752 by @NinaHwang.
    • ✏ Fix a typo in docs/en/docs/advanced/path-operation-advanced-configuration.md and docs/en/docs/release-notes.md. PR #3750 by @saintmalik.
    • ✏️ Add a missing comma in the security tutorial. PR #3564 by @jalvaradosegura.
    • ✏ Fix typo in docs/en/docs/help-fastapi.md. PR #3760 by @jaystone776.
    • ✏ Fix typo about file path in docs/en/docs/tutorial/bigger-applications.md. PR #3285 by @HolyDorus.
    • ✏ Re-word to clarify test client in docs/en/docs/tutorial/testing.md. PR #3382 by @Bharat123rox.
    • 📝 Fix incorrect highlighted code. PR #3325 by @paxcodes.
    • 📝 Add external link to article: How-to deploy FastAPI app to Heroku. PR #3241 by @Jarmos-san.
    • ✏ Fix typo (mistranslation) in docs/en/docs/advanced/templates.md. PR #3211 by @oerpli.
    • 📝 Remove note about (now supported) feature from Swagger UI in docs/en/docs/tutorial/request-files.md. PR #2803 by @gsganden.
    • ✏ Fix typo re-word in docs/tutorial/handling-errors.md. PR #2700 by @graue70.

    Translations

    Internal

    • 📝 Add supported Python versions badge. PR #2794 by @hramezani.
    • ✏ Fix link in Japanese docs for docs/ja/docs/deployment/docker.md. PR #3245 by @utamori.
    • 🔧 Correct DeprecationWarning config and comment in pytest settings. PR #4008 by @graingert.
    • 🔧 Swap light/dark theme button icon. PR #3246 by @eddsalkield.
    • 🔧 Lint only in Python 3.7 and above. PR #4006 by @tiangolo.
    • 🔧 Add GitHub Action notify-translations config for Azerbaijani. PR #3995 by @tiangolo.
    Source code(tar.gz)
    Source code(zip)
  • 0.68.2(Oct 5, 2021)

    This release has no breaking changes. 🎉

    It upgrades the version ranges of sub-dependencies to allow applications using FastAPI to easily upgrade them.

    Soon there will be a new FastAPI release upgrading Starlette to take advantage of recent improvements, but as that has a higher chance of having breaking changes, it will be in a separate release.

    Features

    • ⬆Increase supported version of aiofiles to suppress warnings. PR #2899 by @SnkSynthesis.
    • ➖ Do not require backports in Python >= 3.7. PR #1880 by @FFY00.
    • ⬆ Upgrade required Python version to >= 3.6.1, needed by typing.Deque, used by Pydantic. PR #2733 by @hukkin.
    • ⬆️ Bump Uvicorn max range to 0.15.0. PR #3345 by @Kludex.

    Docs

    • 📝 Update GraphQL docs, recommend Strawberry. PR #3981 by @tiangolo.
    • 📝 Re-write and extend Deployment guide: Concepts, Uvicorn, Gunicorn, Docker, Containers, Kubernetes. PR #3974 by @tiangolo.
    • 📝 Upgrade HTTPS guide with more explanations and diagrams. PR #3950 by @tiangolo.

    Translations

    • 🌐 Add Turkish translation for docs/features.md. PR #1950 by @ycd.
    • 🌐 Add Turkish translation for docs/benchmarks.md. PR #2729 by @Telomeraz.
    • 🌐 Add Turkish translation for docs/index.md. PR #1908 by @ycd.
    • 🌐 Add French translation for docs/tutorial/body.md. PR #3671 by @Smlep.
    • 🌐 Add French translation for deployment/docker.md. PR #3694 by @rjNemo.
    • 🌐 Add Portuguese translation for docs/tutorial/path-params.md. PR #3664 by @FelipeSilva93.
    • 🌐 Add Portuguese translation for docs/deployment/https.md. PR #3754 by @lsglucas.
    • 🌐 Add German translation for docs/features.md. PR #3699 by @mawassk.

    Internal

    • ✨ Update GitHub Action: notify-translations, to avoid a race conditions. PR #3989 by @tiangolo.
    • ⬆️ Upgrade development autoflake, supporting multi-line imports. PR #3988 by @tiangolo.
    • ⬆️ Increase dependency ranges for tests and docs: pytest-cov, pytest-asyncio, black, httpx, sqlalchemy, databases, mkdocs-markdownextradata-plugin. PR #3987 by @tiangolo.
    • 👥 Update FastAPI People. PR #3986 by @github-actions[bot].
    • 💚 Fix badges in README and main page. PR #3979 by @ghandic.
    • ⬆ Upgrade internal testing dependencies: mypy to version 0.910, add newly needed type packages. PR #3350 by @ArcLightSlavik.
    • ✨ Add Deepset Sponsorship. PR #3976 by @tiangolo.
    • 🎨 Tweak CSS styles for shell animations. PR #3888 by @tiangolo.
    • 🔧 Add new Sponsor Calmcode.io. PR #3777 by @tiangolo.
    Source code(tar.gz)
    Source code(zip)
  • 0.68.1(Aug 24, 2021)

    Translations

    • 🌐 Add Portuguese translation of docs/fastapi-people.md. PR #3461 by @ComicShrimp.
    • 🌐 Add Chinese translation for docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md. PR #3492 by @jaystone776.
    • 🔧 Add new Translation tracking issues for German and Indonesian. PR #3718 by @tiangolo.
    • 🌐 Add Chinese translation for docs/tutorial/dependencies/sub-dependencies.md. PR #3491 by @jaystone776.
    • 🌐 Add Portuguese translation for docs/advanced/index.md. PR #3460 by @ComicShrimp.
    • 🌐 Portuguese translation of docs/async.md. PR #1330 by @Serrones.
    • 🌐 Add French translation for docs/async.md. PR #3416 by @Smlep.

    Internal

    Source code(tar.gz)
    Source code(zip)
Owner
Sebastián Ramírez
Creator of FastAPI and Typer. Dev at @explosion. APIs, Deep Learning/ML, full-stack distributed systems, SQL/NoSQL, Python, Docker, JS, TypeScript, etc
Sebastián Ramírez
The no-nonsense, minimalist REST and app backend framework for Python developers, with a focus on reliability, correctness, and performance at scale.

The Falcon Web Framework Falcon is a reliable, high-performance Python web framework for building large-scale app backends and microservices. It encou

Falconry 9k Jan 3, 2023
Eureka is a Rest-API framework scraper based on FastAPI for cleaning and organizing data, designed for the Eureka by Turing project of the National University of Colombia

Eureka is a Rest-API framework scraper based on FastAPI for cleaning and organizing data, designed for the Eureka by Turing project of the National University of Colombia

Julian Camilo Velandia 3 May 4, 2022
Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.

drf-yasg - Yet another Swagger generator Generate real Swagger/OpenAPI 2.0 specifications from a Django Rest Framework API. Compatible with Django Res

Cristi Vîjdea 3k Jan 6, 2023
REST API framework designed for human beings

Eve Eve is an open source Python REST API framework designed for human beings. It allows to effortlessly build and deploy highly customizable, fully f

eve 6.6k Jan 4, 2023
Restful API framework wrapped around MongoEngine

Flask-MongoRest A Restful API framework wrapped around MongoEngine. Setup from flask import Flask from flask_mongoengine import MongoEngine from flask

Close 525 Jan 1, 2023
Authentication for Django Rest Framework

Dj-Rest-Auth Drop-in API endpoints for handling authentication securely in Django Rest Framework. Works especially well with SPAs (e.g React, Vue, Ang

Michael 1.1k Dec 28, 2022
A JSON Web Token authentication plugin for the Django REST Framework.

Simple JWT Abstract Simple JWT is a JSON Web Token authentication plugin for the Django REST Framework. For full documentation, visit django-rest-fram

Jazzband 3.3k Jan 4, 2023
Django Ninja is a web framework for building APIs with Django and Python 3.6+ type hints.

?? Fast, Async-ready, Openapi, type hints based framework for building APIs

Vitaliy Kucheryaviy 3.8k Jan 4, 2023
Introduction to Django Rest Framework

Introduction to Django Rest Framework This is the repository of the video series Introduction to Django Rest Framework published on YouTube. It is a s

Simple is Better Than Complex 20 Jul 14, 2022
Country-specific Django helpers, to use in Django Rest Framework

django-rest-localflavor Country-specific serializers fields, to Django Rest Framework Documentation (soon) The full documentation is at https://django

Gilson Filho 19 Aug 30, 2022
JSON:API support for Django REST framework

JSON:API and Django REST framework Overview JSON:API support for Django REST framework Documentation: https://django-rest-framework-json-api.readthedo

null 1k Dec 27, 2022
DRF-extensions is a collection of custom extensions for Django REST Framework

Django REST Framework extensions DRF-extensions is a collection of custom extensions for Django REST Framework Full documentation for project is avail

Gennady Chibisov 1.3k Dec 28, 2022
Generate Views, Serializers, and Urls for your Django Rest Framework application

DRF Generators Writing APIs can be boring and repetitive work. Don't write another CRUDdy view in Django Rest Framework. With DRF Generators, one simp

Tobin Brown 332 Dec 17, 2022
Swagger Documentation Generator for Django REST Framework: deprecated

Django REST Swagger: deprecated (2019-06-04) This project is no longer being maintained. Please consider drf-yasg as an alternative/successor. I haven

Marc Gibbons 2.6k Dec 23, 2022
Document Web APIs made with Django Rest Framework

DRF Docs Document Web APIs made with Django Rest Framework. View Demo Contributors Wanted: Do you like this project? Using it? Let's make it better! S

Manos Konstantinidis 626 Nov 20, 2022
Recursive Serialization for Django REST framework

djangorestframework-recursive Overview Recursive Serialization for Django REST framework This package provides a RecursiveField that enables you to se

null 336 Dec 28, 2022
Dropdown population implementation for Django REST Framework

drf-dropdown Dropdown population implementation for Django REST Framework Usage Add DropdownView to API URL # urls.py import dropdown urlpatterns = [

Preeti Yuankrathok 4 Dec 6, 2022
simple api build with django rest framework

Django Rest API django-rest-framework Employees management simple API in this project wrote test suites for endpoints wrote simple doc string for clas

OMAR.A 1 Mar 31, 2022