yivo


Nameyivo JSON
Version 2025.8.23.1 PyPI version JSON
download
home_pagehttps://pypi.org/project/yivo/
SummaryMessage serialization
upload_time2025-08-24 18:52:18
maintainerNone
docs_urlNone
authorwalchko
requires_python>=3.10
licenseMIT
keywords arduino
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![](https://raw.githubusercontent.com/MomsFriendlyRobotCompany/yivo/main/docs/yivo.png)

# Yivo

[![Python](https://github.com/MomsFriendlyRobotCompany/yivo/actions/workflows/python.yaml/badge.svg)](https://github.com/MomsFriendlyRobotCompany/yivo/actions/workflows/python.yaml)
![GitHub](https://img.shields.io/github/license/MomsFriendlyRobotCompany/yivo)

Trying to standardize the way I access sensors.

## Python

```python
from yivo import Yivo, MsgInfo

# make some messages we want to send/receive
A = namedtuple("A","x y")      # id = 1
B = namedtuple("B", "x y z t") # id = 2

msgdb = MsgInfo()
msgdb[1] = ("2f", A) # 2 floats
msgdb[2] = ("4f", B) # 4 floats

yivo = Yivo(msgdb)
pkt = yivo.pack(1, A(1.,2.))

id = 0
while id == 0:
    b = serial_read() # get a byte from somewhere
    id = yivo.parse(b) # 0 or msg_id

err, msg = yivo.unpack() # err > 0 if failure to unpack
```


## API

| Part     | In Checksum | Type  | Description |
|----------|-------------|-------|-------------|
| Header   |   | `uint8_t[2]`    | default `$K` |
| Size     | x | `uint16_t`      | 0-65,535 bytes, stored as [L,H] => `(H << 8) | L` |
| Type     | x | `uint8_t`       | 255 message IDs, 0 is not allowed as an ID |
| Data     | x | `uint8_t[Size]` | payload data array |
| Checksum |   | `uint8_t`       | XOR of size, type, and data bytes |

| 0 | 1 | 2 | 3 | 4 | ... | -1 |
|---|---|---|---|---|-----|----|
|`$`|`K`| L | H | T | ... | checksum |

## gentools

Generate messages for python and C/C++.

| Type     | Bytes | Format | Python | C/C++ |
|----------|---|-----|-------|---------------|
| `uint8`  | 1 | `B` | `int` | `uint8_t`
| `uint16` | 2 | `H` | `int` | `uint16_t`
| `uint32` | 4 | `I` | `int` | `uint32_t`
| `uint64` | 8 | `Q` | `int` | `uint64_t`
| `int8`   | 1 | `b` | `int` | `int8_t`
| `int16`  | 2 | `h` | `int` | `int16_t`
| `int32`  | 4 | `i` | `int` | `int32_t`
| `int64`  | 8 | `q` | `int` | `int64_t`
| `float`  | 4 | `f` | `float` | `float`
| `double` | 8 | `d` | `float` | `double`


```
# comment ...
# comment ...

float     a # comment about var
uint8     b
int16[12] c

<enum something uint16_t
bob=0
tom=2
jerry=32
enum>
```

```json
{
    "namespace": "foobar",
    "license": "MIT Kevin Walchko (c) 2023",
    "output": "test",
    "1": "messages/vec.yivo",
    "2": "messages/quat.yivo",
    "4": "messages/imu.yivo",
    "5": "messages/cal.yivo"
}
```

# MIT License

**Copyright (c) 2020 Mom's Friendly Robot Company**

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/yivo/",
    "name": "yivo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "arduino",
    "author": "walchko",
    "author_email": "walchko@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/07/32/492dba73598995f31d7072f9bf81dd97e837b5305990c9e9944b1084b5b2/yivo-2025.8.23.1.tar.gz",
    "platform": null,
    "description": "![](https://raw.githubusercontent.com/MomsFriendlyRobotCompany/yivo/main/docs/yivo.png)\n\n# Yivo\n\n[![Python](https://github.com/MomsFriendlyRobotCompany/yivo/actions/workflows/python.yaml/badge.svg)](https://github.com/MomsFriendlyRobotCompany/yivo/actions/workflows/python.yaml)\n![GitHub](https://img.shields.io/github/license/MomsFriendlyRobotCompany/yivo)\n\nTrying to standardize the way I access sensors.\n\n## Python\n\n```python\nfrom yivo import Yivo, MsgInfo\n\n# make some messages we want to send/receive\nA = namedtuple(\"A\",\"x y\")      # id = 1\nB = namedtuple(\"B\", \"x y z t\") # id = 2\n\nmsgdb = MsgInfo()\nmsgdb[1] = (\"2f\", A) # 2 floats\nmsgdb[2] = (\"4f\", B) # 4 floats\n\nyivo = Yivo(msgdb)\npkt = yivo.pack(1, A(1.,2.))\n\nid = 0\nwhile id == 0:\n    b = serial_read() # get a byte from somewhere\n    id = yivo.parse(b) # 0 or msg_id\n\nerr, msg = yivo.unpack() # err > 0 if failure to unpack\n```\n\n\n## API\n\n| Part     | In Checksum | Type  | Description |\n|----------|-------------|-------|-------------|\n| Header   |   | `uint8_t[2]`    | default `$K` |\n| Size     | x | `uint16_t`      | 0-65,535 bytes, stored as [L,H] => `(H << 8) | L` |\n| Type     | x | `uint8_t`       | 255 message IDs, 0 is not allowed as an ID |\n| Data     | x | `uint8_t[Size]` | payload data array |\n| Checksum |   | `uint8_t`       | XOR of size, type, and data bytes |\n\n| 0 | 1 | 2 | 3 | 4 | ... | -1 |\n|---|---|---|---|---|-----|----|\n|`$`|`K`| L | H | T | ... | checksum |\n\n## gentools\n\nGenerate messages for python and C/C++.\n\n| Type     | Bytes | Format | Python | C/C++ |\n|----------|---|-----|-------|---------------|\n| `uint8`  | 1 | `B` | `int` | `uint8_t`\n| `uint16` | 2 | `H` | `int` | `uint16_t`\n| `uint32` | 4 | `I` | `int` | `uint32_t`\n| `uint64` | 8 | `Q` | `int` | `uint64_t`\n| `int8`   | 1 | `b` | `int` | `int8_t`\n| `int16`  | 2 | `h` | `int` | `int16_t`\n| `int32`  | 4 | `i` | `int` | `int32_t`\n| `int64`  | 8 | `q` | `int` | `int64_t`\n| `float`  | 4 | `f` | `float` | `float`\n| `double` | 8 | `d` | `float` | `double`\n\n\n```\n# comment ...\n# comment ...\n\nfloat     a # comment about var\nuint8     b\nint16[12] c\n\n<enum something uint16_t\nbob=0\ntom=2\njerry=32\nenum>\n```\n\n```json\n{\n    \"namespace\": \"foobar\",\n    \"license\": \"MIT Kevin Walchko (c) 2023\",\n    \"output\": \"test\",\n    \"1\": \"messages/vec.yivo\",\n    \"2\": \"messages/quat.yivo\",\n    \"4\": \"messages/imu.yivo\",\n    \"5\": \"messages/cal.yivo\"\n}\n```\n\n# MIT License\n\n**Copyright (c) 2020 Mom's Friendly Robot Company**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Message serialization",
    "version": "2025.8.23.1",
    "project_urls": {
        "Homepage": "https://pypi.org/project/yivo/",
        "Repository": "http://github.com/MomsFriendlyRobotCompany/yivo"
    },
    "split_keywords": [
        "arduino"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fd3d61a6298591b97b288b033ec417e887d6cf24af82f7d294f62d4320168047",
                "md5": "c381a0dbc21eff52a3e782e62c5fe3fd",
                "sha256": "d187dd1eb3d4cb254681b3840c4861220e64d815369be081425b42f369402efb"
            },
            "downloads": -1,
            "filename": "yivo-2025.8.23.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c381a0dbc21eff52a3e782e62c5fe3fd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 16790,
            "upload_time": "2025-08-24T18:52:17",
            "upload_time_iso_8601": "2025-08-24T18:52:17.436848Z",
            "url": "https://files.pythonhosted.org/packages/fd/3d/61a6298591b97b288b033ec417e887d6cf24af82f7d294f62d4320168047/yivo-2025.8.23.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0732492dba73598995f31d7072f9bf81dd97e837b5305990c9e9944b1084b5b2",
                "md5": "3d1f7a66bb3143b2d408509a6b5ecb87",
                "sha256": "41ae7ec5f30a8ff4da6a40b30e1556395904169979bb902608ac1b2e1cbcdfa8"
            },
            "downloads": -1,
            "filename": "yivo-2025.8.23.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3d1f7a66bb3143b2d408509a6b5ecb87",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 15009,
            "upload_time": "2025-08-24T18:52:18",
            "upload_time_iso_8601": "2025-08-24T18:52:18.655550Z",
            "url": "https://files.pythonhosted.org/packages/07/32/492dba73598995f31d7072f9bf81dd97e837b5305990c9e9944b1084b5b2/yivo-2025.8.23.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-24 18:52:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MomsFriendlyRobotCompany",
    "github_project": "yivo",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "yivo"
}
        
Elapsed time: 0.98337s