Fast, opinionated linter for Python library habits with pandas, NumPy, SciPy, scikit-learn and dozens more data and ML libraries, for humans and coding agents
Maintained. Last release today, commits in 4 of the last 26 weeks. Weaker on commit activity and contributor spread.
pip install xpdREADME as published on PyPI with version 4.1.0.
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://bjoernaagaard.github.io/xpd/.
flowchart LR
Code["Python, TSX, and Rust files"] --> Lint["Lint and audit (xpd check, audit, lsp)"]
Code --> Search["Search bundled APIs (xpd find, api)"]
Code --> Ledgers["Recorded workflows (quest, enhance, optimize, data, ML, charts)"]
Code --> Proof["Data profiling and proof (xpd profile, equiv)"]
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.
uv 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.
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"] * 2
df.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 --format text. Terminal runs default to text, and piped runs default to JSON.
$ xpd check bad.py --format text
bad.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] merge without validate= can silently duplicate rows.
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-fixes