# Protolizer Documentation
## Introduction
Protolizer is a simple library to serialize and deserialize protobuf messages
## Installation
```bash
pip install protolizer
```
## Usage for serialization
```python
from protolizer import Serializer, fields
class AccountSerializer(Serializer):
username = fields.CharField()
balance = fields.IntField()
class Meta:
# Here we define our generated protobuf message name
# our protobuf message is something like:
# message Account {
# string username = 1;
# int32 balance = 2;
# }
schema = Account
# Define an account in JSON and Protobuf format
protobuf_data = Account(username='John', balance=100)
json_data = {'username': 'John', 'balance': 100}
# Serialize the data to Protobuf format
protobuf_serializer = AccountSerializer(protobuf_data)
print(protobuf_serializer.protobuf)
# Serialize the data to JSON format
json_serializer = AccountSerializer(json_data)
print(json_serializer.json)
# Deserialize the data from Protobuf format to JSON format
protobuf_deserializer = AccountSerializer(protobuf_serializer.protobuf)
print(protobuf_deserializer.data)
# Deserialize the data from JSON format to Protobuf format
json_deserializer = AccountSerializer(json_serializer.json)
print(json_deserializer.data)
```
## Contribute
```text
If you want to contribute to this project, please open an issue on GitHub.
```
## License
```text
This project is licensed under the MIT License.
```
## Author
This project is authored by [@uwsgi](https://instagram.com/uwsgi)
Raw data
{
"_id": null,
"home_page": "https://github.com/its0x4d/protolizer",
"name": "protolizer",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "protobuf serialization deserialization",
"author": "MosyDev",
"author_email": "mostafa.uwsgi@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0d/77/a0ba9b523a92cb1fa0fc18ac6eacca724491e820c000de0491027a8b3621/protolizer-1.1.1.tar.gz",
"platform": null,
"description": "# Protolizer Documentation\n\n## Introduction\nProtolizer is a simple library to serialize and deserialize protobuf messages\n\n## Installation\n\n```bash\npip install protolizer\n```\n\n## Usage for serialization\n\n```python\nfrom protolizer import Serializer, fields\n\nclass AccountSerializer(Serializer):\n username = fields.CharField()\n balance = fields.IntField()\n\n class Meta:\n # Here we define our generated protobuf message name\n # our protobuf message is something like:\n # message Account {\n # string username = 1;\n # int32 balance = 2;\n # }\n schema = Account\n\n# Define an account in JSON and Protobuf format\nprotobuf_data = Account(username='John', balance=100)\njson_data = {'username': 'John', 'balance': 100}\n\n# Serialize the data to Protobuf format\nprotobuf_serializer = AccountSerializer(protobuf_data)\nprint(protobuf_serializer.protobuf)\n\n# Serialize the data to JSON format\njson_serializer = AccountSerializer(json_data)\nprint(json_serializer.json)\n\n# Deserialize the data from Protobuf format to JSON format\nprotobuf_deserializer = AccountSerializer(protobuf_serializer.protobuf)\nprint(protobuf_deserializer.data)\n\n# Deserialize the data from JSON format to Protobuf format\njson_deserializer = AccountSerializer(json_serializer.json)\nprint(json_deserializer.data)\n```\n\n## Contribute\n\n```text\nIf you want to contribute to this project, please open an issue on GitHub.\n```\n\n## License\n\n```text\nThis project is licensed under the MIT License.\n```\n\n## Author\nThis project is authored by [@uwsgi](https://instagram.com/uwsgi)\n\n\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple library to serialize and deserialize protobuf messages",
"version": "1.1.1",
"split_keywords": [
"protobuf",
"serialization",
"deserialization"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0d77a0ba9b523a92cb1fa0fc18ac6eacca724491e820c000de0491027a8b3621",
"md5": "20d4e8906b486e7fe95e06b438c5d2b1",
"sha256": "ff5d170324fcebacf94f5f43c8466b0d9c2e34eeb4d600d6565115ac02b5755d"
},
"downloads": -1,
"filename": "protolizer-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "20d4e8906b486e7fe95e06b438c5d2b1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12481,
"upload_time": "2023-04-16T09:48:03",
"upload_time_iso_8601": "2023-04-16T09:48:03.816813Z",
"url": "https://files.pythonhosted.org/packages/0d/77/a0ba9b523a92cb1fa0fc18ac6eacca724491e820c000de0491027a8b3621/protolizer-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-16 09:48:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "its0x4d",
"github_project": "protolizer",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "protolizer"
}