website/src/content/docs/index.md


title: Get started description: Install xpd, lint a pandas file, run a unified repository audit, and explore guides for ledgers, libraries, editors, and coding agents.

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.

mermaid
1flowchart LR
2 A["xpd check . or xpd audit ."] --> B["Parse source files statically"]
3 B --> C["Detect imported libraries and structure"]
4 C --> D["Run matching packs and static workflows"]
5 D --> E["Report issues, deltas, and optional fixes"]

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.

sh
1uv tool install --python '>=3.13' xpd

Check a sample file

Save bad.py in an empty folder. You do not need pandas installed because xpd never executes your script.

python
1import pandas as pd
2
3df = pd.DataFrame({"a": [1, 2], "k": [1, 2]})
4other = df.copy()
5for i, row in df.iterrows():
6 df["a"][i] = row["a"] * 2
7df.dropna(inplace=True)
8m = pd.merge(df, other, on="k")
9out = pd.DataFrame()
10for f in ["x.csv"]:
11 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).

console
1$ xpd check bad.py --format text
2bad.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").
3bad.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.
4bad.py:7:1: info [pandas/no-inplace] inplace=True gives no speedup and blocks chaining. Reassign instead.
5bad.py:8:5: warning [pandas/merge-without-validate] This merge can silently duplicate rows. Prove the key unique first, or pass validate=.
6bad.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.
7xpd: 5 issues, 2 more with --fix --unsafe-fixes

Read diagnostics and apply fixes

Each diagnostic line names the location, severity, rule identifier, and replacement guidance.

SeverityMeaningExit code
errorCode produces a wrong result or raises an exception1
warningCode is slow or fragile0
infoA shorter or cleaner idiom exists0

Safe fixes (--fix) preserve runtime behavior. Unsafe fixes (--fix --unsafe-fixes) can change behavior, so review the diff after applying them.

console
1$ xpd check bad.py --fix --unsafe-fixes --format text
2...
3xpd: fixed 2, 3 issues
diff
1 for i, row in df.iterrows():
2- df["a"][i] = row["a"] * 2
3-df.dropna(inplace=True)
4+ df.loc[i, "a"] = row["a"] * 2
5+df = 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

AreaStart with
Unified repository health and CI gatingAudit a repository
Claude Code, Codex, MCP, and editorsClaude Code and other agents, MCP, and Editors
Code quality ledgersUntangle, Optimize, Harden, and Discover
Data, ML, and visualization ledgersData prep, Time series, Features, Models, Optimization, and Charts
Custom rulesWrite a rule
Complete referenceRules, Commands, and MCP server