Gura Python parser
This repository contains the implementation of a Gura (compliant with version 1.0.0) format parser in Python.
Installation
pip install gura-parser
Usage
import gura
gura_string = """
# This is a Gura document.
title: "Gura Example"
an_object:
username: "Stephen"
pass: "Hawking"
# Line breaks are OK when inside arrays
hosts: [
"alpha",
"omega"
]
"""
# Loads: transforms a Gura string into a dictionary
parsed_gura = gura.loads(gura_string)
print(parsed_gura) # {'title': 'Gura Example', 'an_object': {'username': 'Stephen', 'pass': 'Hawking'}, 'hosts': ['alpha', 'omega']}
# Access a specific field
print(f"Title -> {parsed_gura['title']}")
# Iterate over structure
for host in parsed_gura['hosts']:
print(f'Host -> {host}')
# Dumps: transforms a dictionary into a Gura string
print(gura.dumps(parsed_gura))
Contributing
All kind of contribution is welcome! If you want to contribute just:
- Fork this repository.
- Create a new branch and introduce there your new changes.
- Make a Pull Request!
Or you can join to our community in Discord!
Tests
To run all the tests: python -m unittest. More info in official Unittest docs
Building
- Create a virtual environment:
python3 -m venv venv - Activate it:
source venv/bin/activate - Install some dependencies:
pip install -r requirements.txt - Clean and build
rm -rf ./dist/* && python3 setup.py sdist
License
This repository is distributed under the terms of the MIT license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gura-1.4.4.tar.gz
(12.9 kB
view details)
File details
Details for the file gura-1.4.4.tar.gz.
File metadata
- Download URL: gura-1.4.4.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6c2fda66328bc66a8649bff773748abab6d16f6ce2a94ff9dc04970c7cb0ad7
|
|
| MD5 |
0f95d13e150614aa550b909ab0189a07
|
|
| BLAKE2b-256 |
a55c2b581e90c06d5b7a531eb7166722aba17559ba06071cd415aec554a789ee
|