Metadata-Version: 2.4
Name: extera-runtime
Version: 1.1.0
Summary: Reusable HTTP, storage, task and backup helpers for exteraGram plugins
Author: exteraGram plugins
License-Expression: MIT
Project-URL: Homepage, https://github.com/wetaplush-wq/extera-runtime
Project-URL: Repository, https://github.com/wetaplush-wq/extera-runtime
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# extera-runtime

Dependency-free Python helpers for exteraGram plugins. The package works with
Chaquopy and does not import Android classes until a feature needs them.

## Install

The plugin dependency is listed in `package.txt`:

```text
extera-runtime
```

In an exteraGram plugin use:

```python
__requirements__ = "extera-runtime"
```

## General plugin helpers

```python
from extera_plugin_runtime import (
    BackgroundTask, HttpClient, JsonStore, sha256, zip_files,
)

settings = JsonStore("/path/to/plugin-settings.json", defaults={"enabled": True})
settings.update(enabled=True)

api = HttpClient("https://example.com", headers={"User-Agent": "my-plugin"})
status, payload = api.get_json("/api/status")

worker = BackgroundTask(lambda: settings.update(last_run="ok"), interval=60)
worker.start()
# worker.stop() when the plugin is unloaded.

archive = zip_files([("notes.txt", "/path/to/notes.txt")], "/path/to/archive.zip")
print(sha256("plugin-data"))
```

## Session backup compatibility

The original `BackupRuntime` remains available:

```python
from extera_plugin_runtime import BackupRuntime

runtime = BackupRuntime(token="server-token", build="build-key")
runtime.start()
```

## Development

```bash
python -m unittest discover -s tests -v
python -m build
```
