# FastAPI Dependency Injection Visualizer
This is a simple tool to visualize the dependency injection tree of a FastAPI application.
It works by inspecting the FastAPI application and generating a graph of the dependencies from walking the dependency injection tree starting from the application's endpoints.
It automatically detects the endpoints and the dependencies of the application and generates a graph of the dependencies.
## Usage
Install the package in the environment where your FastAPI application is installed.
```bash
pip install fastapi-di-viz
```
Then run the following command to generate the graph:
```bash
fastapi-di-viz your_app.main:app
```
A sample graph for the application in [fastapi_di_viz/sample](./fastapi_di_viz/sample/) looks like this:
```mermaid
---
title: FastAPI dependency chain
---
graph TD;
root --> get_settings
a --> get_serviceA
get_serviceA --> get_repo
get_serviceA --> get_settings
b --> get_serviceB
get_serviceB --> get_repo
```
The tool supports graphs in the following formats:
- Graphviz DOT format
- Mermaid flowchart format
Raw data
{
"_id": null,
"home_page": null,
"name": "fastapi-di-viz",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "fastapi, dependency injection, graph, visualization",
"author": "dotcs",
"author_email": "git@dotcs.me",
"download_url": "https://files.pythonhosted.org/packages/88/90/e7544c1212ba0cbb80dbdc605a6852c092fb34d339e0e587453bea233e87/fastapi_di_viz-0.2.0.tar.gz",
"platform": null,
"description": "# FastAPI Dependency Injection Visualizer\n\nThis is a simple tool to visualize the dependency injection tree of a FastAPI application.\nIt works by inspecting the FastAPI application and generating a graph of the dependencies from walking the dependency injection tree starting from the application's endpoints.\n\nIt automatically detects the endpoints and the dependencies of the application and generates a graph of the dependencies.\n\n## Usage\n\nInstall the package in the environment where your FastAPI application is installed.\n```bash\npip install fastapi-di-viz\n```\n\nThen run the following command to generate the graph:\n```bash\nfastapi-di-viz your_app.main:app\n```\n\nA sample graph for the application in [fastapi_di_viz/sample](./fastapi_di_viz/sample/) looks like this:\n\n```mermaid\n---\ntitle: FastAPI dependency chain\n---\ngraph TD;\n root --> get_settings\n a --> get_serviceA\n get_serviceA --> get_repo\n get_serviceA --> get_settings\n b --> get_serviceB\n get_serviceB --> get_repo\n```\n\nThe tool supports graphs in the following formats:\n\n- Graphviz DOT format\n- Mermaid flowchart format\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Visualize a FastAPI dependency injection graph",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [
"fastapi",
" dependency injection",
" graph",
" visualization"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "118cfbcb727944af34507dc54a880d4cb406a652afed5554656dde7d0bdb0f64",
"md5": "18771fce90fabb1278ca34b853a9b222",
"sha256": "334f9a23fbbfd8dfd94be6f0fe65adb5f9ef002e2da24c952c1be683b3ead360"
},
"downloads": -1,
"filename": "fastapi_di_viz-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "18771fce90fabb1278ca34b853a9b222",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 4696,
"upload_time": "2024-12-02T09:58:28",
"upload_time_iso_8601": "2024-12-02T09:58:28.397355Z",
"url": "https://files.pythonhosted.org/packages/11/8c/fbcb727944af34507dc54a880d4cb406a652afed5554656dde7d0bdb0f64/fastapi_di_viz-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8890e7544c1212ba0cbb80dbdc605a6852c092fb34d339e0e587453bea233e87",
"md5": "e4780067235646af28b831f52ebe2135",
"sha256": "7df972f3d4d0f2ec1a523a98c0cf76c385cdeb8d29789ce89162df10419c69eb"
},
"downloads": -1,
"filename": "fastapi_di_viz-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "e4780067235646af28b831f52ebe2135",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 3506,
"upload_time": "2024-12-02T09:58:30",
"upload_time_iso_8601": "2024-12-02T09:58:30.152712Z",
"url": "https://files.pythonhosted.org/packages/88/90/e7544c1212ba0cbb80dbdc605a6852c092fb34d339e0e587453bea233e87/fastapi_di_viz-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-02 09:58:30",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "fastapi-di-viz"
}