Skip to main content
lcpy is the published CLI (leetcode-py-sdk on PyPI). It is designed to run inside your repos, not just this one: install it, point it at an empty directory, and it generates a complete practice environment there. This repository is itself just one practice environment kept in sync by the same generator.

lcpy gen

Generate problem directories from the JSON templates bundled with the package.
What lands on disk is documented in Problem Anatomy.

lcpy list

List available problems in a formatted table (307 problems ship with the package).

lcpy scrape

Fetch problem data from LeetCode and print it as JSON. This is the first step of adding a new problem to the catalog; see Problem Creation.

Errors and exit codes

Exit code 0 on success, 1 on error. Common failures:
  • Problem number or slug not in the catalog: check lcpy list first
  • Unknown tag: use one of the six collection tags above
  • Output files already exist: add --force to overwrite
  • Network errors during scrape: retry, or check the slug on leetcode.com

Machine-readable docs

The docs site serves machine-readable endpoints alongside the HTML pages. lcpy --help advertises these in its afterword: