pycode-doctor 0.1.0__tar.gz

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.
Files changed (105) hide show
  1. pycode_doctor-0.1.0/.gitignore +216 -0
  2. pycode_doctor-0.1.0/LICENSE +21 -0
  3. pycode_doctor-0.1.0/PKG-INFO +235 -0
  4. pycode_doctor-0.1.0/README.md +178 -0
  5. pycode_doctor-0.1.0/pyproject.toml +168 -0
  6. pycode_doctor-0.1.0/src/python_doctor/__init__.py +8 -0
  7. pycode_doctor-0.1.0/src/python_doctor/__main__.py +5 -0
  8. pycode_doctor-0.1.0/src/python_doctor/analysis_request.py +37 -0
  9. pycode_doctor-0.1.0/src/python_doctor/analyzer_catalog.py +102 -0
  10. pycode_doctor-0.1.0/src/python_doctor/analyzers/__init__.py +56 -0
  11. pycode_doctor-0.1.0/src/python_doctor/analyzers/bandit_scanner.py +143 -0
  12. pycode_doctor-0.1.0/src/python_doctor/analyzers/basedpyright_analyzer.py +109 -0
  13. pycode_doctor-0.1.0/src/python_doctor/analyzers/cached.py +113 -0
  14. pycode_doctor-0.1.0/src/python_doctor/analyzers/dependency_vulns.py +261 -0
  15. pycode_doctor-0.1.0/src/python_doctor/analyzers/deptry_analyzer.py +150 -0
  16. pycode_doctor-0.1.0/src/python_doctor/analyzers/detect_secrets_analyzer.py +106 -0
  17. pycode_doctor-0.1.0/src/python_doctor/analyzers/mypy_checker.py +226 -0
  18. pycode_doctor-0.1.0/src/python_doctor/analyzers/radon_analyzer.py +165 -0
  19. pycode_doctor-0.1.0/src/python_doctor/analyzers/registry.py +71 -0
  20. pycode_doctor-0.1.0/src/python_doctor/analyzers/ruff.py +253 -0
  21. pycode_doctor-0.1.0/src/python_doctor/analyzers/typos_analyzer.py +82 -0
  22. pycode_doctor-0.1.0/src/python_doctor/analyzers/vulture_analyzer.py +159 -0
  23. pycode_doctor-0.1.0/src/python_doctor/cache.py +255 -0
  24. pycode_doctor-0.1.0/src/python_doctor/cli.py +538 -0
  25. pycode_doctor-0.1.0/src/python_doctor/config.py +89 -0
  26. pycode_doctor-0.1.0/src/python_doctor/dedup.py +126 -0
  27. pycode_doctor-0.1.0/src/python_doctor/dependencies/discovery.py +196 -0
  28. pycode_doctor-0.1.0/src/python_doctor/detection.py +314 -0
  29. pycode_doctor-0.1.0/src/python_doctor/diff.py +140 -0
  30. pycode_doctor-0.1.0/src/python_doctor/discovery.py +188 -0
  31. pycode_doctor-0.1.0/src/python_doctor/formatters/__init__.py +1 -0
  32. pycode_doctor-0.1.0/src/python_doctor/formatters/badge.py +44 -0
  33. pycode_doctor-0.1.0/src/python_doctor/formatters/human.py +414 -0
  34. pycode_doctor-0.1.0/src/python_doctor/formatters/json_fmt.py +26 -0
  35. pycode_doctor-0.1.0/src/python_doctor/mcp/__init__.py +10 -0
  36. pycode_doctor-0.1.0/src/python_doctor/mcp/installer.py +125 -0
  37. pycode_doctor-0.1.0/src/python_doctor/mcp/server.py +439 -0
  38. pycode_doctor-0.1.0/src/python_doctor/models.py +120 -0
  39. pycode_doctor-0.1.0/src/python_doctor/plan.py +115 -0
  40. pycode_doctor-0.1.0/src/python_doctor/progress.py +101 -0
  41. pycode_doctor-0.1.0/src/python_doctor/rules.py +352 -0
  42. pycode_doctor-0.1.0/src/python_doctor/runner.py +375 -0
  43. pycode_doctor-0.1.0/src/python_doctor/scoring/__init__.py +1 -0
  44. pycode_doctor-0.1.0/src/python_doctor/scoring/engine.py +379 -0
  45. pycode_doctor-0.1.0/src/python_doctor/skills/SKILL.md +416 -0
  46. pycode_doctor-0.1.0/src/python_doctor/skills/__init__.py +1 -0
  47. pycode_doctor-0.1.0/src/python_doctor/skills/agents.py +100 -0
  48. pycode_doctor-0.1.0/src/python_doctor/skills/installer.py +253 -0
  49. pycode_doctor-0.1.0/src/python_doctor/skills/rule_db.py +824 -0
  50. pycode_doctor-0.1.0/tests/__init__.py +0 -0
  51. pycode_doctor-0.1.0/tests/conftest.py +54 -0
  52. pycode_doctor-0.1.0/tests/fixtures/clean_project/.python-doctor-cache/.gitignore +1 -0
  53. pycode_doctor-0.1.0/tests/fixtures/clean_project/.python-doctor-cache/v1/bandit_6a6fcbd39f2998bd.json +1 -0
  54. pycode_doctor-0.1.0/tests/fixtures/clean_project/.python-doctor-cache/v1/radon_6a6fcbd39f2998bd.json +1 -0
  55. pycode_doctor-0.1.0/tests/fixtures/clean_project/.python-doctor-cache/v1/ruff_6a6fcbd39f2998bd.json +1 -0
  56. pycode_doctor-0.1.0/tests/fixtures/clean_project/.python-doctor-cache/v1/vulture_6a6fcbd39f2998bd.json +1 -0
  57. pycode_doctor-0.1.0/tests/fixtures/clean_project/pyproject.toml +3 -0
  58. pycode_doctor-0.1.0/tests/fixtures/clean_project/src/app.py +11 -0
  59. pycode_doctor-0.1.0/tests/fixtures/complex_project/pyproject.toml +3 -0
  60. pycode_doctor-0.1.0/tests/fixtures/complex_project/src/complex.py +47 -0
  61. pycode_doctor-0.1.0/tests/fixtures/dead_code_project/pyproject.toml +3 -0
  62. pycode_doctor-0.1.0/tests/fixtures/dead_code_project/src/dead.py +34 -0
  63. pycode_doctor-0.1.0/tests/fixtures/messy_project/.python-doctor-cache/.gitignore +1 -0
  64. pycode_doctor-0.1.0/tests/fixtures/messy_project/.python-doctor-cache/v1/bandit_37241918d24be0b0.json +1 -0
  65. pycode_doctor-0.1.0/tests/fixtures/messy_project/.python-doctor-cache/v1/radon_37241918d24be0b0.json +1 -0
  66. pycode_doctor-0.1.0/tests/fixtures/messy_project/.python-doctor-cache/v1/ruff_37241918d24be0b0.json +1 -0
  67. pycode_doctor-0.1.0/tests/fixtures/messy_project/.python-doctor-cache/v1/vulture_37241918d24be0b0.json +1 -0
  68. pycode_doctor-0.1.0/tests/fixtures/messy_project/pyproject.toml +3 -0
  69. pycode_doctor-0.1.0/tests/fixtures/messy_project/src/bad_code.py +9 -0
  70. pycode_doctor-0.1.0/tests/fixtures/security_issues/pyproject.toml +3 -0
  71. pycode_doctor-0.1.0/tests/fixtures/security_issues/src/insecure.py +11 -0
  72. pycode_doctor-0.1.0/tests/fixtures/type_errors/pyproject.toml +3 -0
  73. pycode_doctor-0.1.0/tests/fixtures/type_errors/src/typed.py +18 -0
  74. pycode_doctor-0.1.0/tests/test_badge.py +85 -0
  75. pycode_doctor-0.1.0/tests/test_bandit_analyzer.py +161 -0
  76. pycode_doctor-0.1.0/tests/test_basedpyright.py +77 -0
  77. pycode_doctor-0.1.0/tests/test_cache.py +211 -0
  78. pycode_doctor-0.1.0/tests/test_cached_analyzer.py +176 -0
  79. pycode_doctor-0.1.0/tests/test_cli.py +24 -0
  80. pycode_doctor-0.1.0/tests/test_cli_flags.py +303 -0
  81. pycode_doctor-0.1.0/tests/test_config.py +54 -0
  82. pycode_doctor-0.1.0/tests/test_dedup.py +111 -0
  83. pycode_doctor-0.1.0/tests/test_dependency_discovery.py +142 -0
  84. pycode_doctor-0.1.0/tests/test_dependency_vulns.py +352 -0
  85. pycode_doctor-0.1.0/tests/test_deptry.py +214 -0
  86. pycode_doctor-0.1.0/tests/test_detect_secrets.py +169 -0
  87. pycode_doctor-0.1.0/tests/test_detection.py +267 -0
  88. pycode_doctor-0.1.0/tests/test_diff.py +125 -0
  89. pycode_doctor-0.1.0/tests/test_discovery.py +94 -0
  90. pycode_doctor-0.1.0/tests/test_formatters.py +423 -0
  91. pycode_doctor-0.1.0/tests/test_mcp_installer.py +120 -0
  92. pycode_doctor-0.1.0/tests/test_mcp_server.py +190 -0
  93. pycode_doctor-0.1.0/tests/test_models.py +98 -0
  94. pycode_doctor-0.1.0/tests/test_mypy_analyzer.py +167 -0
  95. pycode_doctor-0.1.0/tests/test_radon_analyzer.py +110 -0
  96. pycode_doctor-0.1.0/tests/test_registry.py +102 -0
  97. pycode_doctor-0.1.0/tests/test_release_gates.py +516 -0
  98. pycode_doctor-0.1.0/tests/test_ruff_analyzer.py +371 -0
  99. pycode_doctor-0.1.0/tests/test_rule_db.py +146 -0
  100. pycode_doctor-0.1.0/tests/test_rules.py +84 -0
  101. pycode_doctor-0.1.0/tests/test_runner_parallel.py +237 -0
  102. pycode_doctor-0.1.0/tests/test_scoring.py +521 -0
  103. pycode_doctor-0.1.0/tests/test_skill_installer.py +300 -0
  104. pycode_doctor-0.1.0/tests/test_typos.py +61 -0
  105. pycode_doctor-0.1.0/tests/test_vulture_analyzer.py +105 -0
