Get started
Run uvx xpd check . in any Python project to find slow or broken library calls without importing or running your code, or run uvx xpd audit . for a read-only summary across linter rules, static review workflows, --since regression deltas, and recorded ledger debt.
Install
Section titled “Install”xpd requires Python 3.13 or newer. Install it once with uv, or replace xpd with uvx xpd in any command to run without installing.
uv tool install --python '>=3.13' xpdCheck a sample file
Section titled “Check a sample file”Save bad.py in an empty folder. You do not need pandas installed because xpd never executes your script.
import pandas as pd
df = pd.DataFrame({"a": [1, 2], "k": [1, 2]})other = df.copy()for i, row in df.iterrows(): df["a"][i] = row["a"] * 2df.dropna(inplace=True)m = pd.merge(df, other, on="k")out = pd.DataFrame()for f in ["x.csv"]: out = pd.concat([out, pd.read_csv(f)])Run xpd check bad.py. Terminal runs print text, and piped runs print JSON (pass --format text in scripts when you want text).
$ xpd check bad.py --format textbad.py:5:15: warning [pandas/row-loop] iterrows() builds a Series for every row. Compute on whole columns instead, such as df["a"] * df["w"]. When each row has to become a Python object, loop over itertuples() or to_dict("records").bad.py:6:5: error [pandas/chained-assignment] Chained assignment writes to a copy under copy-on-write, so the frame keeps its old values. Assign to df.loc[i, "a"] instead.bad.py:7:1: info [pandas/no-inplace] inplace=True gives no speedup and blocks chaining. Reassign instead.bad.py:8:5: warning [pandas/merge-without-validate] This merge can silently duplicate rows. Prove the key unique first, or pass validate=.bad.py:11:5: warning [pandas/concat-in-loop] out grows by one concat per pass, and each concat copies every earlier row. Collect the frames in a list and concat once after the loop.xpd: 5 issues, 2 more with --fix --unsafe-fixesRead diagnostics and apply fixes
Section titled “Read diagnostics and apply fixes”Each diagnostic line names the location, severity, rule identifier, and replacement guidance.
| Severity | Meaning | Exit code |
|---|---|---|
error |
Code produces a wrong result or raises an exception | 1 |
warning |
Code is slow or fragile | 0 |
info |
A shorter or cleaner idiom exists | 0 |
Safe fixes (--fix) preserve runtime behavior. Unsafe fixes (--fix --unsafe-fixes) can change behavior, so review the diff after applying them.
$ xpd check bad.py --fix --unsafe-fixes --format text...xpd: fixed 2, 3 issuesfor i, row in df.iterrows(): df["a"][i] = row["a"] * 2df.dropna(inplace=True) df.loc[i, "a"] = row["a"] * 2df = df.dropna()Line 6 now mutates df in place under pandas copy-on-write, and line 7 returns a new DataFrame instead of mutating shared references. No errors remain, so xpd check exits with 0.
Where to go next
Section titled “Where to go next”| Area | Start with |
|---|---|
| Unified repository health and CI gating | Audit a repository |
| Claude Code, Codex, MCP, and editors | Claude Code and other agents, MCP, and Editors |
| Code quality ledgers | Untangle, Optimize, Harden, and Discover |
| Data, ML, and visualization ledgers | Data prep, Time series, Features, Models, Optimization, and Charts |
| Concept animations and custom rules | Animate with ManimGX and Write a rule |
| Complete reference | Rules, Commands, and MCP server |