v2026.3.20 on PyPI

One command.
One score.

Scan any Python codebase and get a 0–100 health score. 9 analyzers. Project profiles. Built for AI agents.

terminal
$ python-doctor .

scanning 47 files...

Security ........ OK
Lint ............ 2 issues
Dead Code ....... OK
Complexity ...... OK
Structure ....... OK
Dependencies .... OK
Docstrings ...... 1 issue
Imports ......... OK
Exceptions ...... OK

Score: 94/100 (Excellent)
$ curl -sL https://raw.githubusercontent.com/saikatkumardey/python-doctor/main/install.sh | sh
View on GitHub
Also: pip install python-doctor · uv tool install python-doctor · pipx install python-doctor
What it checks

9 categories. Smart defaults.

Wraps Bandit, Ruff, Vulture, Radon, and 4 custom AST analyzers into a single score. Auto-detects your project type. Configurable via [tool.python-doctor] in pyproject.toml.

🔒
Security
-30 max
SQL injection, hardcoded secrets, unsafe calls. Powered by Bandit with context-aware filtering for test and example files.
🧹
Lint
-25 max
Unused imports, undefined names, style violations. Powered by Ruff.
💀
Dead Code
-15 max
Unused functions, variables, and imports. Powered by Vulture.
🔄
Complexity
-15 max
Cyclomatic complexity analysis. Flags functions over CC 10. Powered by Radon.
🏗
Structure
-15 max
File sizes, test coverage ratio, type hints, README, LICENSE, linter config.
📦
Dependencies
-15 max
Build file validation, no mixed systems, pip-audit vulnerability scanning.
📝
Docstrings
-10 max
Public function and class docstring coverage analysis.
🔗
Imports
-10 max
Star import detection and circular dependency analysis.
Exceptions
-10 max
Bare except blocks and silently swallowed exceptions.
Profiles

Knows what you're building

Auto-detects your project type from pyproject.toml and adjusts scoring. Override with --profile or config.

CLI
Suppresses subprocess and shell-related Bandit rules. Caps security at -15.
🌐
Web
Default scoring. Full security analysis for web-facing code.
📚
Library
Stricter docstring requirements. Public API docs matter more.
📄
Script
Relaxed structure. No tests or license required for quick scripts.
The loop

How agents use it

Run, read, fix, verify. Python Doctor was designed for this loop from day one.

01

Scan

Run python-doctor . --json and get structured findings with file paths and line numbers.

02

Fix

Use --fix for auto-fixable issues. The agent handles the rest by reading the JSON output.

03

Verify

Re-run with --score to confirm the score improved. Exit code 1 if below 50.

04

Ship

Score target met. Run --badge for a README badge. Use --ci to auto-update it on every push.

Integrations

Works with every agent

If it can run a shell command, it can use Python Doctor.

CC
Claude Code
Install as a plugin. Use the /python-doctor slash command after modifying Python files.
/plugin marketplace add saikatkumardey/python-doctor
Cu
Cursor
Add a rule file to .cursor/rules/ and it runs automatically on Python changes.
.cursor/rules/python-doctor.mdc
Cx
OpenAI Codex
Add the check to AGENTS.md. Codex reads it and runs the scan automatically.
python-doctor . --json
CI
GitHub Actions
One-line CI step. Fails the build if score drops below 50. Use --ci to generate the workflow.
python-doctor --ci > .github/workflows/python-doctor.yml
Ws
Windsurf / Cline / Aider
Add to your project rules or system prompt. Any agent that can run a shell command works.
python-doctor . --json
uv
One-shot with uvx
No install needed. Run directly on any project with uvx.
uvx python-doctor /path/to/project
Real scores

Benchmarks on popular projects

Strict, opinionated scores. These are real scans on real repos.

Project Stars Score Top findings
requests 52k+ 42/100 Weak hashes (B324), complexity (CC 21), large files, no type hints
flask 69k+ 47/100 Hardcoded passwords, complexity (CC 23), large files (app.py: 1625 lines), bare except
fastapi 82k+ 26/100 B101 asserts in source, routing.py (4956 lines), 6% docstring coverage
python-doctor 98/100 Dogfooded. Ran on itself, fixed everything it found.

Check your codebase health

One command. Thirty seconds. No config.

Install from PyPI View source