Metadata-Version: 2.1
Name: zrb
Version: 1.4.0
Summary: Your Automation Powerhouse
Home-page: https://github.com/state-alchemists/zrb
License: AGPL-3.0-or-later
Keywords: Automation,Task Runner,Code Generator,Monorepo,Low Code
Author: Go Frendi Gunawan
Author-email: gofrendiasgard@gmail.com
Requires-Python: >=3.10.0,<4.0.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Provides-Extra: rag
Requires-Dist: autopep8 (>=2.0.4,<3.0.0)
Requires-Dist: beautifulsoup4 (>=4.12.3,<5.0.0)
Requires-Dist: black (>=24.10.0,<24.11.0)
Requires-Dist: chromadb (>=0.5.20,<0.6.0) ; extra == "rag"
Requires-Dist: fastapi[standard] (>=0.115.6,<0.116.0)
Requires-Dist: fastembed (>=0.5.1,<0.6.0)
Requires-Dist: isort (>=5.13.2,<5.14.0)
Requires-Dist: libcst (>=1.5.0,<2.0.0)
Requires-Dist: pdfplumber (>=0.11.4,<0.12.0) ; extra == "rag"
Requires-Dist: psutil (>=6.1.1,<7.0.0)
Requires-Dist: pydantic-ai (>=0.0.42,<0.0.43)
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
Requires-Dist: python-jose[cryptography] (>=3.4.0,<4.0.0)
Requires-Dist: requests (>=2.32.3,<3.0.0)
Requires-Dist: ulid-py (>=1.1.0,<2.0.0)
Project-URL: Documentation, https://github.com/state-alchemists/zrb
Project-URL: Repository, https://github.com/state-alchemists/zrb
Description-Content-Type: text/markdown

![](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/zrb/android-chrome-192x192.png)

[Documentation](https://github.com/state-alchemists/zrb/blob/main/docs/README.md)

# 🤖 Zrb: Your Automation Powerhouse

Zrb allows you to write your automation tasks in Python. For example, you can define the following script in your home directory (`/home/<your-user-name>/zrb_init.py`).


```python
import os
from zrb import cli, llm_config, LLMTask, CmdTask, StrInput, Group
from zrb.builtin.llm.tool.file import read_all_files, write_text_file
from pydantic_ai.models.openai import OpenAIModel
from pydantic_ai.providers.openai import OpenAIProvider

CURRENT_DIR = os.getcwd()

# Setup default LLM Config
llm_config.set_default_model(
    OpenAIModel(
        model_name="gpt-4o",
        provider=OpenAIProvider(
            base_url="https://openrouter.ai/api/v1",
            api_key=os.getenv("OPENROUTER_API_KEY", "")
        )
    )
)

# Make UML group
uml_group = cli.add_group(Group(name="uml", description="UML related tasks"))

# Generate UML script
make_uml_script = uml_group.add_task(
    LLMTask(
        name="make-script",
        description="Creating plantuml diagram based on source code in current directory",
        input=StrInput(name="diagram", default="state diagram"),
        message=(
            f"Read source code in {CURRENT_DIR}, "
            "make a {ctx.input.diagram} in plantuml format. "
            f"Write the script into {CURRENT_DIR}/{{ctx.input.diagram}}.uml"
        ),
        tools=[
            read_all_files,
            write_text_file,
        ],
    )
)

# Defining a Cmd Task to transform Plantuml script into a png image.
make_uml_image = uml_group.add_task(
    CmdTask(
        name="make-image",
        description="Creating png based on source code in current directory",
        input=StrInput(name="diagram", default="state diagram"),
        cmd="plantuml -tpng '{ctx.input.diagram}.uml'",
        cwd=CURRENT_DIR,
    )
)

# Making sure that make_png has make_uml as its dependency.
make_uml_script >> make_uml_image
```

Once defined, your automation tasks are immediately accessible from the CLI. You can then invoke the tasks by invoking.

```bash
zrb uml make-image --diagram "state diagram"
```

Or you can invoke the tasks without parameter.

```bash
zrb uml make-image
```

At this point, Zrb will politely ask you to provide the diagram type.

```
diagram [state diagram]:
```

You can just press enter if you want to use the default value.

Finally, you can run Zrb as a server and make your tasks available for non technical users by invoking the following command.

```bash
zrb server start
```

You will have a nice web interface running on `http://localhost:12123`

![Zrb Web UI](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/zrb-web-ui.png)

Now, let's see how Zrb generate the state diagram. Based on the source code in your current directory, Zrb will generate a `state diagram.uml` and transform it into `state diagram.png`.

![State Diagram](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/state-diagram.png)

See the [getting started guide](https://github.com/state-alchemists/zrb/blob/main/docs/recipes/getting-started/README.md) for more information. Or just watch the demo:

[![Video Title](https://img.youtube.com/vi/W7dgk96l__o/0.jpg)](https://www.youtube.com/watch?v=W7dgk96l__o)


# 🫰 Installing Zrb

You can install Zrb as a pip package by invoking the following command:

```bash
pip install --pre zrb
```

Alternatively, you can also use our installation script to install Zrb along with some prerequisites:

```bash
bash -c "$(curl -fsSL https://raw.githubusercontent.com/state-alchemists/zrb/main/install.sh)"
```

# 🐞 Bug Report + Feature Request

You can submit bug reports and feature requests by creating a new [issue](https://github.com/state-alchemists/zrb/issues) on Zrb's GitHub Repositories. When reporting a bug or requesting a feature, please be sure to:

- Include the version of Zrb you are using (i.e., `zrb version`)
- Tell us what you have tried
- Tell us what you expect
- Tell us what you get

We will also welcome your [pull requests and contributions](https://github.com/state-alchemists/zrb/pulls).


# ☕ Donation

Help Red Skull to click the donation button:

[![](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/donator.png)](https://stalchmst.com/donation)

# 🎉 Fun Fact

> Madou Ring Zaruba (魔導輪ザルバ, Madōrin Zaruba) is a Madougu which supports bearers of the Garo Armor. [(Garo Wiki | Fandom)](https://garo.fandom.com/wiki/Zaruba)

![Madou Ring Zaruba on Kouga's Hand](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/madou-ring-zaruba.jpg)

