Python Repo Auditor
A static Python AST review with relative path and line evidence; it does not execute project code.
- Input
- A selected local Python repository
- Output
- A JSON report with relative paths and line evidence; no test or customer-code execution is performed.
What it does
- Surfaces AST review cues, import-cycle candidates, and function metrics
- Includes selected packaging, dependency, CI, and test configuration signals
- Treats findings as review cues rather than proof of runtime defects
Overview
Python Repo Auditor is a static Python 3.11+ CLI that audits local Python repositories for structural gaps and AST-level code smells such as missing dependency manifests, missing test files, and mutable default arguments. It runs completely offline without importing target modules, querying external vulnerability databases, or executing project code.
When to use it
- Auditing a Python codebase before release, handoff, or agent-assisted refactoring.
- Catching missing manifests, absent test files, and common Python AST pitfalls with file and line precision.
- Generating a reproducible JSON summary of high and review priority counts in air-gapped or local-only environments.
Audit a Python repository
Needs Python 3.11 or newer and only the standard library. Run from the package directory and point it at a Python project.
python3 scripts/python_repo_auditor.py /path/to/repositorySample output
Abridged output from version 0.1.0, run on a small synthetic fixture.
{
"status": "ok",
"findings": [
{
"code": "NO_DEPENDENCY_MANIFEST",
"severity": "review"
},
{
"code": "NO_TEST_FILES",
"severity": "review"
},
{
"code": "MUTABLE_DEFAULT_ARGUMENT",
"path": "sample.py",
"line": 1,
"severity": "review"
}
],
"parsed_python_files": 1,
"priority_counts": {
"high": 0,
"review": 5
}
}Exit codes and limits
- Exit 0 means the inspection completed, including when it has findings. Exit 2 means invalid or unreadable input.
- Static evidence only: no customer code, imports, tests or network requests are executed.
- Inputs are limited to 1 MB per file, 5,000 files and 20 MB in total; symlinks and common credential files are skipped.
- Dependency checks query no vulnerability database, and import-cycle candidates do not prove runtime failures.
Questions
Does Python Repo Auditor execute or import the audited Python code?
No. It parses source files statically using the Python 3.11+ standard library only, without executing code, imports, tests, or network calls.
Does it check packages against live CVE or PyPI vulnerability databases?
No. Dependency checks are strictly local and offline—it flags structural issues like missing manifests without querying external vulnerability databases.
What repository size limits apply during a scan?
The auditor enforces strict safety bounds of 1 MB per file, 5,000 files, and 20 MB total, and skips symlinks and common credential files.
Are import-cycle findings guaranteed runtime errors?
No. Import-cycle candidates are static review cues and do not prove a runtime circular-import failure.