No project description provided
Project description
GravitasML
GravitasML is a lightweight Python library for parsing custom markup languages. It provides a simple and intuitive API to convert markup into Python objects or dictionaries.
Features
- Easy-to-use parser for custom markup languages.
- Convert markup directly to Python dictionaries.
- Handles nested and multiple root tags.
- Customizable tag names with automatic whitespace conversion.
- Syntax error detection for unmatched or improperly nested tags.
Installation
To install GravitasML, use pip as follows:
pip install gravitasml
Quick Start
Here's a quick example to get you started:
from gravitasml.token import tokenize
from gravitasml.parser import Parser
markup = "<tag1><tag2>content</tag2></tag1>"
tokens = tokenize(markup)
parser = Parser(tokens)
obj = parser.parse()
print(obj) # Output: {'tag1': {'tag2': 'content'}}
Limitations
GravitasML is designed to be simple and intuitive, but there are some limitations to be aware of:
- It does not support XML namespaces or schema validation.
- It does not handle processing instructions or CDATA sections found in XML.
- Currently, there is no support for attributes within tags; only tag names and content are parsed.
- It does not provide functionality to write or generate markup, only to parse it.
- GravitasML is not optimized for extremely large documents or streaming parsing.
Documentation
For detailed usage and documentation, please refer to the docs
directory in this repository.
Tests
GravitasML comes with a comprehensive test suite. To run the tests, execute the following command:
python -m unittest discover -v
Contributing
We welcome contributions from the community. If you'd like to contribute, please fork the repository and submit a pull request.
License
GravitasML is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gravitasml-0.1.0.tar.gz
.
File metadata
- Download URL: gravitasml-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e449ca8d51a700424fd5b943465d8b1a59b3e0f83a636c6d42444b07fded52a |
|
MD5 | c28875d8cde783373afe22994dd1d239 |
|
BLAKE2b-256 | 241d00fc6faa540ff86f09593f3df83aa003cae079e77cf781afa83cab55a564 |
File details
Details for the file gravitasml-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: gravitasml-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa99b9588fa0bcf20f045ee2b32b5c99fc44ffdbfebc46ede30c342dec40c5df |
|
MD5 | 65b15d36dbf12e677fee41891f38b725 |
|
BLAKE2b-256 | 1c96244e97c8f428e00be6349e57451a3a0a80d22bd0ad3dd3745798ef764a45 |