Struct to model (dataclass) for python
Project description
Welcome
Struct-Model
Struct-Model is an annotations based wrapper for python's built-in Struct
module.
from struct_model import StructModel, String, uInt4
class Form(StructModel):
username: String(16)
balance: uInt4
print(Form("Adam Bright", 12).pack())
# b'Adam Bright\x00\x00\x00\x00\x00\x00\x00\x00\x0c'
print(Form.unpack(b'Adam Bright\x00\x00\x00\x00\x00\x00\x00\x00\x0c').json())
# {"username": "Adam Bright", "balance": 12}
Installation
Poetry
poetry add struct-model-python
PIP
pip install struct-model-python
Requirements
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
Close
Hashes for struct-model-python-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b6ae00f6f373da4f61a7e22f3e68c94c1caf28237138a676f1883954da9ce42 |
|
MD5 | 655a0a1d6096bf41cd69d8bfae9f5af6 |
|
BLAKE2b-256 | d2a29d3f1ad614b9f9574df47d1c99d6854ad271dc0b82387fa801102723e999 |
Close
Hashes for struct_model_python-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 552eac4a519835a9aa40c4aa8e38a4565b14042ca2c7d23362077b27aafe56c3 |
|
MD5 | 2ecccda1eb7828abce8b3615fe060fe4 |
|
BLAKE2b-256 | b89777411b816342a8e07658234b89395218eed475da0d561af9f582b05cec73 |