Installation

Requirements

  • Python 3.8 or later

  • No mandatory external dependencies — all statistical math and LLM HTTP calls use only Python stdlib

Basic Installation

pip install hypotestx

This installs HypoTestX with zero runtime dependencies. All test functions, the regex fallback router, and all LLM backends work out of the box.

Optional Extras

Visualization

Enables result.plot(), plot_result(), plot_distributions(), plot_p_value(), and the embedded-chart path in generate_report() / export_html():

pip install hypotestx[visualization]
# installs: matplotlib>=3.5.0, plotly>=5.0.0

PDF Reporting

Enables export_pdf() and generate_report(fmt="pdf") via WeasyPrint (HTML → PDF):

pip install hypotestx[reporting]
# installs: weasyprint>=53.0

Development

Installs testing, linting, and formatting tools:

pip install hypotestx[dev]
# installs: pytest, pytest-cov, black, isort, flake8, mypy, pre-commit, pandas

Documentation

Installs tools needed to build this documentation:

pip install hypotestx[docs]
# installs: sphinx>=7.0, furo>=2024.1.29, myst-parser>=2.0

All Extras

pip install hypotestx[all]
# installs: matplotlib, plotly, weasyprint, pandas

Installing from Source

git clone https://github.com/Ankit-Anand123/HypoTestX.git
cd HypoTestX
pip install -e ".[dev]"

Ollama (Local LLM Backend)

To use the "ollama" backend for fully offline, free LLM routing:

  1. Install Ollama from https://ollama.com (macOS, Linux, Windows)

  2. Pull a model:

ollama pull llama3.2        # recommended default (~2 GB)
ollama pull mistral         # good alternative (~4 GB)
ollama pull phi4            # smaller, fast (~2.5 GB)
  1. Use in HypoTestX:

import hypotestx as hx

result = hx.analyze(
    df,
    "Is age correlated with salary?",
    backend="ollama",
    model="llama3.2",
)

Ollama runs a local server at http://localhost:11434 by default. Override with host="http://your-host:port".


HuggingFace Local Inference

To run models locally via the "huggingface" backend:

pip install transformers torch

Usage:

result = hx.analyze(
    df,
    "Is income different across regions?",
    backend="huggingface",
    model="microsoft/Phi-3.5-mini-instruct",
    use_local=True,
    device="cuda",   # or "cpu"
)

Note: Downloading large transformer models requires significant disk space and RAM/VRAM. For most use cases the HuggingFace Inference API (cloud, free tier) is a simpler option — just pass a token instead of use_local=True.