wads.repo_audit¶
Read-only health audit of a (wads-managed) Python repo.
Checks every health dimension a repo doctor cares about — legacy packaging leftovers, pyproject metadata shape, CI workflow generation (uv stub / inline uv / 2025 / legacy / none), stale test paths, module docstring presence, GitHub metadata drift (description / homepage / topics vs pyproject), Pages status, latest CI run conclusion, and PyPI-vs-pyproject version sync — and prints a prioritized report grouped HIGH / MEDIUM / LOW, each finding tagged with the specialist skill (or CLI) that owns the fix.
This module is the single source of truth for the ecosystem’s “what is a modern wads repo” classification. Import it:
from wads.repo_audit import audit_repo
report = audit_repo("/path/to/repo", network=False) # dict: facts + findings
or run it as a script / module:
python -m wads.repo_audit [REPO_DIR] [--json] [--no-network]
REPO_DIR defaults to the current directory. --json emits the full
machine-readable report. --no-network skips everything that leaves the
machine (gh calls and the PyPI lookup); it also degrades gracefully when
gh is absent or offline.
Needs only wads’ core dependencies. Strictly read-only: never modifies the target repo or anything
else. The wads-repo-doctor skill ships a thin shim (scripts/repo_audit.py)
that defers to this module.
Functions
|
|
|
|
|
|
|
gh-based checks; every step degrades silently when gh/network fail. |
|
Flag an inline workflow copy that predates the trigger gate while pyproject is on-demand. |
|
|
|
|
|
|
|
Audit a repo and return the machine-readable report dict. |
|
|
|
Fetch origin and flag a local checkout that is behind its upstream. |
|
Flag a stub whose on-demand pre-filter markers differ from |
|
Flag URLs (pyproject urls, README) whose owner differs from the git remote's. |
|
Classify one workflow file's text into a wads CI generation. |
|
|
|
|
|
GitHub / Pages URLs in text naming this repo under a different owner. |
|
|
|
Classes
|
Accumulates facts and findings; renders text or JSON. |
- class wads.repo_audit.Report(repo)[source]¶
Bases:
objectAccumulates facts and findings; renders text or JSON.
- wads.repo_audit.audit_github(repo_slug, rep, project, docs_enabled)[source]¶
gh-based checks; every step degrades silently when gh/network fail.
- wads.repo_audit.audit_inline_trigger_gate(repo, rep, text)[source]¶
Flag an inline workflow copy that predates the trigger gate while pyproject is on-demand.
The inline workflow reads the trigger at run time, so it cannot go stale on a marker; but a copy without the gate ignores
mode = "on-demand"and runs on every push.
- wads.repo_audit.audit_repo(repo='.', *, network=True)[source]¶
Audit a repo and return the machine-readable report dict.
This is the importable entry point (the SSOT classifier). It returns the same structure as
python -m wads.repo_audit <repo> --json:{"repo": ..., "summary": {HIGH/MEDIUM/LOW counts}, "findings": [...], "facts": {...}}
network=Falseskips everything that leaves the machine (gh+ PyPI), matching the--no-networkCLI flag.
- wads.repo_audit.audit_staleness(repo, rep)[source]¶
Fetch origin and flag a local checkout that is behind its upstream.
A stale checkout makes version and CI findings (e.g. “PyPI is ahead of pyproject”) false alarms, so this runs before them. Only remote-tracking refs are updated; the working tree is never touched.
- wads.repo_audit.audit_trigger_drift(repo, rep, stub_text)[source]¶
Flag a stub whose on-demand pre-filter markers differ from
[tool.wads.ci.trigger].A stale pre-filter silently runs nothing for a marker pyproject declares (the workflow behind it is fine): the fix is always a re-render.
- wads.repo_audit.audit_url_owners(repo, rep, project, repo_slug)[source]¶
Flag URLs (pyproject urls, README) whose owner differs from the git remote’s.
- wads.repo_audit.classify_workflow(text)[source]¶
Classify one workflow file’s text into a wads CI generation.
- wads.repo_audit.owner_mismatched_urls(text, repo_slug)[source]¶
GitHub / Pages URLs in text naming this repo under a different owner.
A repo transferred to another owner keeps the old one in generated URLs. Only URLs whose repo name equals the remote’s are flagged, so links to unrelated projects are left alone.
>>> owner_mismatched_urls("https://github.com/old/pkg and https://github.com/x/y", "new/pkg") ['github.com/old/pkg'] >>> owner_mismatched_urls("https://old.github.io/pkg/", "new/pkg") ['old.github.io/pkg'] >>> owner_mismatched_urls("https://github.com/new/pkg", "new/pkg") []