sdss-tpm-multicast-client


Namesdss-tpm-multicast-client JSON
Version 0.3.1 PyPI version JSON
download
home_pageNone
SummaryTPM multicast client
upload_time2024-05-14 23:58:40
maintainerNone
docs_urlNone
authorJosé Sánchez-Gallego
requires_python<4.0,>=3.10
licenseBSD 3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # tpm_multicast_client

![Versions](https://img.shields.io/badge/python->=3.10-blue)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Test](https://github.com/sdss/tpm-multicast-client/actions/workflows/test.yml/badge.svg)](https://github.com/sdss/tpm-multicast-client/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/sdss/tpm-multicast-client/graph/badge.svg?token=eOF9ZykYgu)](https://codecov.io/gh/sdss/tpm-multicast-client)

Listens to the TPM multicast stream and unpack the data into a status dictionary. This is a Python-only implementation of Jeff Hagen's ``tpmdgram.c``.

## Installation

To install with `pip` do

```console
pip install sdss-tpm-multicast-client
```

To install from source do

```console
pip install .
```

or, for development,

```console
poetry install
```

More information on developing with Poetry can be found [here](https://python-poetry.org).

## Usage

The library provides a single function, `listen_to_multicast`, that creates a connection to the TPM broadcast, unpacks the datagram, and passes it to a callback function. A basic example

```python
from pprint import pprint

from tpm_multicast_client import __version__, listen_to_multicast


def pprint_datagram(data: dict):
    pprint(data)

async def main():
    _, protocol = await listen_to_multicast(pprint_datagram)
    await protocol.run_forever()


if __name__ == "__main__":
    main()
```

The callback, `pprint_datagram` in this case, can be a function or a coroutine. In the former case it will be called with `loop.call_soon()`. In the latter the coroutine is scheduled as a task.

## CLI

The library provides a simple CLI script `tpm-multicast-client` that prints the output of the datagram to stdout. It's basically equivalent to the example above.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sdss-tpm-multicast-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Jos\u00e9 S\u00e1nchez-Gallego",
    "author_email": "gallegoj@uw.edu",
    "download_url": "https://files.pythonhosted.org/packages/8d/96/4ec0aebfbe5c5cf550f905b1dcace5c90895462fbe0a258d0dcf1785e7b2/sdss_tpm_multicast_client-0.3.1.tar.gz",
    "platform": null,
    "description": "# tpm_multicast_client\n\n![Versions](https://img.shields.io/badge/python->=3.10-blue)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Test](https://github.com/sdss/tpm-multicast-client/actions/workflows/test.yml/badge.svg)](https://github.com/sdss/tpm-multicast-client/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/sdss/tpm-multicast-client/graph/badge.svg?token=eOF9ZykYgu)](https://codecov.io/gh/sdss/tpm-multicast-client)\n\nListens to the TPM multicast stream and unpack the data into a status dictionary. This is a Python-only implementation of Jeff Hagen's ``tpmdgram.c``.\n\n## Installation\n\nTo install with `pip` do\n\n```console\npip install sdss-tpm-multicast-client\n```\n\nTo install from source do\n\n```console\npip install .\n```\n\nor, for development,\n\n```console\npoetry install\n```\n\nMore information on developing with Poetry can be found [here](https://python-poetry.org).\n\n## Usage\n\nThe library provides a single function, `listen_to_multicast`, that creates a connection to the TPM broadcast, unpacks the datagram, and passes it to a callback function. A basic example\n\n```python\nfrom pprint import pprint\n\nfrom tpm_multicast_client import __version__, listen_to_multicast\n\n\ndef pprint_datagram(data: dict):\n    pprint(data)\n\nasync def main():\n    _, protocol = await listen_to_multicast(pprint_datagram)\n    await protocol.run_forever()\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\nThe callback, `pprint_datagram` in this case, can be a function or a coroutine. In the former case it will be called with `loop.call_soon()`. In the latter the coroutine is scheduled as a task.\n\n## CLI\n\nThe library provides a simple CLI script `tpm-multicast-client` that prints the output of the datagram to stdout. It's basically equivalent to the example above.\n\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause",
    "summary": "TPM multicast client",
    "version": "0.3.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3253232b0872387dabbc81004f23ecc1bbe15f4aff46eb4cd252f38ad9212ebc",
                "md5": "64036fb205495d06267d78f8923aa881",
                "sha256": "e2af843603ad2a39e6cfee6d42107f1824c650ab35dff5be45bc984768f392c2"
            },
            "downloads": -1,
            "filename": "sdss_tpm_multicast_client-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "64036fb205495d06267d78f8923aa881",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 8133,
            "upload_time": "2024-05-14T23:58:39",
            "upload_time_iso_8601": "2024-05-14T23:58:39.033885Z",
            "url": "https://files.pythonhosted.org/packages/32/53/232b0872387dabbc81004f23ecc1bbe15f4aff46eb4cd252f38ad9212ebc/sdss_tpm_multicast_client-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8d964ec0aebfbe5c5cf550f905b1dcace5c90895462fbe0a258d0dcf1785e7b2",
                "md5": "04659a96c6d83d452c5269d04a4e82ac",
                "sha256": "bb3052dcc838fc43699f4f856f517874156657fda00c2bcf7dce63991ef903dd"
            },
            "downloads": -1,
            "filename": "sdss_tpm_multicast_client-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "04659a96c6d83d452c5269d04a4e82ac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 6026,
            "upload_time": "2024-05-14T23:58:40",
            "upload_time_iso_8601": "2024-05-14T23:58:40.465695Z",
            "url": "https://files.pythonhosted.org/packages/8d/96/4ec0aebfbe5c5cf550f905b1dcace5c90895462fbe0a258d0dcf1785e7b2/sdss_tpm_multicast_client-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-14 23:58:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sdss-tpm-multicast-client"
}
        
Elapsed time: 0.24615s