Metadata-Version: 2.5
Name: zakuro-ai
Version: 0.2.28
Summary: Zakuro - Distributed computing made simple
Project-URL: Homepage, https://zakuro-ai.com
Project-URL: Documentation, https://docs.zakuro-ai.com
Project-URL: Repository, https://github.com/zakuro-ai/zakuro
Author-email: ZakuroAI <dev@zakuro-ai.com>
License-Expression: BSD-3-Clause
License-File: LICENSE
Keywords: distributed-computing,distributed-ml,fault-tolerance,load-balancing,machine-learning,python,quic,remote-execution
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: System :: Distributed Computing
Requires-Python: >=3.10
Requires-Dist: cloudpickle>=3.0.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyyaml>=6.0.0
Provides-Extra: all
Requires-Dist: aioquic>=1.0.0; extra == 'all'
Requires-Dist: dask>=2023.0.0; extra == 'all'
Requires-Dist: distributed>=2023.0.0; extra == 'all'
Requires-Dist: fastapi>=0.100.0; extra == 'all'
Requires-Dist: mypy>=1.0; extra == 'all'
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.27.0; extra == 'all'
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.48b0; extra == 'all'
Requires-Dist: opentelemetry-instrumentation-httpx>=0.48b0; extra == 'all'
Requires-Dist: opentelemetry-sdk>=1.27.0; extra == 'all'
Requires-Dist: pre-commit>=3.0; extra == 'all'
Requires-Dist: prometheus-client>=0.20.0; extra == 'all'
Requires-Dist: psutil>=5.9.0; extra == 'all'
Requires-Dist: pyjwt[crypto]>=2.8.0; extra == 'all'
Requires-Dist: pyspark>=3.0.0; extra == 'all'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'all'
Requires-Dist: pytest-cov>=4.0; extra == 'all'
Requires-Dist: pytest>=7.0; extra == 'all'
Requires-Dist: ray>=2.0.0; extra == 'all'
Requires-Dist: ruff>=0.1.0; extra == 'all'
Requires-Dist: sentry-sdk>=2.0.0; extra == 'all'
Requires-Dist: structlog>=24.1.0; extra == 'all'
Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'all'
Provides-Extra: all-processors
Requires-Dist: dask>=2023.0.0; extra == 'all-processors'
Requires-Dist: distributed>=2023.0.0; extra == 'all-processors'
Requires-Dist: pyspark>=3.0.0; extra == 'all-processors'
Requires-Dist: ray>=2.0.0; extra == 'all-processors'
Provides-Extra: dask
Requires-Dist: dask>=2023.0.0; extra == 'dask'
Requires-Dist: distributed>=2023.0.0; extra == 'dask'
Provides-Extra: dev
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pre-commit>=3.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: observability
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.27.0; extra == 'observability'
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.48b0; extra == 'observability'
Requires-Dist: opentelemetry-instrumentation-httpx>=0.48b0; extra == 'observability'
Requires-Dist: opentelemetry-sdk>=1.27.0; extra == 'observability'
Requires-Dist: prometheus-client>=0.20.0; extra == 'observability'
Requires-Dist: sentry-sdk>=2.0.0; extra == 'observability'
Requires-Dist: structlog>=24.1.0; extra == 'observability'
Provides-Extra: ray
Requires-Dist: ray>=2.0.0; extra == 'ray'
Provides-Extra: spark
Requires-Dist: pyspark>=3.0.0; extra == 'spark'
Provides-Extra: worker
Requires-Dist: aioquic>=1.0.0; extra == 'worker'
Requires-Dist: fastapi>=0.100.0; extra == 'worker'
Requires-Dist: psutil>=5.9.0; extra == 'worker'
Requires-Dist: pyjwt[crypto]>=2.8.0; extra == 'worker'
Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'worker'
Description-Content-Type: text/markdown

<p align="center">
  <img alt="Zakuro" src="imgs/zakuro-banner.png">
</p>

<h3 align="center">Run Python functions on a pool of workers that routes around slow and dead machines.</h3>

<p align="center">
  <a href="https://pypi.org/project/zakuro-ai/"><img alt="PyPI" src="https://img.shields.io/pypi/v/zakuro-ai?color=blue"></a>
  <img alt="Python" src="https://img.shields.io/badge/python-3.10%2B-blue">
  <img alt="License" src="https://img.shields.io/github/license/zakuro-ai/zakuro.svg?color=blue">
</p>

