Metadata-Version: 2.4
Name: fastapi-therapist
Version: 0.1.3
Summary: Diagnose FastAPI codebases for best practices
Project-URL: Homepage, https://github.com/sahil-code-19/FastAPI-doctor
Project-URL: Repository, https://github.com/sahil-code-19/FastAPI-doctor
Author-email: Sahil Koshti <koshtisahil02@gmail.com>
License: MIT
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# fastapi-therapist

Diagnose FastAPI codebases for security, performance, correctness, and architecture issues. Outputs a 0–100 health score.

## Installation

```bash
pip install fastapi-therapist
```

## Usage

```bash
# Scan current directory with verbose output
fastapi-therapist . --verbose

# Scan a specific project
fastapi-therapist /path/to/fastapi/project --verbose

# Output only the score (useful for CI)
fastapi-therapist . --score
```

## Rules

### Async/Sync Correctness

| Rule | Severity | Detects |
|---|---|---|
| FASTT001 | ERROR | Sync blocking IO (`requests.get`, `time.sleep`) in async endpoint |
| FASTT002 | ERROR | Sync SQLAlchemy calls in async endpoint |
| FASTT003 | WARN/ERROR | `async def` endpoint with no await |
| FASTT004 | ERROR | `asyncio.run()` inside async context — nested event loop |
| FASTT005 | ERROR | `open()` blocking file I/O in async endpoint |
| FASTT006 | WARNING | `subprocess.run()` / `os.system()` in async endpoint |

### Correctness

| Rule | Severity | Detects |
|---|---|---|
| FASTT011 | WARNING | POST/PUT/PATCH/DELETE missing explicit `status_code` |

## Score

The health score formula:

```
100 - (unique error rules × 1.5) - (unique warning rules × 0.75)
```

- **75–100** Great
- **50–74** Needs work
- **0–49** Critical
