pytppi


Namepytppi JSON
Version 0.2 PyPI version JSON
download
home_pageNone
Summarytppi stands for Tilde Pipe Plus Interface
upload_time2024-09-09 10:33:51
maintainerNone
docs_urlNone
authorAbhijit Bose (aka. boseji)
requires_python>=3.8
licenseNone
keywords communication encoding string iot industrial
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            >
> ॐ भूर्भुवः स्वः
>
> तत्स॑वि॒तुर्वरे॑ण्यं॒
>
> भर्गो॑ दे॒वस्य॑ धीमहि।
>
> धियो॒ यो नः॑ प्रचो॒दया॑त्॥
>

# बोसजी के द्वारा रचित टिप्पी अधिलेखन प्रकृया।

> एक सरल संचार सहायक और संलग्न तंत्र।
>

***एक रचनात्मक भारतीय उत्पाद।***

## `tppi` stands for Tilde Pipe Plus Interface

> A simple communication helper and enclosing mechanism called **`TPPI protocol`**.

There are two parts to this protocol:

- *Organization* - Build the compatible data representation called **`TPPI content`**.
- *Encapsulation* - Prepare a compatible packet with necessary safeguards called **`TPPI packet`**.

This is **`string oriented protocol`** with *special safeguards* for **`TPPI protocol`**.

The following symbols are considered special to **`TPPI protocol`**:

- `~` Tilde Symbol
- `|` Pipe Symbol
- `+` Plus Symbol

These *symbol are replaced* by the following as *safeguards* for **`TPPI packet`**:

- `|` converts to `\\x7C`
- `+` converts to `\\x2B`

These *symbols are replaced* for *safeguards* in data specified for **`TPPI contents`** :

- `~` converts to `%7E`
- `|` converts to `%7C`
- `+` converts to `%2B`

The **`TPPI protocol`** contains special annotations:

- `~|` is used to indicate the **`start`** of the **`TPPI Packet`**
- `|~` is used to indicate the **end** of the **`TPPI Packet`**
- `|` is used to separate the **`TPPI contents`** in a **`TPPI Packet`**
- `~` are used to organize the **`TPPI contents`** with Type, tags, & data.
- `~||~` indicates a **`TPPI packet`** *without any contents*
- `+` is used to join **`TPPI packets`** together.

Collection rule for **`TPPI packets`**:

- If **`TPPI packet`** are sent one at a time then no special addition is needed.
- In case *collection* of **`TPPI packets`** need to be sent then `+` symbol is used.

Rules for **`TPPI content`**:

- The *content mist be filtered* with necessary *safeguards*.
- **`Type Signature`**: Each **T`PPI content`** must have a **`Type Signature`** that tells what type of data it contains and helps in *Discovery process* later. In case no **`Type Signature`** is provided `UN` would be used to indicate `unknown` Type`.
- **`Type Signature`** can't be left blank and recommended to be added.
- **`Tag`**: Each **`TPPI content`** can have a string name or tag that can help better identify the data enclosed. This would later be used for *Discovery process*. This is an *Optional field* and can be omitted in the **`TPPI content`**.
- **`Data`**: The **`TPPI content`** encloses the data provided in *string form*, that can later be retrieved using the *Discovery process*.
- The fields **`Type Signature`**, *(optional)* **`Tag`** and **`Data`** are separated by `~` Symbol in a **`TPPI content`**.

**`TPPI Content Processes`**:

- **`Specify`**: In this process the **`Type Signature`**, *(optional)* **`Tag`** and **`Data`** are joined together in **`TPPI Content`** form. This follows the rules for **`TPPI content`**. This typically happens before preparing the **`TPPI packet`**.
- **`Discover`**: In this process the **`Type Signature`**, *(optional)* **`Tag`** and **`Data`** are recovered from the supplied **`TPPI Content`**. This follows the same rules for **`TPPI content`** in order to find the enclosed data. This is typically done after receiving the TPPI packet and getting the **`TPPI contents`**.

**`TPPI Packet Processes`**:

- **`Assemble`**: In this process the **`TPPI contents`** are *filtered* and *joined together* into a **`TPPI packet`** following respective rules. This however *should not be used* for Joining *multiple TPPI packets*.
- **`Disassemble`**: In this process the incoming **`TPPI packet`** is broken into into multiple **`TPPI contents`** with *filtering/safeguards* removed. This however *should not be used* directly on the *Incoming TPPI packet* as *it would not be able to split apart TPPI packets*.
- **`Join`**: This is the process of *Joining multiple packets* before sending over the **`combined TPPI packets`**.
- **`Split`**: This is process perform as soon as the **`TPPI packets`** are received. *Only after this the process* of *Disassembly can begin*.

*Background behind the name:*

> The name `tppi` has been taken from a story of an imaginative kid
> discovering the mysteries of the Universe and the world all around
> from a remote village in the heart of Karnataka, Bharat(India).
>

## कार्यविधि - Usage

Include into a project:

```sh
pip install pytppi
```

Usage in Transmitter Program:

```py
from datetime import datetime
from src.tppi import assemble_func, specify, disassemble, discover

