struct-model-python


Namestruct-model-python JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://adambrianbright.github.io/struct-model-python/
SummaryStruct to model (dataclass) for python
upload_time2023-10-22 02:50:04
maintainer
docs_urlNone
authorBogdan Parfenov
requires_python>=3.10
licenseMIT
keywords struct scheme pack model byte
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # Welcome

## Struct-Model

Struct-Model is an annotations based wrapper for python's built-in `Struct` module.

```python example.py
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

```shell
poetry add struct-model-python
```

### PIP

```shell
pip install struct-model-python
```

## Requirements

+ [`ujson >= 4.1.0`](https://github.com/ultrajson/ultrajson)
            

Raw data

            {
    "_id": null,
    "home_page": "https://adambrianbright.github.io/struct-model-python/",
    "name": "struct-model-python",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "struct,scheme,pack,model,byte",
    "author": "Bogdan Parfenov",
    "author_email": "adam.brian.bright@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0a/80/c9160f3b2ab828f9dbc74e19688264dd6fa9e46ef40b657eefdee397d616/struct_model_python-0.2.0.tar.gz",
    "platform": null,
    "description": "# Welcome\n\n## Struct-Model\n\nStruct-Model is an annotations based wrapper for python's built-in `Struct` module.\n\n```python example.py\nfrom struct_model import StructModel, String, uInt4\n\nclass Form(StructModel):\n    username: String(16)\n    balance: uInt4\n    \nprint(Form(\"Adam Bright\", 12).pack())\n# b'Adam Bright\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x0c'\nprint(Form.unpack(b'Adam Bright\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x0c').json())\n# {\"username\": \"Adam Bright\", \"balance\": 12}\n```\n\n## Installation\n\n### Poetry\n\n```shell\npoetry add struct-model-python\n```\n\n### PIP\n\n```shell\npip install struct-model-python\n```\n\n## Requirements\n\n+ [`ujson >= 4.1.0`](https://github.com/ultrajson/ultrajson)",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Struct to model (dataclass) for python",
    "version": "0.2.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/AdamBrianBright/struct-model-python/issues",
        "ChangeLog": "https://adambrianbright.github.io/struct-model-python/changelog",
        "Contact Author": "https://vk.com/adam_bright",
        "Documentation": "https://adambrianbright.github.io/struct-model-python/",
        "Homepage": "https://adambrianbright.github.io/struct-model-python/",
        "Repository": "https://github.com/AdamBrianBright/struct-model-python"
    },
    "split_keywords": [
        "struct",
        "scheme",
        "pack",
        "model",
        "byte"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bbf92dddae3a3d258dbf6316f7440b13c0165389b46af52d0ee008662f07f2c",
                "md5": "f424e3fccaa5d5af2087213a8f3121d8",
                "sha256": "f9e106c8045d519af389420d4a6eae5c61408047373a08e52932f4e766ed85f6"
            },
            "downloads": -1,
            "filename": "struct_model_python-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f424e3fccaa5d5af2087213a8f3121d8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 6235,
            "upload_time": "2023-10-22T02:50:02",
            "upload_time_iso_8601": "2023-10-22T02:50:02.648536Z",
            "url": "https://files.pythonhosted.org/packages/0b/bf/92dddae3a3d258dbf6316f7440b13c0165389b46af52d0ee008662f07f2c/struct_model_python-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0a80c9160f3b2ab828f9dbc74e19688264dd6fa9e46ef40b657eefdee397d616",
                "md5": "6e735c91ad4ec41f73143c3ce4f9ea6c",
                "sha256": "078db5ffc4409a643fef70204c784f101399aac5e1de377dbf99da9ea7f45fc6"
            },
            "downloads": -1,
            "filename": "struct_model_python-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6e735c91ad4ec41f73143c3ce4f9ea6c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 5393,
            "upload_time": "2023-10-22T02:50:04",
            "upload_time_iso_8601": "2023-10-22T02:50:04.315068Z",
            "url": "https://files.pythonhosted.org/packages/0a/80/c9160f3b2ab828f9dbc74e19688264dd6fa9e46ef40b657eefdee397d616/struct_model_python-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-22 02:50:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AdamBrianBright",
    "github_project": "struct-model-python",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "struct-model-python"
}
        
Elapsed time: 0.12610s