@@ -0,0 +1,216 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+
204
+ # Ruff stuff:
205
+ .ruff_cache/
206
+
207
+ # PyPI configuration file
208
+ .pypirc
209
+
210
+ # Marimo
211
+ marimo/_static/
212
+ marimo/_lsp/
213
+ __marimo__/
214
+
215
+ # Streamlit
216
+ .streamlit/secrets.toml
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nabeel S. Qureshi
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.
@@ -0,0 +1,235 @@
1
+ Metadata-Version: 2.4
2
+ Name: pycode-doctor
3
+ Version: 0.1.0
4
+ Summary: Fast, local-first CLI that gives your Python codebase a 0-100 health score
5
+ Project-URL: Homepage, https://github.com/nabroleonx/python-doctor
6
+ Project-URL: Documentation, https://nabroleonx.github.io/python-doctor/
7
+ Project-URL: Repository, https://github.com/nabroleonx/python-doctor.git
8
+ Project-URL: Issues, https://github.com/nabroleonx/python-doctor/issues
9
+ Author: Nabeel S. Qureshi
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: ai-agent,code-quality,health-check,linting,mcp,python,static-analysis
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Classifier: Topic :: Software Development :: Testing
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: bandit>=1.8
27
+ Requires-Dist: click>=8.1
28
+ Requires-Dist: deptry>=0.14
29
+ Requires-Dist: mypy>=1.13
30
+ Requires-Dist: radon>=6.0
31
+ Requires-Dist: rich>=13.0
32
+ Requires-Dist: ruff>=0.8.0
33
+ Requires-Dist: vulture>=2.12
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
36
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
37
+ Requires-Dist: pytest-mock>=3.14; extra == 'dev'
38
+ Requires-Dist: pytest>=8.0; extra == 'dev'
39
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
40
+ Provides-Extra: full
41
+ Requires-Dist: basedpyright>=1.38; extra == 'full'
42
+ Requires-Dist: detect-secrets>=1.5; extra == 'full'
43
+ Requires-Dist: httpx>=0.27; extra == 'full'
44
+ Requires-Dist: mcp>=1.0; extra == 'full'
45
+ Requires-Dist: typos>=1.44; extra == 'full'
46
+ Provides-Extra: mcp
47
+ Requires-Dist: mcp>=1.0; extra == 'mcp'
48
+ Provides-Extra: pyright
49
+ Requires-Dist: basedpyright>=1.38; extra == 'pyright'
50
+ Provides-Extra: quality-extra
51
+ Requires-Dist: typos>=1.44; extra == 'quality-extra'
52
+ Provides-Extra: secrets
53
+ Requires-Dist: detect-secrets>=1.5; extra == 'secrets'
54
+ Provides-Extra: vulns
55
+ Requires-Dist: httpx>=0.27; extra == 'vulns'
56
+ Description-Content-Type: text/markdown
57
+
58
+ # python-doctor
59
+
60
+ Fast, local-first Python code health checks with a single command.
61
+
62
+ `python-doctor` combines Ruff, mypy, Bandit, Radon, Vulture, and deptry into a
63
+ single 0-100 score with clear category breakdowns. It is designed to feel good
64
+ with `uvx` first.
65
+
66
+ ## Quickstart
67
+
68
+ Run it with no install step:
69
+
70
+ ```bash
71
+ uvx python-doctor .
72
+ ```
73
+
74
+ Use the latest published version explicitly:
75
+
76
+ ```bash
77
+ uvx python-doctor@latest .
78
+ ```
79
+
80
+ For deeper optional scans:
81
+
82
+ ```bash
83
+ uvx --from 'python-doctor[full]' python-doctor .
84
+ ```
85
+
86
+ Persistent install:
87
+
88
+ ```bash
89
+ uv tool install python-doctor
90
+ ```
91
+
92
+ ## What The Default Scan Includes
93
+
94
+ - Ruff for quality, security, complexity, and dead-code rule families
95
+ - mypy for type checking
96
+ - Bandit for security checks
97
+ - Radon for complexity metrics
98
+ - Vulture for dead code
99
+ - deptry for dependency hygiene
100
+
101
+ Optional extras add:
102
+
103
+ - `dependency-vulns` for OSV-backed dependency vulnerability scanning
104
+ - `detect-secrets` for secret scanning
105
+ - `basedpyright` as an optional type backend
106
+ - `typos` for spelling checks in source code
107
+ - MCP support
108
+
109
+ ## Common Commands
110
+
111
+ ```bash
112
+ # fast feedback
113
+ python-doctor . --profile quick
114
+
115
+ # full default scan
116
+ python-doctor .
117
+
118
+ # include optional analyzers if installed
119
+ python-doctor . --profile full
120
+
121
+ # only score output
122
+ python-doctor . --score
123
+
124
+ # machine-readable output
125
+ python-doctor . --json
126
+
127
+ # analyze only selected categories
128
+ python-doctor . --only quality,types
129
+
130
+ # skip categories
131
+ python-doctor . --skip security,dead_code
132
+
133
+ # safe Ruff autofix, then rescan
134
+ python-doctor . --fix
135
+
136
+ # show remediation text inline
137
+ python-doctor . --show-fixes
138
+ ```
139
+
140
+ ## Why `src/python_doctor/`?
141
+
142
+ The package is intentionally laid out as `src/python_doctor/`.
143
+
144
+ - `python-doctor` is the distribution and CLI name
145
+ - `python_doctor` is the Python import package name
146
+
147
+ The `src/` layout prevents packaging and test mistakes where imports succeed
148
+ from the checkout but fail from the built wheel.
149
+
150
+ ## Configuration
151
+
152
+ Zero-config by default. Customize in `pyproject.toml`:
153
+
154
+ ```toml
155
+ [tool.python-doctor]
156
+ timeout = 60
157
+
158
+ [tool.python-doctor.weights]
159
+ quality = 25
160
+ types = 20
161
+ security = 20
162
+ complexity = 15
163
+ dead_code = 10
164
+ dependencies = 10
165
+
166
+ [tool.python-doctor.ignore]
167
+ rules = ["S101"]
168
+ files = ["tests/**", "migrations/**"]
169
+ ```
170
+
171
+ See `docs/configuration.md` for the full reference.
172
+
173
+ ## MCP Server
174
+
175
+ Expose health data to AI coding agents (Claude Code, Cursor, VS Code):
176
+
177
+ ```bash
178
+ python-doctor install-mcp cursor
179
+ ```
180
+
181
+ This registers python-doctor as an MCP server. Your AI agent can then call
182
+ tools like `analyze_code`, `explain_rule`, `get_score`, `suggest_fixes`, and
183
+ `check_diff`.
184
+
185
+ See `docs/mcp-server.md` for details.
186
+
187
+ ## Plugins
188
+
189
+ Extend python-doctor with custom analyzers via entry points:
190
+
191
+ ```toml
192
+ [project.entry-points."python_doctor.analyzers"]
193
+ my-analyzer = "my_package:MyAnalyzer"
194
+ ```
195
+
196
+ See `docs/plugins.md` for the full guide.
197
+
198
+ ## Output Model
199
+
200
+ The score covers six categories:
201
+
202
+ - quality
203
+ - type safety
204
+ - security
205
+ - complexity
206
+ - dead code
207
+ - dependencies
208
+
209
+ V1 also reports coverage, so a score can tell you whether the scan was full,
210
+ partial, or limited.
211
+
212
+ ## Docs
213
+
214
+ Kept intentionally small:
215
+
216
+ - `docs/configuration.md` -- weights, thresholds, ignore rules
217
+ - `docs/scoring.md` -- scoring methodology
218
+ - `docs/mcp-server.md` -- MCP server setup
219
+ - `docs/plugins.md` -- custom analyzer development
220
+ - `docs/development.md` -- contributing to python-doctor
221
+
222
+ ## Development
223
+
224
+ ```bash
225
+ uv sync --all-extras
226
+ uv run pytest
227
+ uv run ruff check src tests
228
+ uv run mypy src
229
+ ```
230
+
231
+ See `docs/development.md` for the full guide.
232
+
233
+ ## License
234
+
235
+ MIT
@@ -0,0 +1,178 @@
1
+ # python-doctor
2
+
3
+ Fast, local-first Python code health checks with a single command.
4
+
5
+ `python-doctor` combines Ruff, mypy, Bandit, Radon, Vulture, and deptry into a
6
+ single 0-100 score with clear category breakdowns. It is designed to feel good
7
+ with `uvx` first.
8
+
9
+ ## Quickstart
10
+
11
+ Run it with no install step:
12
+
13
+ ```bash
14
+ uvx python-doctor .
15
+ ```
16
+
17
+ Use the latest published version explicitly:
18
+
19
+ ```bash
20
+ uvx python-doctor@latest .
21
+ ```
22
+
23
+ For deeper optional scans:
24
+
25
+ ```bash
26
+ uvx --from 'python-doctor[full]' python-doctor .
27
+ ```
28
+
29
+ Persistent install:
30
+
31
+ ```bash
32
+ uv tool install python-doctor
33
+ ```
34
+
35
+ ## What The Default Scan Includes
36
+
37
+ - Ruff for quality, security, complexity, and dead-code rule families
38
+ - mypy for type checking
39
+ - Bandit for security checks
40
+ - Radon for complexity metrics
41
+ - Vulture for dead code
42
+ - deptry for dependency hygiene
43
+
44
+ Optional extras add:
45
+
46
+ - `dependency-vulns` for OSV-backed dependency vulnerability scanning
47
+ - `detect-secrets` for secret scanning
48
+ - `basedpyright` as an optional type backend
49
+ - `typos` for spelling checks in source code
50
+ - MCP support
51
+
52
+ ## Common Commands
53
+
54
+ ```bash
55
+ # fast feedback
56
+ python-doctor . --profile quick
57
+
58
+ # full default scan
59
+ python-doctor .
60
+
61
+ # include optional analyzers if installed
62
+ python-doctor . --profile full
63
+
64
+ # only score output
65
+ python-doctor . --score
66
+
67
+ # machine-readable output
68
+ python-doctor . --json
69
+
70
+ # analyze only selected categories
71
+ python-doctor . --only quality,types
72
+
73
+ # skip categories
74
+ python-doctor . --skip security,dead_code
75
+
76
+ # safe Ruff autofix, then rescan
77
+ python-doctor . --fix
78
+
79
+ # show remediation text inline
80
+ python-doctor . --show-fixes
81
+ ```
82
+
83
+ ## Why `src/python_doctor/`?
84
+
85
+ The package is intentionally laid out as `src/python_doctor/`.
86
+
87
+ - `python-doctor` is the distribution and CLI name
88
+ - `python_doctor` is the Python import package name
89
+
90
+ The `src/` layout prevents packaging and test mistakes where imports succeed
91
+ from the checkout but fail from the built wheel.
92
+
93
+ ## Configuration
94
+
95
+ Zero-config by default. Customize in `pyproject.toml`:
96
+
97
+ ```toml
98
+ [tool.python-doctor]
99
+ timeout = 60
100
+
101
+ [tool.python-doctor.weights]
102
+ quality = 25
103
+ types = 20
104
+ security = 20
105
+ complexity = 15
106
+ dead_code = 10
107
+ dependencies = 10
108
+
109
+ [tool.python-doctor.ignore]
110
+ rules = ["S101"]
111
+ files = ["tests/**", "migrations/**"]
112
+ ```
113
+
114
+ See `docs/configuration.md` for the full reference.
115
+
116
+ ## MCP Server
117
+
118
+ Expose health data to AI coding agents (Claude Code, Cursor, VS Code):
119
+
120
+ ```bash
121
+ python-doctor install-mcp cursor
122
+ ```
123
+
124
+ This registers python-doctor as an MCP server. Your AI agent can then call
125
+ tools like `analyze_code`, `explain_rule`, `get_score`, `suggest_fixes`, and
126
+ `check_diff`.
127
+
128
+ See `docs/mcp-server.md` for details.
129
+
130
+ ## Plugins
131
+
132
+ Extend python-doctor with custom analyzers via entry points:
133
+
134
+ ```toml
135
+ [project.entry-points."python_doctor.analyzers"]
136
+ my-analyzer = "my_package:MyAnalyzer"
137
+ ```
138
+
139
+ See `docs/plugins.md` for the full guide.
140
+
141
+ ## Output Model
142
+
143
+ The score covers six categories:
144
+
145
+ - quality
146
+ - type safety
147
+ - security
148
+ - complexity
149
+ - dead code
150
+ - dependencies
151
+
152
+ V1 also reports coverage, so a score can tell you whether the scan was full,
153
+ partial, or limited.
154
+
155
+ ## Docs
156
+
157
+ Kept intentionally small:
158
+
159
+ - `docs/configuration.md` -- weights, thresholds, ignore rules
160
+ - `docs/scoring.md` -- scoring methodology
161
+ - `docs/mcp-server.md` -- MCP server setup
162
+ - `docs/plugins.md` -- custom analyzer development
163
+ - `docs/development.md` -- contributing to python-doctor
164
+
165
+ ## Development
166
+
167
+ ```bash
168
+ uv sync --all-extras
169
+ uv run pytest
170
+ uv run ruff check src tests
171
+ uv run mypy src
172
+ ```
173
+
174
+ See `docs/development.md` for the full guide.
175
+
176
+ ## License
177
+
178
+ MIT