Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py-codewars

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.

Requirements

  • Python 3.10+ (uses str | None style annotations)
  • requests (only needed for gen.py): pip install -r requirements.txt

Setup

pip install -r requirements.txt

Usage

1. Download a kata

python gen.py <kata-url-or-id>

Example:

python gen.py https://www.codewars.com/kata/5266876b8f4bf2cf9c000525/train/python

This 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.

2. Run your solution

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-run

Creating a kata manually

A 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')

About

PyKata is a command-line tool that lets you pull Codewars challenges straight to your computer so you can solve them in your own IDE

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages