Skip to main content

CI Release Version

timod

Library for creating ThingsDB modules using the Python language

Installation

$ pip install py-timod

Usage

Modules for ThingsDB read from stdin and write a response back to stdout. Work by the module must be non-blocking.

If the module requires configuration data, for example a connection string, then this configuration will be send immediately after start-up but may be received again when the module configuration is changed in ThingsDB.

Do not use functions like print since these function will write to stdout and this is reserved for ThingsDB. Instead, use logging... to write to stderr instead.

The following code may be used as a template: (see: https://github.com/thingsdb/ThingsDB/tree/master/modules/python/demo.py)

import logging
from typing import Any
from timod import start_module, TiHandler, LookupError


class Handler(TiHandler):

    async def on_config(self, cfg: Any):
        logging.info(cfg)

    async def on_request(self, req: dict[str, Any]):
        if 'message' not in req:
            raise LookupError('missing `message` in request')

        return req['message']


if __name__ == '__main__':
    start_module('demo', Handler())

Metadata

Release files for py-timod 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-timod 1.0.0
File Size Uploaded
py_timod-1.0.0.tar.gz 17.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-timod 1.0.0
File Interpreter ABI Platform
py_timod-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.3 kB

Release files / py_timod-1.0.0.tar.gz

Download URL py_timod-1.0.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3d32b267c18e11f4244416fe890671d1dbd47c11b8530a594ce0fc055238d27d
BLAKE2b-256 checksum
How to use checksums
b3bec0c04d9306b9ce38404ede28c0db6f040e12cdb4595c8669a3cb04ea00a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.1

Release files / py_timod-1.0.0-py3-none-any.whl

Download URL py_timod-1.0.0-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96b4c87ac9809f9e615b25c2d42f24d23023f0029315fd21a05cfc19e7a17940
BLAKE2b-256 checksum
How to use checksums
106a03764c71861e287bd2408f663de7f81e9961c47765cb0cbbd0307cc9e235
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.1

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page