One-time setup
loguru, which the suites use to log every case.
pytest is not a package dependency, so install it in the same
environment. Or use uv: uv tool install leetcode-py-sdk plus
uv pip install pytest in your active venv.
Generate a problem, see red
solution.py
arrives as a TODO stub:
Implement, go green
Replace the TODO insolution.py with your approach:
Iterate on one case at a time
Mid-debug, you want one case, not eighteen. pytest flags that earn their keep on these suites:-s, each case logs its inputs and verdict:
A whole practice tree works the same
Generate a collection and plainpytest discovers every suite under
the current directory:
Where to go next
- Anatomy of a test suite: how the parametrized cases, helpers, and logging fit together, and how one suite covers multiple solution classes
- Problem anatomy: what each of the six generated files is for
- lcpy CLI reference: every
genandlistoption