https://github.com/keyweeusr/kvlang
Grammar and parser for Kv
https://github.com/keyweeusr/kvlang
Last synced: 4 months ago
JSON representation
Grammar and parser for Kv
- Host: GitHub
- URL: https://github.com/keyweeusr/kvlang
- Owner: KeyWeeUsr
- License: mit
- Created: 2025-04-30T21:40:07.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-25T22:32:13.000Z (about 1 year ago)
- Last Synced: 2025-12-06T01:43:39.703Z (7 months ago)
- Language: Python
- Size: 128 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
README
# kvlang
[![CI][ci-badge]][ci-workflow]
[![Coverage][coverage-badge]][coveralls]
[![GitHub version][gh-version-badge]][gh-version]
[![PyPI version][pypi-version-badge]][pypi-version]
[![PyPI - Python Version][pypi-py-version-badge]][pypi-py-version]
[![Latest release deps][pypi-release-badge]][pypi-release]
[![GitHub repo deps][gh-deps-badge]][gh-deps]
[![Downloads total][pepy-total]][pepy]
[![Downloads month][pepy-month]][pepy]
[![Downloads week][pepy-week]][pepy]
[![All Releases][gh-release-badge]][gh-release]
[![Code bytes][code-size]][gh]
[![Repo size][repo-size]][gh]
Grammar and parser for [Kv][kv] ([wiki][wiki]) as a more reliable approach for
reading the `.kv` files.
Install from PyPI:
```
pip install kvlang
```
or from the repo:
```
git clone https://github.com/KeyWeeUsr/kvlang
pip install -e .
# or
pip install git+https://github.com/KeyWeeUsr/kvlang.git
# or
pip install https://github.com/KeyWeeUsr/kvlang/zipball/master
# or
pip install https://github.com/KeyWeeUsr/kvlang/zipball/1.0.1
```
then
```python
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
```
[kv]: https://kivy.org/doc/stable/guide/lang.html
[wiki]: https://en.wikipedia.org/wiki/Kivy_(framework)#Kv_language
[gh-version-badge]: https://badge.fury.io/gh/keyweeusr%2Fkvlang.svg
[gh-version]: https://badge.fury.io/gh/keyweeusr%2Fkvlang
[pypi-version-badge]: https://img.shields.io/pypi/v/kvlang.svg
[pypi-version]: https://pypi.org/project/kvlang/
[pypi-py-version-badge]: https://img.shields.io/pypi/pyversions/kvlang.svg
[pypi-py-version]: https://pypi.org/project/kvlang/
[pypi-release-badge]: https://img.shields.io/librariesio/release/pypi/kvlang.svg
[pypi-release]: https://libraries.io/pypi/kvlang
[gh-deps-badge]: https://img.shields.io/librariesio/github/keyweeusr/kvlang.svg
[gh-deps]: https://libraries.io/pypi/kvlang
[pepy-total]: https://pepy.tech/badge/kvlang
[pepy-month]: https://pepy.tech/badge/kvlang/month
[pepy-week]: https://pepy.tech/badge/kvlang/week
[pepy]: https://pepy.tech/project/kvlang
[gh-release-badge]: https://img.shields.io/github/downloads/keyweeusr/kvlang/total.svg
[gh-release]: https://github.com/KeyWeeUsr/kvlang/releases
[code-size]: https://img.shields.io/github/languages/code-size/keyweeusr/kvlang.svg
[repo-size]: https://img.shields.io/github/repo-size/keyweeusr/kvlang.svg
[gh]: https://github.com/KeyWeeUsr/kvlang
[ci-badge]: https://github.com/KeyWeeUsr/kvlang/actions/workflows/test.yml/badge.svg
[ci-workflow]: https://github.com/KeyWeeUsr/kvlang/actions/workflows/test.yml
[coverage-badge]: https://coveralls.io/repos/KeyWeeUsr/kvlang/badge.svg?branch=master
[coveralls]: https://coveralls.io/r/KeyWeeUsr/kvlang?branch=master