Metadata-Version: 2.3
Name: kanchi-sdk
Version: 0.0.1
Summary: Lightweight SDK for emitting Kanchi-compatible Celery events.
Author: Kanchi
License: MIT License
         
         Copyright (c) 2025 Bernhard Hauke
         
         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.
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development
Requires-Dist: celery>=5
Requires-Dist: celery>=5 ; extra == 'dev'
Requires-Dist: pytest>=7.4 ; extra == 'dev'
Requires-Dist: pytest-cov>=4.1 ; extra == 'dev'
Requires-Dist: ruff>=0.1.9 ; extra == 'dev'
Requires-Dist: mypy>=1.8.0 ; extra == 'dev'
Requires-Python: >=3.9
Project-URL: Homepage, https://kanchi.io
Project-URL: Issues, https://github.com/getkanchi/kanchi-sdk/issues
Project-URL: Source, https://github.com/getkanchi/kanchi-sdk
Provides-Extra: dev
Description-Content-Type: text/markdown

# 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

```bash
pip install kanchi-sdk
```

## Quickstart

Send progress/step events from any Celery task:

```python
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

```bash
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
