Skip to main content
There are two ways to use leetcode-py, depending on your goal:
  • Practice problems: install the lcpy CLI from PyPI and generate a practice environment in any directory or repo. Cloning this repository is not required; see the lcpy CLI reference.
  • Develop in this repository: clone it to extend the collection, tweak templates, or run the full test suite.

Requirements

  • Python 3.10+ (3.10 through 3.14 supported)
  • Graphviz: needed for data structure visualizations. Install it before running the project (install guide)

Install the CLI

The package is published on PyPI as leetcode-py-sdk:
Or with uv:
Verify the installation:
You should see the gen, list, and scrape commands. Head to the Quickstart to generate your first problem.

Development setup

To work within the repository itself (adding problems, changing templates, or hacking on the generator) you additionally need:
  • uv: fast Python package manager
  • bakefile: the task runner that wraps the common workflows
  • Git
Confirm everything works by running the full test suite:
Problems in leetcode/ are generated from JSON templates. Never edit them by hand; see Problem Creation for the source-of-truth workflow.

Next steps