<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Piston Execution Backend on RockB</title><link>https://baeseokjae.github.io/tags/piston-execution-backend/</link><description>Recent content in Piston Execution Backend on RockB</description><image><title>RockB</title><url>https://baeseokjae.github.io/images/og-default.png</url><link>https://baeseokjae.github.io/images/og-default.png</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 01 Oct 2026 02:59:00 +0000</lastBuildDate><atom:link href="https://baeseokjae.github.io/tags/piston-execution-backend/index.xml" rel="self" type="application/rss+xml"/><item><title>Openleetcode Review: A Local LeetCode Runner With the Tests in the Repo</title><link>https://baeseokjae.github.io/posts/openleetcode-local-leetcode-runner/</link><pubDate>Thu, 01 Oct 2026 02:59:00 +0000</pubDate><guid>https://baeseokjae.github.io/posts/openleetcode-local-leetcode-runner/</guid><description>Openleetcode is a free local LeetCode runner that ships 1,410 open test manifests in its repo, so you judge solutions offline with no account or API.</description><content:encoded><![CDATA[<p>Openleetcode is a free, open-source runner for LeetCode problems that executes your solution on your own machine. Its distinguishing feature is that the judge inputs live in the repository: 1,410 problem manifests with their expected outputs are published as a versioned, forkable artifact, so nothing is submitted to LeetCode and no account is required.</p>
<h2 id="what-is-openleetcode-and-how-does-it-differ-from-other-leetcode-clis">What Is Openleetcode and How Does It Differ From Other LeetCode CLIs?</h2>
<p>Openleetcode is a command-line tool written in Haskell that takes a solution file, matches it to a problem manifest, runs it through a small language-specific harness, and grades the result against test cases that ship with the tool. The author&rsquo;s own framing is that the <a href="https://github.com/therepanic/openleetcode">CLI is &ldquo;just the glue&rdquo;</a> — the interesting artifact is the test corpus underneath it.</p>
<p>That framing is the whole product thesis. LeetCode&rsquo;s judge is closed. You submit, you get a verdict, and if you fail on input #47 you generally are not shown input #47. Every mainstream LeetCode CLI inherits that black box, because every mainstream LeetCode CLI is really an authenticated HTTP client for the same judge:</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th>Openleetcode</th>
          <th>leetcode-cli</th>
          <th>leetcode.nvim</th>
          <th>leetgo</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Judge location</td>
          <td>Local (Piston in Docker)</td>
          <td>LeetCode&rsquo;s server</td>
          <td>LeetCode&rsquo;s server</td>
          <td>Local, plus optional submit</td>
      </tr>
      <tr>
          <td>Test cases public</td>
          <td>Yes, 1,410 manifests in-repo</td>
          <td>No</td>
          <td>No</td>
          <td>No (built from statement examples)</td>
      </tr>
      <tr>
          <td>Requires an account</td>
          <td>No</td>
          <td>Yes</td>
          <td>Yes</td>
          <td>Only to submit</td>
      </tr>
      <tr>
          <td>Requires network to grade</td>
          <td>No</td>
          <td>Yes</td>
          <td>Yes</td>
          <td>No</td>
      </tr>
      <tr>
          <td>Primary language</td>
          <td>Haskell (Cabal)</td>
          <td>JavaScript</td>
          <td>Lua</td>
          <td>Go</td>
      </tr>
      <tr>
          <td>Approx. stars</td>
          <td>170</td>
          <td>3,873</td>
          <td>2,204</td>
          <td>707</td>
      </tr>
      <tr>
          <td>License</td>
          <td>Unlicense</td>
          <td>MIT</td>
          <td>MIT</td>
          <td>MIT</td>
      </tr>
  </tbody>
</table>
<p>As checked on 2026-10-01, therepanic/openleetcode shows 170 stars, 6 forks and 11 open issues, was created on GitHub on 2026-01-12, last pushed 2026-09-04, and cut release v1.0.4 on 2026-08-17. It is a young, single-maintainer project — not a 4,000-star incumbent — and it should be evaluated that way.</p>
<h2 id="why-does-it-matter-that-the-test-cases-live-in-the-repo">Why Does It Matter That the Test Cases Live in the Repo?</h2>
<p>Because closed test suites are the single most frustrating property of online judges, and openleetcode is one of the very few tools that removes it.</p>
<p>The author says it directly: closed platforms never publish their test cases, and he explicitly rejected the &ldquo;submit through the LeetCode API&rdquo; approach that other tools take. That rejection has mechanical consequences. When you fail locally with openleetcode, you can open <code>tests/{problem}/manifest.yaml</code>, read the failing input, and add a print statement. When you fail with leetcode-cli, you get the same verdict LeetCode would have given you in the browser, minus the browser.</p>
<p>The second benefit is offline grading. Once Piston has installed the runtimes, judging happens on <code>localhost</code> — no network, no login token, no rate limits, no risk of a stray submission landing on your public profile. That matters for interview preparation on a plane, in a locked-down corporate network, or simply when you want to iterate fifty times in ten minutes without worrying about being throttled.</p>
<p>The third benefit is that the corpus is an artifact you can own. Fork it, add your own edge cases to a manifest, keep a private branch for the problems you actually study. No other tool in this niche gives you that, because no other tool has the tests to give.</p>
<h2 id="how-many-leetcode-problems-are-actually-covered">How Many LeetCode Problems Are Actually Covered?</h2>
<p>Openleetcode ships <strong>1,410 manifests</strong>. LeetCode hosts <strong>4,069 problems</strong> in total as of 2026-10-01 per its own problems API — 3,284 free and 785 paid-only, split across 968 easy, 2,122 medium and 979 hard.</p>
<p>That puts coverage at roughly <strong>34.6% of the entire problem set</strong> and about <strong>43% of the free-tier set</strong>. The repository badge reads &ldquo;1.4k&rdquo;, which matches the count of <code>manifest.yaml</code> files under <code>tests/</code> (the <code>tests/</code> tree holds 19,703 files in total, so the manifests are a small fraction of a much larger data directory).</p>
<p>What that means in practice:</p>
<ul>
<li>The famous problems are well covered. If you are grinding a curated list, a large share of it is likely present.</li>
<li>Premium problems are explicitly out of scope. If you pay for LeetCode Premium, a good chunk of your paid content cannot be run here.</li>
<li>Some categories are absent entirely. There is no support yet for Concurrency, Shell, SQL, Database, Design, or In-Place problems. Those are structural gaps, not a coverage shortfall — the manifest format does not model them today.</li>
</ul>
<p>The honest framing is that this is a strong coverage number for a project nine months old and a weak one if you expect a drop-in replacement for the site.</p>
<h2 id="how-do-you-install-openleetcode">How Do You Install Openleetcode?</h2>
<p>Docker is a hard prerequisite on Linux and macOS, and this is the part that surprises people.</p>
<p>The flow is:</p>
<ol>
<li>Clone the repository.</li>
<li>Start the execution backend with Docker Compose (<code>engineer-man/piston</code> listening at <code>http://localhost:2000</code>).</li>
<li>Wait. The first backend start installs every supported language runtime, and it is slow.</li>
<li>Build the Haskell CLI with Cabal.</li>
<li>Run a problem and watch it grade locally.</li>
</ol>
<p>The Piston dependency is worth understanding rather than treating as an implementation detail. Piston is the sandboxed execution engine — the same class of tool as <a href="https://github.com/judge0/judge0">judge0</a> — and it exists precisely because running arbitrary submitted code unsandboxed is a bad idea. By defaulting to Piston over Docker, openleetcode inherits a mature sandbox instead of writing its own. That is the right engineering call, and it is also why &ldquo;just run it locally&rdquo; is not as trivial as it sounds: you are standing up a containerised judge.</p>
<p>Twelve language runtimes are supported: C++, Rust, Python 3, Python 2, Ruby, Java, C#, Kotlin, Go, Dart, Swift and TypeScript. The runtime templates deliberately mirror the official LeetCode environments so the harness you test against behaves like the one you would eventually submit to. Python 2 is a historical curiosity at this point, but its presence signals that the templates were copied from the platform&rsquo;s actual judge configuration rather than invented.</p>
<h2 id="how-does-a-local-submission-actually-work">How Does a Local Submission Actually Work?</h2>
<p>The pipeline is a chain of small, inspectable steps:</p>
<p><strong>Solution file → matching manifest → language harness → execution backend → local judge.</strong></p>
<p>You keep your solution in a file that corresponds to a problem, openleetcode finds the manifest for that problem, generates or selects a thin harness for the language you chose, ships the code to Piston for execution, and compares the output to the expected results according to the manifest&rsquo;s rules. The Haskell CLI orchestrates; it does not contain the interesting logic.</p>
<p>This structure is why contributing to the corpus is unusually accessible. You do not need to read Haskell to add a test case — you need to write YAML. That split is intentional: the toolchain burden falls only on people changing the CLI itself, while the much larger surface area (1,410 manifests and growing) is open to anyone who understands a problem statement.</p>
<p>Test generation is likewise scriptable. Manifests support stress-test generation through a small DSL, so combinatorial and randomised testing is expressed as configuration rather than as bespoke code per problem.</p>
<h2 id="what-does-a-test-manifest-look-like">What Does a Test Manifest Look Like?</h2>
<p><code>TEST_FORMAT.md</code> is the contract, and it is the document to read first. A manifest is a YAML file with these fields:</p>
<ul>
<li><strong><code>entry</code></strong> — how to call the solution, with per-language variants (a <code>params</code> form, or a <code>call</code> form for languages that need a different invocation).</li>
<li><strong><code>judge</code></strong> — the comparison strategy. <code>exact</code> demands byte-identical output; <code>ignore_order</code> accepts any ordering, which is what you want for problems whose answer is a set or a permutation.</li>
<li><strong><code>limits</code></strong> — <code>time_ms</code> and <code>memory_mb</code>, so each problem is judged against a declared budget rather than one global timeout.</li>
<li><strong><code>oracle</code></strong> — an optional Python 3 checker for problems where correctness cannot be expressed as a simple string comparison, such as &ldquo;any valid answer&rdquo; problems.</li>
<li><strong><code>seed</code></strong> — the random seed for generated cases, which is what makes a random test reproducible.</li>
<li><strong><code>tests</code></strong> — the cases themselves, either hand-written or generated.</li>
</ul>
<p>Two design choices stand out. First, per-language <code>entry</code> definitions mean one manifest serves all twelve runtimes, so adding a language does not mean duplicating 1,410 files. Second, the judge is an enum plus an escape hatch: <code>exact</code> and <code>ignore_order</code> cover the common cases, and the oracle covers the rest. That is a pragmatic format rather than an over-engineered one.</p>
<p>The <code>limits</code> field is the subtle one. Because each manifest declares its own time and memory budget, a local run can approximate the platform&rsquo;s constraints — which is more than most local test setups do, and closer to what you actually need when a solution times out on LeetCode but passes your unit tests.</p>
<h2 id="can-you-contribute-without-writing-any-haskell">Can You Contribute Without Writing Any Haskell?</h2>
<p>Yes, and the project has built dedicated scaffolding for exactly that.</p>
<p>Three scripts carry most of the non-code contribution work:</p>
<ul>
<li><strong><code>generate_prompt.py</code></strong> — produces the prompt used to draft a manifest for a problem.</li>
<li><strong><code>spartan.py</code></strong> — sends that prompt to an OpenRouter model and writes the drafted manifest into <code>generated_problems/</code>.</li>
<li><strong><code>molotov.py</code></strong> — fills in <code>sol.{lang}</code> solution stubs for those generated problems.</li>
</ul>
<p>The author&rsquo;s own guidance about the model&rsquo;s output is refreshingly blunt: treat it &ldquo;like a junior contributor with infinite patience.&rdquo; In other words, the LLM drafts, and a human reviews. The project states that generated manifests are very much in need of review, which means corpus quality is uneven by design — a deliberate trade of polish for throughput on a dataset that is otherwise too large to hand-write.</p>
<p>For anyone who has wanted to contribute to an open-source judge and bounced off the toolchain, this is the lowest-friction entry point in the project. You need a text editor and the ability to verify a problem statement, not a Cabal installation.</p>
<h2 id="what-are-the-real-caveats">What Are the Real Caveats?</h2>
<p><strong>Uneven manifest quality.</strong> The LLM-assisted pipeline above is the direct cause. Expect generated manifests to be correct on the happy path and thin on edge cases until someone reviews them. Cross-checking a manifest against the problem statement before trusting a verdict is reasonable diligence, not paranoia.</p>
<p><strong>Sync risk.</strong> Problem statements on LeetCode rarely change, but edge cases do get patched. A manifest written in January may not reflect a hidden test added in September. The maintenance burden of a 1,410-problem corpus is real and ongoing, and the project&rsquo;s own stress-test DSL is partly a hedge against exactly this problem.</p>
<p><strong>Missing categories.</strong> Concurrency, Shell, SQL, Database, Design and In-Place problems are not supported today. If your study plan leans on those, this tool will not cover it.</p>
<p><strong>Setup cost.</strong> Docker, Piston, a slow first start, and a Haskell toolchain if you want to build the CLI yourself. That is a heavier install than <code>npm install -g leetcode-cli</code>, and the payoff is offline grading against public tests.</p>
<p><strong>Traction.</strong> The Show HN launch on 2026-08-18 reached 73 points and 19 comments. Modest, but real — and the project was posted to Hacker News seven separate times between 2026-06-30 and 2026-08-18, which says something about the author&rsquo;s persistence as much as the audience&rsquo;s appetite. With 170 stars and 11 open issues, this is early-stage software. The 3,873-star leetcode-cli and the 2,204-star leetcode.nvim are more mature; the 707-star leetgo is more actively maintained, with a last push of 2026-09-24.</p>
<h2 id="verdict-who-should-actually-use-openleetcode">Verdict: Who Should Actually Use Openleetcode?</h2>
<p>Openleetcode is the right tool for a specific person: someone who prepares for interviews offline, wants to see the input that made their solution fail, and is willing to spend twenty minutes on Docker before the first problem runs.</p>
<p>It is the wrong tool if you want a one-command install, if you rely on Premium or SQL/Design problems, or if you need submission handled for you. For those cases, a mature API-driven client is the better answer — and the mature client&rsquo;s core advantage is simply that it has years of polish behind it.</p>
<p>The most useful way to think about openleetcode is as an open test corpus with a CLI attached. If that framing appeals to you, the 1,410 manifests are worth the setup. If it does not, no amount of CLI polish will make the Docker dependency worth it — and it is fair to say so plainly, because the install cost is the honest price of open tests.</p>
<h2 id="faq">FAQ</h2>
<p><strong>Does Openleetcode submit solutions to LeetCode?</strong></p>
<p>No. It grades everything locally against test manifests that ship in the repository. There is no API submission path, no authentication and no network call to LeetCode&rsquo;s judge. The author explicitly rejected the submit-via-API approach that other tools use.</p>
<p><strong>Do I need a LeetCode account to use it?</strong></p>
<p>No. Because grading happens locally through Piston, no account, session cookie or login token is involved. That also means your attempts never appear on a public profile.</p>
<p><strong>How many problems does Openleetcode cover?</strong></p>
<p>1,410 problems are covered by <code>manifest.yaml</code> files as of 2026-10-01, against 4,069 total LeetCode problems — about 34.6% of everything and roughly 43% of the free-tier set. Premium-only problems and the Concurrency, Shell, SQL, Design and In-Place categories are not supported yet.</p>
<p><strong>Is it safe to run untrusted code with Openleetcode?</strong></p>
<p>Yes, by inheritance rather than by invention. The default backend is Piston, a sandboxed execution engine that itself runs inside Docker on <code>localhost:2000</code>. The sandboxing is Piston&rsquo;s, not homegrown, and that is a point in the project&rsquo;s favour.</p>
<p><strong>Do I need to know Haskell to contribute test cases?</strong></p>
<p>No. Adding a problem means writing YAML against the manifest format documented in <code>TEST_FORMAT.md</code>, and the project ships <code>spartan.py</code> to draft manifests from prompts plus <code>molotov.py</code> to scaffold solution files. Haskell is only required if you want to modify the CLI itself.</p>
<p><strong>How does it compare to leetgo?</strong></p>
<p>Leetgo has more stars (707 vs 170), is written in Go, and is the most actively maintained tool in the group, with a last commit on 2026-09-24. Its local testing, however, is built from the example cases shown in the problem statement, not from a maintained open corpus. Openleetcode gives you a larger, editable, community-reviewed body of tests; leetgo gives you a smoother install and the option to submit.</p>
<p><strong>Why is the first run so slow?</strong></p>
<p>The first start of the Piston backend installs every supported language runtime — all twelve of them — and that install is a one-time cost. Subsequent runs reuse the installed runtimes and grade quickly.</p>
]]></content:encoded></item></channel></rss>