fastapi-radar 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fastapi-radar might be problematic. Click here for more details.
- fastapi_radar/__init__.py +6 -0
- fastapi_radar/api.py +310 -0
- fastapi_radar/capture.py +105 -0
- fastapi_radar/dashboard/dist/assets/index-BK3IXW8U.css +1 -0
- fastapi_radar/dashboard/dist/assets/index-DS-t-RQ1.js +268 -0
- fastapi_radar/dashboard/dist/index.html +13 -0
- fastapi_radar/middleware.py +142 -0
- fastapi_radar/models.py +66 -0
- fastapi_radar/radar.py +295 -0
- fastapi_radar/utils.py +59 -0
- fastapi_radar-0.1.0.dist-info/METADATA +165 -0
- fastapi_radar-0.1.0.dist-info/RECORD +17 -0
- fastapi_radar-0.1.0.dist-info/WHEEL +5 -0
- fastapi_radar-0.1.0.dist-info/licenses/LICENSE +21 -0
- fastapi_radar-0.1.0.dist-info/top_level.txt +2 -0
- tests/__init__.py +1 -0
- tests/test_radar.py +66 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fastapi-radar
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A debugging dashboard for FastAPI applications with real-time monitoring
|
|
5
|
+
Home-page: https://github.com/doganarif/fastapi-radar
|
|
6
|
+
Author: Arif Dogan
|
|
7
|
+
Author-email: Arif Dogan <me@arif.sh>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/doganarif/fastapi-radar
|
|
10
|
+
Project-URL: Bug Reports, https://github.com/doganarif/fastapi-radar/issues
|
|
11
|
+
Project-URL: Source, https://github.com/doganarif/fastapi-radar
|
|
12
|
+
Keywords: fastapi,debugging,monitoring,dashboard,development-tools
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Framework :: FastAPI
|
|
22
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: fastapi>=0.68.0
|
|
28
|
+
Requires-Dist: sqlalchemy>=1.4.0
|
|
29
|
+
Requires-Dist: pydantic>=1.8.0
|
|
30
|
+
Requires-Dist: starlette>=0.14.2
|
|
31
|
+
Requires-Dist: black>=24.8.0
|
|
32
|
+
Requires-Dist: httpx>=0.28.1
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
36
|
+
Requires-Dist: uvicorn[standard]>=0.15.0; extra == "dev"
|
|
37
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
39
|
+
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: mypy>=0.950; extra == "dev"
|
|
41
|
+
Dynamic: author
|
|
42
|
+
Dynamic: home-page
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
Dynamic: requires-python
|
|
45
|
+
|
|
46
|
+
# FastAPI Radar 🛰️
|
|
47
|
+
|
|
48
|
+
[](https://www.python.org/downloads/)
|
|
49
|
+
[](https://fastapi.tiangolo.com)
|
|
50
|
+
[](https://opensource.org/licenses/MIT)
|
|
51
|
+
|
|
52
|
+
**A debugging dashboard for FastAPI applications providing real-time request, database query, and exception monitoring.**
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install fastapi-radar
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Or with your favorite package manager:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Using poetry
|
|
64
|
+
poetry add fastapi-radar
|
|
65
|
+
|
|
66
|
+
# Using pipenv
|
|
67
|
+
pipenv install fastapi-radar
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Note:** The dashboard comes pre-built! No need to build anything - just install and use.
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from fastapi import FastAPI
|
|
76
|
+
from fastapi_radar import Radar
|
|
77
|
+
from sqlalchemy import create_engine
|
|
78
|
+
|
|
79
|
+
app = FastAPI()
|
|
80
|
+
engine = create_engine("sqlite:///./app.db")
|
|
81
|
+
|
|
82
|
+
# Initialize Radar - automatically adds middleware and mounts dashboard
|
|
83
|
+
radar = Radar(app, db_engine=engine)
|
|
84
|
+
radar.create_tables()
|
|
85
|
+
|
|
86
|
+
# Your routes work unchanged
|
|
87
|
+
@app.get("/users")
|
|
88
|
+
async def get_users():
|
|
89
|
+
return {"users": []}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Access your dashboard at: **http://localhost:8000/\_\_radar**
|
|
93
|
+
|
|
94
|
+
## Features
|
|
95
|
+
|
|
96
|
+
- 🚀 **Zero Configuration** - Works with any FastAPI + SQLAlchemy app
|
|
97
|
+
- 📊 **Request Monitoring** - Complete HTTP request/response capture with timing
|
|
98
|
+
- 🗃️ **Database Monitoring** - SQL query logging with execution times
|
|
99
|
+
- 🐛 **Exception Tracking** - Automatic exception capture with stack traces
|
|
100
|
+
- ⚡ **Real-time Updates** - Live dashboard updates as requests happen
|
|
101
|
+
- 🎨 **Beautiful UI** - Modern React dashboard with shadcn/ui components
|
|
102
|
+
|
|
103
|
+
## Screenshots
|
|
104
|
+
|
|
105
|
+
<!-- Add screenshots here -->
|
|
106
|
+
|
|
107
|
+
## Configuration
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
radar = Radar(
|
|
111
|
+
app,
|
|
112
|
+
db_engine=engine,
|
|
113
|
+
dashboard_path="/__radar", # Custom dashboard path
|
|
114
|
+
enable_in_production=False, # Disable in production
|
|
115
|
+
capture_body=True, # Capture request/response bodies
|
|
116
|
+
capture_headers=True, # Capture headers
|
|
117
|
+
max_body_size=10000, # Max body size to capture
|
|
118
|
+
)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Contributing
|
|
122
|
+
|
|
123
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
124
|
+
|
|
125
|
+
### Development Setup
|
|
126
|
+
|
|
127
|
+
For contributors who want to modify the codebase:
|
|
128
|
+
|
|
129
|
+
1. Clone the repository:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git clone https://github.com/doganarif/fastapi-radar.git
|
|
133
|
+
cd fastapi-radar
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
2. Install development dependencies:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pip install -e ".[dev]"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
3. (Optional) If modifying the dashboard UI:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
cd fastapi_radar/dashboard
|
|
146
|
+
npm install
|
|
147
|
+
npm run dev # For development with hot reload
|
|
148
|
+
# or
|
|
149
|
+
npm run build # To rebuild the production bundle
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
4. Run the example app:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
python example_app.py
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
161
|
+
|
|
162
|
+
## Acknowledgments
|
|
163
|
+
|
|
164
|
+
- Built with [FastAPI](https://fastapi.tiangolo.com/)
|
|
165
|
+
- Dashboard powered by [React](https://react.dev/) and [shadcn/ui](https://ui.shadcn.com/)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
fastapi_radar/__init__.py,sha256=AIZy7tyr7kPLDQNspJTEbkCZXThWvRkm0mCaZ_icIBc,137
|
|
2
|
+
fastapi_radar/api.py,sha256=P0QdP7qhXcqtzxnXpvSAST8IDXO0x_5UtD1vuZKyu9o,9614
|
|
3
|
+
fastapi_radar/capture.py,sha256=JtX3fsPm_lDe4LRNy1ZaDgPqynL1XJRQUd1DNREUbc4,3279
|
|
4
|
+
fastapi_radar/middleware.py,sha256=FDWXDf4fNT9AuUqvQm-tBXQi2AeM50UidHICMpIXHNI,4954
|
|
5
|
+
fastapi_radar/models.py,sha256=H2esHsTo4RZEy9GJ0I49Ob5-AS85aeO0oMWau2QrWMw,2262
|
|
6
|
+
fastapi_radar/radar.py,sha256=OK0ZzlkXjEAHjN4fVIVlS5TMpjJAH3JREQrSP_QGZrM,10132
|
|
7
|
+
fastapi_radar/utils.py,sha256=WoL5tEH1pl6zOp0sXoPV_3UEOsIl29_xgzS0iapS10s,1515
|
|
8
|
+
fastapi_radar/dashboard/dist/index.html,sha256=InLUEQlim0Ma0_6Aeyu_r40fGJwTFq_al22hNFEvm5k,436
|
|
9
|
+
fastapi_radar/dashboard/dist/assets/index-BK3IXW8U.css,sha256=gurWj_xAsHtY2MJFbL7AqlJFwoaq6Bzji9PDugZmVS8,31201
|
|
10
|
+
fastapi_radar/dashboard/dist/assets/index-DS-t-RQ1.js,sha256=KExks9YmUPtGj6_XR868GulBEpgx0-Q8OBkbfyEVMmI,472628
|
|
11
|
+
fastapi_radar-0.1.0.dist-info/licenses/LICENSE,sha256=0ga4BB6q-nqx6xlDRhtrgKrYs0HgX02PQyIzNFRK09Q,1067
|
|
12
|
+
tests/__init__.py,sha256=kAWaI50iJRZ4JlAdyt7FICgm8MsloZz0ZlsmhgLXBas,31
|
|
13
|
+
tests/test_radar.py,sha256=-j9H8kHWp6cg09jo_WHEZxgqXwTeN78sLwLrunjFG9c,1698
|
|
14
|
+
fastapi_radar-0.1.0.dist-info/METADATA,sha256=tZAyuSCn9qKZRO-rm9hvSEOUHFEhn0yd6Z4j3uN-E1g,4829
|
|
15
|
+
fastapi_radar-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
16
|
+
fastapi_radar-0.1.0.dist-info/top_level.txt,sha256=M-bALM-KDkiLcATq2aAx-BnG59Nv-GdFBzuzkUhiCa0,20
|
|
17
|
+
fastapi_radar-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Arif Dogan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tests/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Tests for FastAPI Radar."""
|
tests/test_radar.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Test suite for FastAPI Radar."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from fastapi import FastAPI
|
|
5
|
+
from fastapi.testclient import TestClient
|
|
6
|
+
from sqlalchemy import create_engine
|
|
7
|
+
|
|
8
|
+
from fastapi_radar import Radar
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_radar_initialization():
|
|
12
|
+
"""Test that Radar can be initialized with a FastAPI app."""
|
|
13
|
+
app = FastAPI()
|
|
14
|
+
engine = create_engine("sqlite:///:memory:")
|
|
15
|
+
|
|
16
|
+
radar = Radar(app, db_engine=engine)
|
|
17
|
+
assert radar is not None
|
|
18
|
+
assert radar.app == app
|
|
19
|
+
assert radar.db_engine == engine
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_radar_creates_tables():
|
|
23
|
+
"""Test that Radar can create necessary database tables."""
|
|
24
|
+
app = FastAPI()
|
|
25
|
+
engine = create_engine("sqlite:///:memory:")
|
|
26
|
+
|
|
27
|
+
radar = Radar(app, db_engine=engine)
|
|
28
|
+
radar.create_tables()
|
|
29
|
+
|
|
30
|
+
# Tables should be created without errors
|
|
31
|
+
assert True
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_dashboard_mounted():
|
|
35
|
+
"""Test that the dashboard is mounted at the correct path."""
|
|
36
|
+
app = FastAPI()
|
|
37
|
+
engine = create_engine("sqlite:///:memory:")
|
|
38
|
+
|
|
39
|
+
radar = Radar(app, db_engine=engine)
|
|
40
|
+
radar.create_tables()
|
|
41
|
+
|
|
42
|
+
client = TestClient(app)
|
|
43
|
+
|
|
44
|
+
# Dashboard should be accessible
|
|
45
|
+
response = client.get("/__radar")
|
|
46
|
+
# Should return HTML or redirect
|
|
47
|
+
assert response.status_code in [200, 307]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_middleware_captures_requests():
|
|
51
|
+
"""Test that middleware captures HTTP requests."""
|
|
52
|
+
app = FastAPI()
|
|
53
|
+
engine = create_engine("sqlite:///:memory:")
|
|
54
|
+
|
|
55
|
+
radar = Radar(app, db_engine=engine)
|
|
56
|
+
radar.create_tables()
|
|
57
|
+
|
|
58
|
+
@app.get("/test")
|
|
59
|
+
async def test_endpoint():
|
|
60
|
+
return {"message": "test"}
|
|
61
|
+
|
|
62
|
+
client = TestClient(app)
|
|
63
|
+
response = client.get("/test")
|
|
64
|
+
|
|
65
|
+
assert response.status_code == 200
|
|
66
|
+
assert response.json() == {"message": "test"}
|