Index
axm_audit
axm-audit: Code auditing and quality rules for Python projects.
This package provides comprehensive project auditing capabilities including: - Structure validation (files, directories) - Quality checks (linting, type checking, complexity) - Security analysis (Bandit integration, secrets detection) - Dependency scanning (pip-audit, deptry) - Test coverage enforcement (pytest-cov) - Architecture analysis (circular imports, god classes, coupling) - Best practices enforcement (docstrings, security patterns)
Example
from axm_audit import audit_project from pathlib import Path
result = audit_project(Path(".")) print(f"Score: {result.quality_score}/100 — Grade {result.grade}") Score: 95.0/100 — Grade A
AuditResult
Bases: BaseModel
Aggregated result of a project audit.
Contains all individual check results and computed summary.
Source code in packages/axm-audit/src/axm_audit/models/results.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
failed
property
Number of failed checks.
grade
property
Letter grade derived from quality_score.
A >= 90, B >= 80, C >= 70, D >= 60, F < 60. Returns None if quality_score is None.
quality_score
property
Weighted average across 8 code-quality categories.
Categories and weights
Linting (20%), Type Safety (15%), Complexity (15%), Security (10%), Dependencies (10%), Testing (15%), Architecture (10%), Practices (5%).
Structure is NOT scored here (handled by axm-init). Returns None if no scored checks are present.
success
property
True if all checks passed.
total
property
Total number of checks.
CheckResult
Bases: BaseModel
Result of a single compliance check.
Designed for machine parsing by AI Agents.
Source code in packages/axm-audit/src/axm_audit/models/results.py
Severity
Bases: StrEnum
Severity level for check results.
Source code in packages/axm-audit/src/axm_audit/models/results.py
audit_project(project_path, category=None, quick=False)
Audit a project against Python 2026 standards.
Rules execute in parallel via ThreadPoolExecutor for speed.
Each rule is isolated — one failure does not prevent others.
An ASTCache is shared across rules to avoid redundant parsing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_path
|
Path
|
Root directory of the project to audit. |
required |
category
|
str | None
|
Optional category filter. |
None
|
quick
|
bool
|
If True, run only lint + type checks. |
False
|
Returns:
| Type | Description |
|---|---|
AuditResult
|
AuditResult containing all check results. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If project_path does not exist. |
Source code in packages/axm-audit/src/axm_audit/core/auditor.py
get_rules_for_category(category, quick=False)
Get rules for a specific category or all rules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category
|
str | None
|
Filter to specific category, or None for all. |
required |
quick
|
bool
|
If True, only lint + type checks. |
False
|
Returns:
| Type | Description |
|---|---|
list[ProjectRule]
|
List of rule instances to run. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If category is not valid. |