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
File details
Details for the file struct_model_python-0.2.0.tar.gz
.
File metadata
- Download URL: struct_model_python-0.2.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.9 Linux/6.2.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 078db5ffc4409a643fef70204c784f101399aac5e1de377dbf99da9ea7f45fc6 |
|
MD5 | 6e735c91ad4ec41f73143c3ce4f9ea6c |
|
BLAKE2b-256 | 0a80c9160f3b2ab828f9dbc74e19688264dd6fa9e46ef40b657eefdee397d616 |
File details
Details for the file struct_model_python-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: struct_model_python-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.9 Linux/6.2.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9e106c8045d519af389420d4a6eae5c61408047373a08e52932f4e766ed85f6 |
|
MD5 | f424e3fccaa5d5af2087213a8f3121d8 |
|
BLAKE2b-256 | 0bbf92dddae3a3d258dbf6316f7440b13c0165389b46af52d0ee008662f07f2c |