@assemble_func
def build(timestamp:int, value:float):
    return [
        specify(f"{timestamp}","TS"),
        specify(f"{value}","F"),
    ]

if __name__ == "__main__":
    print("Transmit Packet")
    print(build(datetime.now().timestamp(),12.4))
    parts = disassemble('~|TS~1725869454.327236|F~12.4|~')
    parts = [discover(p) for p in parts]
    print("Found:", parts)
    for p in parts:
        if p[1] == 'TS':
            print("Time Stamp:", datetime.fromtimestamp(float(p[0])))
        elif p[1] == 'F':
            print("Value:", float(p[0]))
```

## Developer Note

In order to perform test and future development use the following process:

Make sure a virtual environment is created and activated already.

Install dependencies:

```sh
pip install -e .[dev]
```

This would install `black`, `build` and `coverage`.

To test out the code:

```sh
coverage run
coverage html
```

To build the project:

```sh
python -m build --wheel --sdist
```

To format the code:

```sh
black .
```

## License

`SPDX: Apache-2.0`

`tppi` stands for Tilde Pipe Plus Interface

Copyright (C) 2024 Abhijit Bose (aka. Boseji). All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

<http://www.apache.org/licenses/LICENSE-2.0>

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pytppi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "communication, encoding, string, iot, industrial",
    "author": "Abhijit Bose (aka. boseji)",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/6e/ae/d47665ae0dc425950fdd78d2e70da759eaf2bf545c6d71ca720b13d28219/pytppi-0.2.tar.gz",
    "platform": null,
    "description": ">\n> \u0950 \u092d\u0942\u0930\u094d\u092d\u0941\u0935\u0903 \u0938\u094d\u0935\u0903\n>\n> \u0924\u0924\u094d\u0938\u0951\u0935\u093f\u0952\u0924\u0941\u0930\u094d\u0935\u0930\u0947\u0951\u0923\u094d\u092f\u0902\u0952\n>\n> \u092d\u0930\u094d\u0917\u094b\u0951 \u0926\u0947\u0952\u0935\u0938\u094d\u092f\u0951 \u0927\u0940\u092e\u0939\u093f\u0964\n>\n> \u0927\u093f\u092f\u094b\u0952 \u092f\u094b \u0928\u0903\u0951 \u092a\u094d\u0930\u091a\u094b\u0952\u0926\u092f\u093e\u0951\u0924\u094d\u0965\n>\n\n# \u092c\u094b\u0938\u091c\u0940 \u0915\u0947 \u0926\u094d\u0935\u093e\u0930\u093e \u0930\u091a\u093f\u0924 \u091f\u093f\u092a\u094d\u092a\u0940 \u0905\u0927\u093f\u0932\u0947\u0916\u0928 \u092a\u094d\u0930\u0915\u0943\u092f\u093e\u0964\n\n> \u090f\u0915 \u0938\u0930\u0932 \u0938\u0902\u091a\u093e\u0930 \u0938\u0939\u093e\u092f\u0915 \u0914\u0930 \u0938\u0902\u0932\u0917\u094d\u0928 \u0924\u0902\u0924\u094d\u0930\u0964\n>\n\n***\u090f\u0915 \u0930\u091a\u0928\u093e\u0924\u094d\u092e\u0915 \u092d\u093e\u0930\u0924\u0940\u092f \u0909\u0924\u094d\u092a\u093e\u0926\u0964***\n\n## `tppi` stands for Tilde Pipe Plus Interface\n\n> A simple communication helper and enclosing mechanism called **`TPPI protocol`**.\n\nThere are two parts to this protocol:\n\n- *Organization* - Build the compatible data representation called **`TPPI content`**.\n- *Encapsulation* - Prepare a compatible packet with necessary safeguards called **`TPPI packet`**.\n\nThis is **`string oriented protocol`** with *special safeguards* for **`TPPI protocol`**.\n\nThe following symbols are considered special to **`TPPI protocol`**:\n\n- `~` Tilde Symbol\n- `|` Pipe Symbol\n- `+` Plus Symbol\n\nThese *symbol are replaced* by the following as *safeguards* for **`TPPI packet`**:\n\n- `|` converts to `\\\\x7C`\n- `+` converts to `\\\\x2B`\n\nThese *symbols are replaced* for *safeguards* in data specified for **`TPPI contents`** :\n\n- `~` converts to `%7E`\n- `|` converts to `%7C`\n- `+` converts to `%2B`\n\nThe **`TPPI protocol`** contains special annotations:\n\n- `~|` is used to indicate the **`start`** of the **`TPPI Packet`**\n- `|~` is used to indicate the **end** of the **`TPPI Packet`**\n- `|` is used to separate the **`TPPI contents`** in a **`TPPI Packet`**\n- `~` are used to organize the **`TPPI contents`** with Type, tags, & data.\n- `~||~` indicates a **`TPPI packet`** *without any contents*\n- `+` is used to join **`TPPI packets`** together.\n\nCollection rule for **`TPPI packets`**:\n\n- If **`TPPI packet`** are sent one at a time then no special addition is needed.\n- In case *collection* of **`TPPI packets`** need to be sent then `+` symbol is used.\n\nRules for **`TPPI content`**:\n\n- The *content mist be filtered* with necessary *safeguards*.\n- **`Type Signature`**: Each **T`PPI content`** must have a **`Type Signature`** that tells what type of data it contains and helps in *Discovery process* later. In case no **`Type Signature`** is provided `UN` would be used to indicate `unknown` Type`.\n- **`Type Signature`** can't be left blank and recommended to be added.\n- **`Tag`**: Each **`TPPI content`** can have a string name or tag that can help better identify the data enclosed. This would later be used for *Discovery process*. This is an *Optional field* and can be omitted in the **`TPPI content`**.\n- **`Data`**: The **`TPPI content`** encloses the data provided in *string form*, that can later be retrieved using the *Discovery process*.\n- The fields **`Type Signature`**, *(optional)* **`Tag`** and **`Data`** are separated by `~` Symbol in a **`TPPI content`**.\n\n**`TPPI Content Processes`**:\n\n- **`Specify`**: In this process the **`Type Signature`**, *(optional)* **`Tag`** and **`Data`** are joined together in **`TPPI Content`** form. This follows the rules for **`TPPI content`**. This typically happens before preparing the **`TPPI packet`**.\n- **`Discover`**: In this process the **`Type Signature`**, *(optional)* **`Tag`** and **`Data`** are recovered from the supplied **`TPPI Content`**. This follows the same rules for **`TPPI content`** in order to find the enclosed data. This is typically done after receiving the TPPI packet and getting the **`TPPI contents`**.\n\n**`TPPI Packet Processes`**:\n\n- **`Assemble`**: In this process the **`TPPI contents`** are *filtered* and *joined together* into a **`TPPI packet`** following respective rules. This however *should not be used* for Joining *multiple TPPI packets*.\n- **`Disassemble`**: In this process the incoming **`TPPI packet`** is broken into into multiple **`TPPI contents`** with *filtering/safeguards* removed. This however *should not be used* directly on the *Incoming TPPI packet* as *it would not be able to split apart TPPI packets*.\n- **`Join`**: This is the process of *Joining multiple packets* before sending over the **`combined TPPI packets`**.\n- **`Split`**: This is process perform as soon as the **`TPPI packets`** are received. *Only after this the process* of *Disassembly can begin*.\n\n*Background behind the name:*\n\n> The name `tppi` has been taken from a story of an imaginative kid\n> discovering the mysteries of the Universe and the world all around\n> from a remote village in the heart of Karnataka, Bharat(India).\n>\n\n## \u0915\u093e\u0930\u094d\u092f\u0935\u093f\u0927\u093f - Usage\n\nInclude into a project:\n\n```sh\npip install pytppi\n```\n\nUsage in Transmitter Program:\n\n```py\nfrom datetime import datetime\nfrom src.tppi import assemble_func, specify, disassemble, discover\n\n@assemble_func\ndef build(timestamp:int, value:float):\n    return [\n        specify(f\"{timestamp}\",\"TS\"),\n        specify(f\"{value}\",\"F\"),\n    ]\n\nif __name__ == \"__main__\":\n    print(\"Transmit Packet\")\n    print(build(datetime.now().timestamp(),12.4))\n    parts = disassemble('~|TS~1725869454.327236|F~12.4|~')\n    parts = [discover(p) for p in parts]\n    print(\"Found:\", parts)\n    for p in parts:\n        if p[1] == 'TS':\n            print(\"Time Stamp:\", datetime.fromtimestamp(float(p[0])))\n        elif p[1] == 'F':\n            print(\"Value:\", float(p[0]))\n```\n\n## Developer Note\n\nIn order to perform test and future development use the following process:\n\nMake sure a virtual environment is created and activated already.\n\nInstall dependencies:\n\n```sh\npip install -e .[dev]\n```\n\nThis would install `black`, `build` and `coverage`.\n\nTo test out the code:\n\n```sh\ncoverage run\ncoverage html\n```\n\nTo build the project:\n\n```sh\npython -m build --wheel --sdist\n```\n\nTo format the code:\n\n```sh\nblack .\n```\n\n## License\n\n`SPDX: Apache-2.0`\n\n`tppi` stands for Tilde Pipe Plus Interface\n\nCopyright (C) 2024 Abhijit Bose (aka. Boseji). All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n<http://www.apache.org/licenses/LICENSE-2.0>\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "tppi stands for Tilde Pipe Plus Interface",
    "version": "0.2",
    "project_urls": {
        "Homepage": "https://github.com/boseji/pytppi",
        "Issues": "https://github.com/boseji/pytppi/issues",
        "Repository": "https://github.com/boseji/pytppi.git"
    },
    "split_keywords": [
        "communication",
        " encoding",
        " string",
        " iot",
        " industrial"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e3c0db3485c646255dd2dda86aacee7cf30a2d0f61b9be3172eb7ba1f2b8dfaf",
                "md5": "0b6c4a41b5ed30a276c88d27f52b8277",
                "sha256": "cf96223627934eb9c2fed3799bcba07bb4673e9acd08cf6b9d2da6978c3116ab"
            },
            "downloads": -1,
            "filename": "pytppi-0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b6c4a41b5ed30a276c88d27f52b8277",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 12823,
            "upload_time": "2024-09-09T10:33:50",
            "upload_time_iso_8601": "2024-09-09T10:33:50.681086Z",
            "url": "https://files.pythonhosted.org/packages/e3/c0/db3485c646255dd2dda86aacee7cf30a2d0f61b9be3172eb7ba1f2b8dfaf/pytppi-0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6eaed47665ae0dc425950fdd78d2e70da759eaf2bf545c6d71ca720b13d28219",
                "md5": "0cce6f2379c4ce7904636c2f8f9263ab",
                "sha256": "1a2a98c39ce8b7a3289e62c2aaf4fbfa4cbd41d2c50189fc78b0a9809c61e683"
            },
            "downloads": -1,
            "filename": "pytppi-0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0cce6f2379c4ce7904636c2f8f9263ab",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 12639,
            "upload_time": "2024-09-09T10:33:51",
            "upload_time_iso_8601": "2024-09-09T10:33:51.806689Z",
            "url": "https://files.pythonhosted.org/packages/6e/ae/d47665ae0dc425950fdd78d2e70da759eaf2bf545c6d71ca720b13d28219/pytppi-0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-09 10:33:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "boseji",
    "github_project": "pytppi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pytppi"
}
        
Elapsed time: 0.48667s