Home / File/ main.py — fastapi Source File

main.py — fastapi Source File

Architecture documentation for main.py, a python file in the fastapi codebase. 3 imports, 3 dependents.

File python FastAPI Routing 3 imports 3 dependents 38 functions

Entity Profile

Dependency Diagram

graph LR
  224633e5_139d_dee9_c17b_aeac8a2f6027["main.py"]
  8e160bcc_cf54_df55_9887_22e5df7af3da["http"]
  224633e5_139d_dee9_c17b_aeac8a2f6027 --> 8e160bcc_cf54_df55_9887_22e5df7af3da
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  224633e5_139d_dee9_c17b_aeac8a2f6027 --> 0dda2280_3359_8460_301c_e98c77e78185
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  224633e5_139d_dee9_c17b_aeac8a2f6027 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  9ddbfdd1_7392_6722_db09_7324223655a8["test_application.py"]
  9ddbfdd1_7392_6722_db09_7324223655a8 --> 224633e5_139d_dee9_c17b_aeac8a2f6027
  114b7346_56f1_5baa_099f_1acd87f8d21f["test_path.py"]
  114b7346_56f1_5baa_099f_1acd87f8d21f --> 224633e5_139d_dee9_c17b_aeac8a2f6027
  cdb35db9_37cf_6d62_6a9d_4181458b783d["test_query.py"]
  cdb35db9_37cf_6d62_6a9d_4181458b783d --> 224633e5_139d_dee9_c17b_aeac8a2f6027
  style 224633e5_139d_dee9_c17b_aeac8a2f6027 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import http
from typing import Optional

from fastapi import FastAPI, Path, Query

external_docs = {
    "description": "External API documentation.",
    "url": "https://docs.example.com/api-general",
}

app = FastAPI(openapi_external_docs=external_docs)


@app.api_route("/api_route")
def non_operation():
    return {"message": "Hello World"}


def non_decorated_route():
    return {"message": "Hello World"}


app.add_api_route("/non_decorated_route", non_decorated_route)


@app.get("/text")
def get_text():
    return "Hello World"


@app.get("/path/{item_id}")
def get_id(item_id):
    return item_id


@app.get("/path/str/{item_id}")
def get_str_id(item_id: str):
    return item_id


@app.get("/path/int/{item_id}")
def get_int_id(item_id: int):
    return item_id


@app.get("/path/float/{item_id}")
def get_float_id(item_id: float):
    return item_id


@app.get("/path/bool/{item_id}")
def get_bool_id(item_id: bool):
    return item_id


@app.get("/path/param/{item_id}")
def get_path_param_id(item_id: Optional[str] = Path()):
    return item_id


// ... (150 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does main.py do?
main.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Routing subdomain.
What functions are defined in main.py?
main.py defines 38 function(s): get_bool_id, get_enum_status_code, get_float_id, get_id, get_int_id, get_path_param_ge, get_path_param_ge_int, get_path_param_gt, get_path_param_gt0, get_path_param_gt_int, and 28 more.
What does main.py depend on?
main.py imports 3 module(s): __init__.py, http, typing.
What files import main.py?
main.py is imported by 3 file(s): test_application.py, test_path.py, test_query.py.
Where is main.py in the architecture?
main.py is located at tests/main.py (domain: FastAPI, subdomain: Routing, directory: tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free