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

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

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:
[](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://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)

Raw data
{
"_id": null,
"home_page": "https://github.com/state-alchemists/zrb",
"name": "zrb",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.10.0",
"maintainer_email": null,
"keywords": "Automation, Task Runner, Code Generator, Monorepo, Low Code",
"author": "Go Frendi Gunawan",
"author_email": "gofrendiasgard@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d8/5b/253d74506f0bc57490157fdb6327f460517244331cd3cbe88427fe282c2b/zrb-1.4.0.tar.gz",
"platform": null,
"description": "\n\n[Documentation](https://github.com/state-alchemists/zrb/blob/main/docs/README.md)\n\n# \ud83e\udd16 Zrb: Your Automation Powerhouse\n\nZrb 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`).\n\n\n```python\nimport os\nfrom zrb import cli, llm_config, LLMTask, CmdTask, StrInput, Group\nfrom zrb.builtin.llm.tool.file import read_all_files, write_text_file\nfrom pydantic_ai.models.openai import OpenAIModel\nfrom pydantic_ai.providers.openai import OpenAIProvider\n\nCURRENT_DIR = os.getcwd()\n\n# Setup default LLM Config\nllm_config.set_default_model(\n OpenAIModel(\n model_name=\"gpt-4o\",\n provider=OpenAIProvider(\n base_url=\"https://openrouter.ai/api/v1\",\n api_key=os.getenv(\"OPENROUTER_API_KEY\", \"\")\n )\n )\n)\n\n# Make UML group\numl_group = cli.add_group(Group(name=\"uml\", description=\"UML related tasks\"))\n\n# Generate UML script\nmake_uml_script = uml_group.add_task(\n LLMTask(\n name=\"make-script\",\n description=\"Creating plantuml diagram based on source code in current directory\",\n input=StrInput(name=\"diagram\", default=\"state diagram\"),\n message=(\n f\"Read source code in {CURRENT_DIR}, \"\n \"make a {ctx.input.diagram} in plantuml format. \"\n f\"Write the script into {CURRENT_DIR}/{{ctx.input.diagram}}.uml\"\n ),\n tools=[\n read_all_files,\n write_text_file,\n ],\n )\n)\n\n# Defining a Cmd Task to transform Plantuml script into a png image.\nmake_uml_image = uml_group.add_task(\n CmdTask(\n name=\"make-image\",\n description=\"Creating png based on source code in current directory\",\n input=StrInput(name=\"diagram\", default=\"state diagram\"),\n cmd=\"plantuml -tpng '{ctx.input.diagram}.uml'\",\n cwd=CURRENT_DIR,\n )\n)\n\n# Making sure that make_png has make_uml as its dependency.\nmake_uml_script >> make_uml_image\n```\n\nOnce defined, your automation tasks are immediately accessible from the CLI. You can then invoke the tasks by invoking.\n\n```bash\nzrb uml make-image --diagram \"state diagram\"\n```\n\nOr you can invoke the tasks without parameter.\n\n```bash\nzrb uml make-image\n```\n\nAt this point, Zrb will politely ask you to provide the diagram type.\n\n```\ndiagram [state diagram]:\n```\n\nYou can just press enter if you want to use the default value.\n\nFinally, you can run Zrb as a server and make your tasks available for non technical users by invoking the following command.\n\n```bash\nzrb server start\n```\n\nYou will have a nice web interface running on `http://localhost:12123`\n\n\n\nNow, 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`.\n\n\n\nSee 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:\n\n[](https://www.youtube.com/watch?v=W7dgk96l__o)\n\n\n# \ud83e\udef0 Installing Zrb\n\nYou can install Zrb as a pip package by invoking the following command:\n\n```bash\npip install --pre zrb\n```\n\nAlternatively, you can also use our installation script to install Zrb along with some prerequisites:\n\n```bash\nbash -c \"$(curl -fsSL https://raw.githubusercontent.com/state-alchemists/zrb/main/install.sh)\"\n```\n\n# \ud83d\udc1e Bug Report + Feature Request\n\nYou 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:\n\n- Include the version of Zrb you are using (i.e., `zrb version`)\n- Tell us what you have tried\n- Tell us what you expect\n- Tell us what you get\n\nWe will also welcome your [pull requests and contributions](https://github.com/state-alchemists/zrb/pulls).\n\n\n# \u2615 Donation\n\nHelp Red Skull to click the donation button:\n\n[](https://stalchmst.com/donation)\n\n# \ud83c\udf89 Fun Fact\n\n> Madou Ring Zaruba (\u9b54\u5c0e\u8f2a\u30b6\u30eb\u30d0, Mad\u014drin Zaruba) is a Madougu which supports bearers of the Garo Armor. [(Garo Wiki | Fandom)](https://garo.fandom.com/wiki/Zaruba)\n\n\n",
"bugtrack_url": null,
"license": "AGPL-3.0-or-later",
"summary": "Your Automation Powerhouse",
"version": "1.4.0",
"project_urls": {
"Documentation": "https://github.com/state-alchemists/zrb",
"Homepage": "https://github.com/state-alchemists/zrb",
"Repository": "https://github.com/state-alchemists/zrb"
},
"split_keywords": [
"automation",
" task runner",
" code generator",
" monorepo",
" low code"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3164bffb798e7884c627b0a8b4e8564bc166247c8b70756a6b133780836a5d1a",
"md5": "5186ca83c93ed9278bb542e923cc02b1",
"sha256": "e0b685584e8f23f729c9aa6608baa4c7fac129a43133d0678799d4ac0616a817"
},
"downloads": -1,
"filename": "zrb-1.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5186ca83c93ed9278bb542e923cc02b1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.10.0",
"size": 579985,
"upload_time": "2025-03-21T14:11:25",
"upload_time_iso_8601": "2025-03-21T14:11:25.280192Z",
"url": "https://files.pythonhosted.org/packages/31/64/bffb798e7884c627b0a8b4e8564bc166247c8b70756a6b133780836a5d1a/zrb-1.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d85b253d74506f0bc57490157fdb6327f460517244331cd3cbe88427fe282c2b",
"md5": "531a2ce498f71f05b8b5dba81923fd43",
"sha256": "5f7e7b551714a83f8b913967ceadd1ab5f2112a84d0d296bc32a6c3601cb8207"
},
"downloads": -1,
"filename": "zrb-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "531a2ce498f71f05b8b5dba81923fd43",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.10.0",
"size": 448971,
"upload_time": "2025-03-21T14:11:35",
"upload_time_iso_8601": "2025-03-21T14:11:35.006394Z",
"url": "https://files.pythonhosted.org/packages/d8/5b/253d74506f0bc57490157fdb6327f460517244331cd3cbe88427fe282c2b/zrb-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-21 14:11:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "state-alchemists",
"github_project": "zrb",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "zrb"
}