logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·31.10.26
← Back to news

Show HN: Openleetcode – local LeetCode runner where tests live in the repo

Original article
github.com|8 points|4 comments|by therepanic|Aug 18, 2026

Openleetcode: Bringing LeetCode Testing to Your Local Machine

Made in Haskell Build with Cabal Supported problems ci License Unlicense

"There are no magic machines and no magic operators." — DHH

Openleetcode is a local execution environment for LeetCode problems, developed in Haskell. Its primary goal is to democratize the testing process by moving the test suites out of a proprietary black box and directly into a transparent repository.

How It Works

The system operates by processing a solution file through a series of steps to determine if it passes the required tests. Mathematically, we can view the judging process as: Judge(Solution,Manifest)→Verdict\text{Judge}(\text{Solution}, \text{Manifest}) \rightarrow \text{Verdict}Judge(Solution,Manifest)→Verdict


🚀 Getting Started

To use the execution backend, Docker is required. Depending on your operating system, choose the appropriate installation method:

  • Linux/macOS: curl -fsSL https://raw.githubusercontent.com/therepanic/openleetcode/main/install.sh | sh
  • Windows (PowerShell): irm https://raw.githubusercontent.com/therepanic/openleetcode/main/install.ps1 | iex
  • Manual Docker Setup:
    curl -fsSL https://raw.githubusercontent.com/therepanic/openleetcode/main/openleetcode.yml -o openleetcode.yml
    curl -fsSL https://raw.githubusercontent.com/therepanic/openleetcode/main/backends/piston/docker-compose.yml -o piston.yml
    docker compose -f piston.yml up -d
    docker compose -f openleetcode.yml -f piston.yml run --rm openleetcode --version
    
    Note: Initial runtime installation may take several minutes.

⚙️ Backend Configuration

Currently, Openleetcode utilizes Piston as its primary execution engine.

SettingDefault ValueDescription
backend.urlhttp://localhost:2000The endpoint for the Piston API

To configure the backend from a local checkout:

  1. Start the backend: docker compose -f backends/piston/docker-compose.yml up -d
  2. Verify settings: openleetcode config list
  3. Update URL: openleetcode config set backend.url http://localhost:2000

🛠 Usage Guide

First, synchronize your local data: $ openleetcode download all

Submitting Solutions:

  • By ID: $ openleetcode submit ./two_sum.py --id 1
  • By Title: $ openleetcode submit ./solution.cpp --title "two-sum"
  • Manual Language Override: $ openleetcode submit ./main.abc --id 1 --lang python3

Maintenance: $ openleetcode update

🌐 Supported Languages

The runner provides compatibility layers (handling JSON, matrices, linked lists, and binary trees) to ensure your code looks like a standard LeetCode submission rather than a standalone program.

  • C-Family: cpp, java, csharp
  • Systems/Modern: rust, go, kotlin, swift
  • Scripting/Web: python3, python2, ruby, typescript, dart

🤝 Contributing

For Developers (Code)

You will need a Haskell toolchain with Cabal.

# Build the CLI tool
cabal build exe:openleetcode

# Execute tests
cabal test core-tests
cabal test cli-tests

# Run the app
cabal run openleetcode

For Content Contributors (Tests)

If you aren't writing Haskell, you can help by improving the test suites. Refer to TEST_FORMAT.md for the contract between YAML manifests, templates, and the judge.

Structure: Each problem resides in its own directory (e.g., tests/1-500/1.two-sum/) containing a manifest.yaml.

Automation Tools: Since writing dozens of edge cases by hand is fun tedious, use these Python scripts:

  1. generate_prompt.py: Creates a prompt for a single problem using its statement and a reference Python solution.
  2. spartan.py: Batch-generates manifests using an LLM via OpenRouter (requires OPENROUTER_API_KEY).
  3. molotov.py: Populates sol.{lang} files based on generated prompts and Python solutions.

Warning: Treat LLM-generated output as if it came from a junior contributor: fast and helpful, but requires a thorough human review.

📈 Current Status

Openleetcode is still in its early stages. While some manifests are highly polished, others may be lacking. The core philosophy remains: the judge and the tests should not be hidden.