Installation

Requirements

  • Python 3.10+

Install

pip install trailhead

PyTorch: CPU or GPU

Embeddings use sentence-transformers, which needs PyTorch. On Linux, pip install trailhead pulls the CUDA build of PyTorch with its NVIDIA libraries, several gigabytes. trailhead's embedding model runs well on a CPU, so unless you want GPU embeddings, install the CPU build of PyTorch first; it is a fraction of the size:

pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install trailhead

With uv: uv pip install torch --index-url https://download.pytorch.org/whl/cpu, then install trailhead. On Windows and macOS the default PyTorch wheels have no CUDA libraries, so this step isn't needed there.

Language support

Python is supported out of the box. Additional languages are installed as optional extras. Only the packages you install will be active; missing ones are silently skipped at startup.

Install individual languages:

pip install "trailhead[javascript]"
pip install "trailhead[typescript]"
pip install "trailhead[rust]"
pip install "trailhead[go]"
pip install "trailhead[java]"
pip install "trailhead[csharp]"
pip install "trailhead[c]"
pip install "trailhead[cpp]"
pip install "trailhead[ruby]"
pip install "trailhead[php]"
pip install "trailhead[bash]"
pip install "trailhead[html]"
pip install "trailhead[ansible]"

Or install everything at once:

pip install "trailhead[all-languages]"
Extra Language File extensions
python (built-in) Python .py
javascript JavaScript .js .mjs .cjs
typescript TypeScript / TSX .ts .tsx
rust Rust .rs
go Go .go
java Java .java
csharp C# .cs
c C .c .h
cpp C++ .cpp .cc .cxx .hpp .hxx .h++
ruby Ruby .rb
php PHP .php
bash Bash / Shell .sh .bash
html HTML .html .htm
ansible Ansible-shaped YAML .yml .yaml

Ansible only claims YAML files whose shape looks like Ansible: strong role paths under roles/<name>/{tasks,handlers,defaults,vars,meta}/, weak path hints under group_vars/, host_vars/, tasks/, or handlers/, then Tier 1 / Tier 2 sniffing for playbook or task markers. If a playbook is skipped, moving it under roles/ or tasks/ usually makes the path-shape check succeed immediately.

Development install

To get the latest unreleased changes, install directly from the repository:

git clone https://github.com/McIndi/trailhead.git
cd trailhead
python -m venv .venv
source .venv/bin/activate  # Windows: .\.venv\Scripts\Activate.ps1
pip install -e ".[dev]"

On Linux, install the CPU build of PyTorch first unless you want GPU embeddings (see PyTorch: CPU or GPU).