Renity Pure Python Protocol Buffer
Project description
Renity Protocol Buffer
Renity is an Open Source Python Object-Binary-Mapper(OBM) Binary Protocol Buffer that provides a way to rapidly define the de/serialization format of packets.
Installation 🔧
You can install Renity via pip from PyPI:
$ pip install renity
✨ Features
- Improved throughput & reduced latency by reducing the data size transferred over the network
- Serialization & Deserialization
- Efficiency Compared to other formats like JSON & XML
- Strict schema definition(s) for messages
- Backward Compatible Schema(s)
- Development effort is reduced with an easy-to-use interface that creates a Serialization Format from an Object Model.
Example 📏
import requests
from rentity import Message, StringField, IntField
# Define Message Schema
>>> class CustomMessage(Message):
... hello=StringField(default="World")
... sentence=ListField(StringField(required=True),IntField())
...
# Create a message
>>> example = CustomMessage({"sentence": ["Number of Apples:", 2]})
# Deserialized Message
>>> example.message
{"type": "CustomMessage", "hello": "World", "sentence": ["Number of Apples:", 2]}
# Serialized Message
>>> example.bytes
b"\x97\x88\rCustomMessage\x03\x92\x88\x05World\x8a\x88\x16\x92\x88\x11Number of Apples:\x88\x02"
# Post Serialized Message
>>> requests.post(url='http://example.com/message',
... data=example.bytes,
... headers={'Content-Type': 'application/octet-stream'})
...
# GET Example
>>> res = requests.get('http://example.com/message')
>>> response = CustomMessage(res.content)
>>> response.message
{"type": "CustomMessage", "hello": "World", "sentence": ["Number of Apples:", 2]}
🔬 Tests
It is recommended to set up Python 3.8, 3.9, 3.10 using pyenv.
# Install Poetry
$ pip install poetry
# Install Nox
$ pip install nox
# Install nox-poetry
$ pip install nox-poetry
# Install dependencies
$ poetry install
# Run Nox tests sessions
$ nox --session
Contributing 🧠
We welcome contributions of all types: from fixing typos to bug fixes to new features. For further questions about any of the below, please refer to the Contributor Guide. Reach out! We encourage all contributors to reach out for work reference's. We're here to help and are available for any inquiries regarding our contributors!
🎓 Interactive Practice
Keep practicing so that your coding skills don't get rusty.
Usage
Please see the Command-line Reference for details.
License
Distributed under the terms of the Apache license, Renity is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Credits
Project details
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 renity-2.1.0.tar.gz
.
File metadata
- Download URL: renity-2.1.0.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75bf0a557ed1789f1d0dd1856b5a323f64229c6c186ee607ad76a6adc5de22d4 |
|
MD5 | b3fcad35ef3405f9c4b4956c005de977 |
|
BLAKE2b-256 | 284d71fc463fc627d817556ac2b6f32269a3cfbfe63db40b50128dfd4536db6a |
File details
Details for the file renity-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: renity-2.1.0-py3-none-any.whl
- Upload date:
- Size: 28.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26981627b5c361e68003ef12257b89a48f8a54f9d2e80731caac9fb7a45352f0 |
|
MD5 | 951d071119fdafff51b2ab6e0e7e2958 |
|
BLAKE2b-256 | 913c4b0b85a1e02331fc0061c3d9e0cd0d0f581e85924ea1e0e5786afe6e2975 |