Offline coding-practice CLI for terminal-native practice.
Offline coding-practice CLI I built because nothing kills practice momentum like spotty Wi-Fi on a flight or terrible hotel internet.
Local problems, test runner, starter templates, reference solutions, cheat sheets, progress tracking. Terminal-native. Stays on your machine.
- Browse and practice a roadmap based on the public NeetCode 150 ordering from the terminal.
- Start each problem from a local
starter.py. - Write private attempts in ignored
solution.pyfiles. - Run local tests and track progress under
.walnut/. - Use cheat sheets and reference solutions when you need a nudge.
Only the first 14 problems are fully seeded with statements, local tests, and reference solutions right now: Arrays & Hashing plus Two Pointers. The rest are roadmap entries with metadata, links, placeholder statements, and starters.
- Python 3.9+ with working
venvandpip. - On Debian/Ubuntu, install venv support with
sudo apt install python3-venv. bashfor thesetupinstaller.- macOS or Linux.
- Windows users should use WSL.
- Internet once during
./setupto installrichandtextual. - Core practice is fully offline after setup.
Install from the repo root:
./setupThen open Walnut:
export PATH="$HOME/.local/bin:$PATH"
walnutAfter setup, walnut can run from any directory.
The cloned repo stays the source of truth for the app, problem library, local progress, notes, and attempts.
In an interactive terminal, plain walnut opens the browse interface.
Use walnut home for the static dashboard, or walnut tui when you want to be explicit.
./setup creates .venv/, installs Walnut in editable mode, writes a ~/.local/bin/walnut wrapper, pins that wrapper to this repo with WALNUT_HOME, and runs doctor plus verify --all.
It does not edit your shell profile by default.
It prints the one PATH line you can add yourself.
Pass --modify-profile if you want it to add that line to your shell profile.
Re-running setup is safe.
Open the browse interface:
walnutFrom there:
- Use
j/kto move around the list. - Press
[or]to switch between topics and the full problem list. - Press
enteron a topic to drill in. - Highlight a problem and press
sto start it. - Press
eto open the selectedsolution.py. - Press
tto run local tests. - Press
nto open private notes. - Press
cto open the cheat sheet.
You can also do the same flow with direct commands:
walnut topics
walnut list arrays-and-hashing
walnut show 3
walnut pick 3Write your answer in the generated solution.py file:
problems/01-arrays-and-hashing/03-two-sum/solution.py
Run it locally:
walnut test 3 --perfUse a dry run when you do not want to update progress:
walnut run 3 --perf| What you need | Command |
|---|---|
| Check setup | walnut doctor |
| Show topics | walnut topics |
| List a topic | walnut list two-pointers |
| Read a problem | walnut show 3 |
| Start solving | walnut pick 3 |
| Open solution in editor | walnut edit 3 |
| Run tests | walnut test 3 --perf |
| Get next hint | walnut hint 3 |
| Show reference solution | walnut solution 3 |
| Pick the next unsolved problem | walnut next |
| Reset local attempt/progress for a problem | walnut reset 3 |
| Print private notes path | walnut notes 3 |
| Open private notes in editor | walnut notes 3 --open |
| Open a cheat sheet | walnut cheat 3 |
| Print official links | walnut open-official 3 --print |
| Verify seeded solutions | walnut verify --all --plain |
walnutwalnut tui opens the same interface explicitly.
Key shortcuts:
j/k move
[/] switch tabs
enter open a topic
s start the selected problem
e open selected solution.py
t run local tests
r reset the active timer
n open notes
c open the cheat sheet
esc go back one layer
/ filter
q quit
If you prefer another shell or pane, run tests there with walnut test <id> --perf.
The TUI picks up the latest progress within a second.
Walnut is designed around a multi-pane terminal workflow. Tmux is the recommended setup, but it is not required. Ghostty tabs, iTerm panes, or any setup with separate terminal windows work too.
The layout I use is:
walnut
home runs `walnut`
editor opens the selected solution.py when I press e
notes opens the selected notes.md when I press n
Create that layout manually:
tmux new-session -d -s walnut -n home -c "$PWD"
tmux new-window -t walnut -n editor -c "$PWD"
tmux new-window -t walnut -n notes -c "$PWD"
tmux send-keys -t walnut:home 'walnut' C-m
tmux attach -t walnutThe session is auto-detected and the target window names default to editor and notes.
The WALNUT_TMUX_* variables are only needed if your session or window names differ from that layout:
WALNUT_TMUX_SESSION=walnut \
WALNUT_TMUX_EDITOR_WINDOW=editor \
WALNUT_TMUX_NOTES_WINDOW=notes \
walnutInside that setup, e sends the selected solution.py to the editor window, and n sends the selected notes.md to the notes window.
The tmux integration expects nvim to be available, or an already-running vim, vi, or nvim in the target window.
Without tmux, those keys show the file path so you can open it however you like.
Your practice work is intentionally ignored by git:
**/solution.py
**/notes.md
.walnut/
That means your attempts, notes, timers, and progress stay on your machine. A fresh clone starts clean.
Per-topic cheat sheets live in docs/cheatsheets/.
They cover all 18 roadmap topics plus python-stdlib and complexity.
walnut cheat --list
walnut cheat arrays-and-hashing
walnut cheat python
walnut cheat complexitySee the full PATH fix in Quickstart.
Walnut is an independent learning tool and is not affiliated with, endorsed by, or sponsored by LeetCode or NeetCode.
walnut sync-roadmap refreshes public roadmap metadata only: titles, topic labels, difficulty, LeetCode IDs, and links.
This project links to LeetCode problem pages and follows the public NeetCode 150 ordering for navigation. LeetCode and NeetCode own their respective names, websites, problem pages, explanations, videos, editorials, and other content.
Walnut does not copy or redistribute LeetCode or NeetCode problem statements, explanations, videos, paid content, editorials, or solution text. Seeded prompts, examples, local test cases, hints, and reference solutions in this repo are original Walnut practice material. For official problem text, use the linked LeetCode or NeetCode pages.