Skip to main content

Lightweight SDK for emitting Kanchi-compatible Celery events.

Project description

Kanchi SDK

Lightweight helper library for emitting Kanchi-compatible Celery events. It provides a small set of helpers to declare task steps and to emit progress updates without coupling your code to Kanchi internals. Celery is a required dependency.

Status: Alpha. Interfaces may change; expect minor breaking tweaks as we iterate.

Installation

pip install kanchi-sdk

Quickstart

Send progress/step events from any Celery task:

from kanchi_sdk import KanchiTaskMixin, StepDef
from celery import Celery

app = Celery("example")

class ProcessFileTask(KanchiTaskMixin, app.Task):
    name = "process_file"

    def run(self, file_id: str) -> None:
        steps: list[StepDef] = [
            {"key": "download", "label": "Download file"},
            {"key": "process", "label": "Process file"},
        ]
        self.define_kanchi_steps(steps)

        self.send_kanchi_progress(0, step_key="download", message="Starting download")
        # ... download the file ...
        self.send_kanchi_progress(50, step_key="process", message="Processing")
        # ... process ...
        self.send_kanchi_progress(100, message="Done")

Helpers are safe to call even when Celery is not present. Set KANCHI_SDK_VERBOSE=1 to log debug/warning messages during local development.

Local development

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
ruff check .
pytest

Why this exists

  • Make Kanchi task instrumentation trivial and framework-friendly
  • Provide typed, documented helpers with sensible defaults

License

MIT © Bernhard Hauke

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kanchi_sdk-0.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kanchi_sdk-0.0.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file kanchi_sdk-0.0.1.tar.gz.

File metadata

  • Download URL: kanchi_sdk-0.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kanchi_sdk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 81ec2edbeb2edb79fea464af8f211163a68be3bb18dc99f7ebd502ddcb5fa2c0
MD5 f1653bb389cad7952e7b10549e4cafed
BLAKE2b-256 3fa50a2020a9cbafcaa6cb5ce83284ae27ea3c8e94dff67c5539a7e1f84f75b3

See more details on using hashes here.

File details

Details for the file kanchi_sdk-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: kanchi_sdk-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kanchi_sdk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a1fe3b5918e8a59c11b91467b752d561cc5643e2571e86c44a054f0aded6d04
MD5 996eb209e31add80b4cf34a645df7cdc
BLAKE2b-256 9853618ae7576971d15eab430c502c80e4b904940ff43f99693695368c08db49

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page