README.md

xpd

xpd is a fast static analyzer, API search engine, and recorded review workbench for Python codebases, data pipelines, and coding agents. Run uvx xpd check . to catch slow or wrong library calls without running Python, or run uvx xpd audit . for a unified read-only health report across linter rules, static review workflows, --since regression deltas, and recorded ledger debt.

Read the full documentation at https://xpd-docs.aagaardbs.workers.dev/.

mermaid
1flowchart LR
2 Code["Python, TSX, and Rust files"] --> Lint["Lint and audit (xpd check, audit, lsp)"]
3 Code --> Search["Search bundled APIs (xpd find, api)"]
4 Code --> Ledgers["Recorded workflows (quest, enhance, optimize, data, ML, charts)"]
5 Code --> Proof["Data profiling and proof (xpd profile, equiv)"]
6 Code --> Agent["Agent and media tools (xpd mcp, plugin, animate)"]

xpd ships rule packs and symbol indexes for pandas, Polars, NumPy, SciPy, scikit-learn, skrub, Feature-engine, scikit-lego, optbinning, glum, InterpretML, quantile-forest, MAPIE, venn-abers, PyMC, skore, model-diagnostics, SHAP, fippy, effector, Optuna, Optuna Integration, Category Encoders, LightGBM, XGBoost, statsmodels, linearmodels, arch, tslearn, CVXPY, skfolio, pymoo, Nixtla forecasting libraries, plotly, Apache Hamilton, DSPy, and core Python.

Install

xpd requires Python 3.13 or newer. Install it once with uv, or invoke any command directly with uvx xpd.

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

Check and fix a file

Save bad.py in an empty folder. xpd parses the source statically, so you do not need pandas installed.

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 --format text. Terminal runs default to text, and piped runs default to JSON.

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
SeverityMeaningExit code
errorCode gives a wrong result or raises an exception1
warningCode is slow or easy to get wrong0
infoA shorter or newer form exists0

Apply safe rewrites with --fix. Add --unsafe-fixes when you accept fixes that can change runtime behavior, and review the diff afterwards.

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()

Set style = "strict" in [tool.xpd] of pyproject.toml or in ~/.config/xpd/config.toml to promote house style info rules to warnings. See xpd check for details.

Audit a repository in one command

Run xpd audit for a read-only rollup of xpd check, static ledger workflows (untangle, harden, optimize, discover, or --workflows all), --since regression counts, and recorded ledger debt. Add --fail-on-regression in CI or local gates to exit 1 when new issues appear.

sh
1xpd audit src/ --since HEAD~1 --fail-on-regression

Commands at a glance

Run xpd <command> -h or read the command reference for every option and exit status.

AreaCommandsWhat they do
Guided meta-workflowsquest, enhanceClarify an open-ended goal and sequence workflows step by step (quest), or triage and coordinate harden, discover, untangle, and optimize (enhance)
Lint, audit, and editorscheck, audit, rules, lspLint files, aggregate read-only audits with --since regression gating, and serve editor diagnostics plus workspace structural hints
Code quality ledgersenhance untangle, enhance harden, enhance discover, optimizeAudit coupling (--map for Python and Rust, --move, --inline-facade), silent failures or flaky tests, search-unfriendly names, and honest-performance CPU or memory waste
Data, ML, and visual workflowsdata-prep, time-series, feature-engineering, modeling, math-opt, chartsGuide and verify ingestion and scaling, time series diagnostics, feature engineering lift, model selection and calibration, numerical solvers, and charts or tables across ten visualization and table books
Library lookupfind, apiSearch bundled library symbols, rules, and playbooks with semantic and keyword ranking
Data profiling and proofprofile, equivProfile data files and prove refactors preserve result
Authoring and mediarules new, rules test, rules run, rules outline, animateAuthor custom ast-grep rules, map modules, and inspect or render editable ManimGX animations with animate catalog, animate inspect, and --profile draft
Integrationshook, mcp, doctor, skill, completionsRun the 4-tool MCP server, Ruff and ty profile doctor, bundled agent skills, and shell completions

Connect agents and editors

Install the xpd plugin in Claude Code or Codex to check Python edits automatically and enable the 4-tool MCP server and all 5 bundled skills (xpd, xpd-animate, xpd-enhance, xpd-look, xpd-quest) in one step.

sh
1claude plugin marketplace add https://git.cafe/dynd/xpd.git
2claude plugin install xpd@xpd
GoalSetupGuide
Connect agents with MCP and bundled skillsInstall the Claude Code or Codex pluginClaude Code and other agents
Install only the agent skillsnpx skills add https://git.cafe/dynd/xpd.gitAgent skills
Add discovery gate and ManimGX animation MCP toolsclaude mcp add xpd -- uvx xpd mcpConnect an agent with MCP
Run a unified read-only repository auditxpd audit src/ --since mainAudit a repository
Lint, quick-fix, and view workspace hints in an editorConfigure xpd lspUse xpd in an editor
Refactor coupling or render ManimGX animationsxpd enhance or xpd animateUntangle and Animate

License

You may use xpd under MIT or Apache-2.0. Bundled recipes and dependencies keep their own licenses in licenses/.

ComponentLicenseLocation
xpd source and playbooksMIT or Apache-2.0LICENSE-MIT, LICENSE-APACHE
Library recipesLibrary license (MIT, BSD-3-Clause, Apache-2.0, or NCSA)licenses/ (xpd api <recipe> prints license and source)
ManimGX API indexMITAcadema, Inc.
option-extMPL-2.0licenses/option-ext-LICENSE.txt, licenses/option-ext-0.2.0-source.tar.gz
libcstMIT and PSF-2.0licenses/libcst-LICENSE
EmbeddingGemma (xpd find download)Gemma Terms of Use (https://ai.google.dev/gemma/terms)Downloaded on first xpd find, not shipped