Practice Codewars katas entirely on your local machine. Paste a kata link to download its setup and sample tests, then code in your own editor and run. no browser needed.
- Python 3.10+ (uses
str | Nonestyle annotations) requests(only needed forgen.py):pip install -r requirements.txt
pip install -r requirements.txtpython gen.py <kata-url-or-id>Example:
python gen.py https://www.codewars.com/kata/5266876b8f4bf2cf9c000525/train/pythonThis creates:
problems/<kata-slug>/
├── solution.py # starter code - write your solution here
└── tests.py # sample tests, runnable locally
The kata id is extracted from any link (or plain id). A language other than Python can be requested with .../train/<lang> in the link.
python run.py # run all katas
python run.py <name-substring> # run only matching katas
# Add "-w" to re-run on every save
# Add "-d" to set the debounce re-runA kata folder just needs two files:
problems/my-kata-name/
├── solution.py
└── tests.py
# tests.py
import codewars_test as test
from solution import solution
@test.describe("Fixed Tests")
def basic_tests():
@test.it("basic cases")
def basic_cases():
test.assert_equals(solution('world'), 'dlrow')