py-api-spy
A zero-dependency, lightweight terminal performance dashboard for Python web frameworks.
This is the Python sibling of the @chabdulwahab/api-spy Node.js library. It maintains the identical layout, telemetry keys, and minimalist design philosophy.
Features
- Zero Dependencies: Implemented using only standard Python library modules.
- Low Overhead: Tailored metrics tracking with minimal CPU and memory impact.
- Sticky Terminal Dashboard: Persisted at the bottom of the stdout stream while application logs print normally above it.
- Thread Safe: Concurrent requests are serialized using reentrant locking mechanisms.
- Framework Support: Built-in middlewares for FastAPI / Starlette (ASGI) and Django / DRF (WSGI).
Installation
Install the package via pip:
pip install py-api-spy
Usage
FastAPI / Starlette
Add the ASGI middleware to your FastAPI application:
from fastapi import FastAPI
from api_spy import ApiSpyMiddleware
app = FastAPI()
app.add_middleware(ApiSpyMiddleware)
@app.get("/")
def read_root():
return {"hello": "world"}
Django / DRF
Add the WSGI middleware to your Django MIDDLEWARE list in settings.py:
MIDDLEWARE = [
# ... other middlewares ...
"api_spy.ApiSpyDjangoMiddleware",
]
Dashboard Design
The dashboard takes exactly 10 lines and maintains a hardcoded width of 72 characters:
- Latency States: Green
[✓]for fast routes (<= 200ms) and red[!]for slow routes (> 200ms). - Dot-leaders: Dim gray dots linking paths with their corresponding metrics.
- Cross-Platform Memory: Retrieves resident set size (RAM) for Linux, macOS, and Windows.
┌──────────────────────────────────────────────────────────────────────┐
│ Active: 1 │ Total: 15 │ RAM: 14.5 MB │
├──────────────────────────────────────────────────────────────────────┤
│ Slowest Routes (Top 5) │
│ [✓] GET /.............................................. 5ms (x8) │
│ [!] POST /api/v1/users.............................. 205ms (x2) │
│ - │
│ - │
│ - │
└──────────────────────────────────────────────────────────────────────┘
License
MIT
Metadata
Release files for py-api-spy 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_api_spy-0.1.5.tar.gz | 8.9 kB | Without provenance | Details for py_api_spy-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_api_spy-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for py_api_spy-0.1.5-py3-none-any.whl |
Total release size: 18.3 kB
Release files / py_api_spy-0.1.5.tar.gz
| Download URL | py_api_spy-0.1.5.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23f941a4a0c7aae08edee6354b8d830514530cf51c669f3455f54a07e4d1f74a
|
|
BLAKE2b-256 checksum How to use checksums |
f3b7e6d8d28cb781e0509b57268155a439ab50c08975c7c610cbcab1df0b3561
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / py_api_spy-0.1.5-py3-none-any.whl
| Download URL | py_api_spy-0.1.5-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f854aeed15e2401311f7494e91bc00a96236c05ffa3b8c0fcd49e3d1abef1841
|
|
BLAKE2b-256 checksum How to use checksums |
b6b8d5119f01cbff9280b53c84551100188beb5ce64f21b657448a56e0a3084d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for py-api-spy 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.