Installation¶
ShortKit-ML is the Python package shortcut_detect, on PyPI as shortkit-ml (0.2.0 and later carry the shortcut_detect.audit module that the ShortKit-ML paper uses).
Install from source when you want the examples, the dashboard and the walkthrough data, or to follow main.
Requirements¶
- Python 3.10, 3.11 or 3.12 (
requires-python = ">=3.10,<3.13"inpyproject.toml) - pip or uv
- PyTorch 2.2 and torchvision 0.17 are core dependencies and come with the install; see PyTorch with CUDA for a GPU build
Install from source¶
git clone https://github.com/criticaldata/ShortKit-ML.git
cd ShortKit-ML
uv venv --python 3.10
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install -e .
Without uv:
git clone https://github.com/criticaldata/ShortKit-ML.git
cd ShortKit-ML
python -m venv .venv
source .venv/bin/activate
pip install -e .
The editable install (-e) means a later git pull updates the package in place.
Optional extras¶
The base install covers the audit (shortcut_detect.audit), the 19 registered detectors, the Gradio dashboard and the HTML, PDF and Markdown reports. Extras add:
| Extra | Adds |
|---|---|
hf |
transformers, to embed raw text with Hugging Face models |
mcp |
the MCP server (shortkit-ml-mcp) |
jupyter |
JupyterLab, ipykernel and widgets for the example notebooks |
reporting |
umap-learn, for UMAP projections in reports |
docs |
MkDocs and the Material theme, to build this site |
dev |
pytest, black, ruff, mypy, pre-commit |
all |
everything above |
PyPI: pip install shortkit-ml installs release 0.1.0, which has the detectors and the dashboard but not the audit module. Use the source install until the next release.
PyTorch with CUDA¶
The package pins torch>=2.2.0,<2.3.0 and torchvision>=0.17.0,<0.18.0. For a GPU build, install the matching wheels from the PyTorch index:
# CUDA 12.1
uv pip install torch==2.2.0+cu121 torchvision==0.17.0+cu121 \
--index-url https://download.pytorch.org/whl/cu121
# CUDA 11.8
uv pip install torch==2.2.0+cu118 torchvision==0.17.0+cu118 \
--index-url https://download.pytorch.org/whl/cu118
Replace uv pip with pip if you do not use uv.
PDF export¶
PDF reports from ShortcutDetector.generate_report(..., format="pdf") go through WeasyPrint, which needs system libraries:
Install the GTK3 runtime from gtk.org
The audit report, shortcut_detect.audit.report.audit_report(result, "audit.pdf"), writes its PDF with matplotlib and does not need these.
Jupyter kernel¶
uv pip install -e ".[jupyter]"
python -m ipykernel install --user --name=shortcut_detect --display-name="Python (Shortcut_Detect)"
jupyter lab
Check the install¶
from shortcut_detect.audit import AuditConfig, conditional_audit
from shortcut_detect.audit.report import audit_report, summary_text
from shortcut_detect import ShortcutDetector, HBACDetector, SKLearnProbe
If the shortcut_detect.audit import fails, the installed copy is the PyPI 0.1.0 release rather than the source checkout.
Troubleshooting¶
Import errors¶
Reinstall with all extras:
CUDA not found¶
Next steps¶
- Quick start: run the audit, then the other methods
- Interactive dashboard: launch the web interface
- Detection methods: what each method does