Welcome to Kvlang’s documentation!

Kvlang is a Python library for easier manipulation of Kv language.

Install Kvlang

pip install kvlang

Quick start

The most important function is parse() which provides most of the core functionality. Simply pass your Kv string into it or load a .kv file’s contents.

from kvlang import parse

print(parse("#:kivy 2.3.1"))
# Tree(Token('RULE', 'start'), [Tree(Token('RULE', 'special'), [...])])

print(parse("#:kivy 2.3.1").pretty())
# start
#   special
#     special_directive
#       kivy_version
#         version
#           2
#           3
#           1

Indices and tables