<p align="center">
  <a href="https://docs.zakuro-ai.com"><b>Documentation</b></a> •
  <a href="https://docs.zakuro-ai.com/start/quickstart">Quickstart</a> •
  <a href="https://docs.zakuro-ai.com/reference/python-sdk">API reference</a> •
  <a href="CHANGELOG.md">Changelog</a>
</p>

---

Decorate a function, hand Zakuro a pool of workers, and each call goes to the worker that should finish it soonest. Zakuro learns from every call, resends a call when its worker dies, and stops sending work to machines that are slow or gone. Your code doesn't change.

## Try it in one command

```bash
git clone https://github.com/zakuro-ai/zakuro && cd zakuro
uv run demo.py
```

[`uv`](https://docs.astral.sh/uv/getting-started/installation/) installs the published `zakuro-ai` package into a throwaway environment and starts three workers on your machine. They count the primes below 100,000,000 in 200 chunks, and a third of the way in one worker is killed with no warning. On an Apple-silicon Mac it takes 6 s from `git clone` to this, install included (17 s on a 2017 Intel laptop):

```
   50/200 [######..................]   calls sent: w0  21   w1  19   w2  25
  !! killing worker-1 (pid 41675) mid-job

   75/200 [#########...............]   calls sent: w0  31   w1  29   w2  35
  100/200 [############............]   calls sent: w0  46   w1  37 (down)   w2  49
  ...
  200/200 [########################]   calls sent: w0 103   w1  37 (down)   w2 100

  primes below 100,000,000: 5,761,455  (known answer 5,761,455) -- correct
  200/200 calls succeeded, 0 lost; 10 call(s) hit the dead worker and were resent elsewhere
  worker-1 marked suspended by the health probe; finished in 3.1 s
```

No GPU, no Docker, no account.

## Use it

```bash
pip install 'zakuro-ai[worker]'
```

```python
import zakuro as zk

@zk.fn
def square(x: int) -> int:
    return x * x

workers = [zk.Worker.spawn() for _ in range(3)]          # three workers on this machine
pool = zk.AdaptiveCompute(workers=[w.compute(verify=False) for w in workers],
                          max_dispatch_retries=2)        # a failed call is resent to another worker
print(square.to(pool)(7))                                # → 49, on whichever worker is fastest
```

To run across machines, install `zc`, the Zakuro broker and CLI, from crates.io (the crate is `zc2`; it installs the `zc` command). It needs a Rust toolchain ([rustup.rs](https://rustup.rs)) and a C compiler/linker (`build-essential` on Debian/Ubuntu, Xcode Command Line Tools on macOS):

```bash
cargo install zc2 --locked
zc login                               # sign in in the browser
sudo -E "$(command -v zc)" connect     # join the mesh
```

Run `zc login` as yourself, not with `sudo`: it also gives this machine its own mesh identity. Joining the mesh brings up a WireGuard tunnel, so it needs `wireguard-tools` (apt or Homebrew) and root. `-E` keeps your sign-in, and the full path is there because `sudo` does not look in `~/.cargo/bin`.

Then address a machine on the mesh by its node, not its IP. `zk.nodes()` lists them, and the address survives the machine moving:

```python
square.to(zk.Compute(uri="zc://node-dd715b7f0a1c2e34", verify=False))(7)
```

A node with no free worker of its own forwards the call to another machine, which is paid, so give it a budget in yen: `square.to(zk.Compute(uri="zc://node-dd715b7f0a1c2e34", verify=False, processor_options={"budget": 10}))(7)`. Without one the broker answers `BUDGET_REQUIRED`.

Everything else is in the **[documentation](https://docs.zakuro-ai.com)**: [install options](https://docs.zakuro-ai.com/install/zakuro), [concepts](https://docs.zakuro-ai.com/zakuro/concepts), [choosing a transport](https://docs.zakuro-ai.com/guides/choosing-a-transport), [the zc broker](https://docs.zakuro-ai.com/zc/broker) and the [Python API reference](https://docs.zakuro-ai.com/reference/python-sdk). For ML training on top of Zakuro, see [Sakura](https://github.com/zakuro-ai/sakura).

---

<p align="center">
  If Zakuro is useful to you, a ⭐ helps other people find it, and it's the easiest way to follow new releases.<br>
  <a href="CONTRIBUTING.md">Contributing</a> • <a href="SECURITY.md">Security</a> • <a href="LICENSE">BSD-3-Clause</a>
</p>
