zrb 1.13.1__py3-none-any.whl → 1.21.17__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zrb/__init__.py +2 -6
- zrb/attr/type.py +8 -8
- zrb/builtin/__init__.py +2 -0
- zrb/builtin/group.py +31 -15
- zrb/builtin/http.py +7 -8
- zrb/builtin/llm/attachment.py +40 -0
- zrb/builtin/llm/chat_session.py +130 -144
- zrb/builtin/llm/chat_session_cmd.py +226 -0
- zrb/builtin/llm/chat_trigger.py +73 -0
- zrb/builtin/llm/history.py +4 -4
- zrb/builtin/llm/llm_ask.py +218 -110
- zrb/builtin/llm/tool/api.py +74 -62
- zrb/builtin/llm/tool/cli.py +35 -16
- zrb/builtin/llm/tool/code.py +49 -47
- zrb/builtin/llm/tool/file.py +262 -251
- zrb/builtin/llm/tool/note.py +84 -0
- zrb/builtin/llm/tool/rag.py +25 -18
- zrb/builtin/llm/tool/sub_agent.py +29 -22
- zrb/builtin/llm/tool/web.py +135 -143
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py +7 -7
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_util.py +5 -5
- zrb/builtin/project/add/fastapp/fastapp_util.py +1 -1
- zrb/builtin/searxng/config/settings.yml +5671 -0
- zrb/builtin/searxng/start.py +21 -0
- zrb/builtin/setup/latex/ubuntu.py +1 -0
- zrb/builtin/setup/ubuntu.py +1 -1
- zrb/builtin/shell/autocomplete/bash.py +4 -3
- zrb/builtin/shell/autocomplete/zsh.py +4 -3
- zrb/config/config.py +255 -78
- zrb/config/default_prompt/file_extractor_system_prompt.md +109 -9
- zrb/config/default_prompt/interactive_system_prompt.md +24 -30
- zrb/config/default_prompt/persona.md +1 -1
- zrb/config/default_prompt/repo_extractor_system_prompt.md +31 -31
- zrb/config/default_prompt/repo_summarizer_system_prompt.md +27 -8
- zrb/config/default_prompt/summarization_prompt.md +8 -13
- zrb/config/default_prompt/system_prompt.md +36 -30
- zrb/config/llm_config.py +129 -24
- zrb/config/llm_context/config.py +127 -90
- zrb/config/llm_context/config_parser.py +1 -7
- zrb/config/llm_context/workflow.py +81 -0
- zrb/config/llm_rate_limitter.py +89 -45
- zrb/context/any_shared_context.py +7 -1
- zrb/context/context.py +8 -2
- zrb/context/shared_context.py +6 -8
- zrb/group/any_group.py +12 -5
- zrb/group/group.py +67 -3
- zrb/input/any_input.py +5 -1
- zrb/input/base_input.py +18 -6
- zrb/input/text_input.py +7 -24
- zrb/runner/cli.py +21 -20
- zrb/runner/common_util.py +24 -19
- zrb/runner/web_route/task_input_api_route.py +5 -5
- zrb/runner/web_route/task_session_api_route.py +1 -4
- zrb/runner/web_util/user.py +7 -3
- zrb/session/any_session.py +12 -6
- zrb/session/session.py +39 -18
- zrb/task/any_task.py +24 -3
- zrb/task/base/context.py +17 -9
- zrb/task/base/execution.py +15 -8
- zrb/task/base/lifecycle.py +8 -4
- zrb/task/base/monitoring.py +12 -7
- zrb/task/base_task.py +69 -5
- zrb/task/base_trigger.py +12 -5
- zrb/task/llm/agent.py +138 -52
- zrb/task/llm/config.py +45 -13
- zrb/task/llm/conversation_history.py +76 -6
- zrb/task/llm/conversation_history_model.py +0 -168
- zrb/task/llm/default_workflow/coding/workflow.md +41 -0
- zrb/task/llm/default_workflow/copywriting/workflow.md +68 -0
- zrb/task/llm/default_workflow/git/workflow.md +118 -0
- zrb/task/llm/default_workflow/golang/workflow.md +128 -0
- zrb/task/llm/default_workflow/html-css/workflow.md +135 -0
- zrb/task/llm/default_workflow/java/workflow.md +146 -0
- zrb/task/llm/default_workflow/javascript/workflow.md +158 -0
- zrb/task/llm/default_workflow/python/workflow.md +160 -0
- zrb/task/llm/default_workflow/researching/workflow.md +153 -0
- zrb/task/llm/default_workflow/rust/workflow.md +162 -0
- zrb/task/llm/default_workflow/shell/workflow.md +299 -0
- zrb/task/llm/file_replacement.py +206 -0
- zrb/task/llm/file_tool_model.py +57 -0
- zrb/task/llm/history_summarization.py +22 -35
- zrb/task/llm/history_summarization_tool.py +24 -0
- zrb/task/llm/print_node.py +182 -63
- zrb/task/llm/prompt.py +213 -153
- zrb/task/llm/tool_wrapper.py +210 -53
- zrb/task/llm/workflow.py +76 -0
- zrb/task/llm_task.py +98 -47
- zrb/task/make_task.py +2 -3
- zrb/task/rsync_task.py +25 -10
- zrb/task/scheduler.py +4 -4
- zrb/util/attr.py +50 -40
- zrb/util/cli/markdown.py +12 -0
- zrb/util/cli/text.py +30 -0
- zrb/util/file.py +27 -11
- zrb/util/{llm/prompt.py → markdown.py} +2 -3
- zrb/util/string/conversion.py +1 -1
- zrb/util/truncate.py +23 -0
- zrb/util/yaml.py +204 -0
- {zrb-1.13.1.dist-info → zrb-1.21.17.dist-info}/METADATA +40 -20
- {zrb-1.13.1.dist-info → zrb-1.21.17.dist-info}/RECORD +102 -79
- {zrb-1.13.1.dist-info → zrb-1.21.17.dist-info}/WHEEL +1 -1
- zrb/task/llm/default_workflow/coding.md +0 -24
- zrb/task/llm/default_workflow/copywriting.md +0 -17
- zrb/task/llm/default_workflow/researching.md +0 -18
- {zrb-1.13.1.dist-info → zrb-1.21.17.dist-info}/entry_points.txt +0 -0
zrb/util/cli/markdown.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
def render_markdown(markdown_text: str) -> str:
|
|
2
|
+
"""
|
|
3
|
+
Renders Markdown to a string, ensuring link URLs are visible.
|
|
4
|
+
"""
|
|
5
|
+
from rich.console import Console
|
|
6
|
+
from rich.markdown import Markdown
|
|
7
|
+
|
|
8
|
+
console = Console()
|
|
9
|
+
markdown = Markdown(markdown_text, hyperlinks=False)
|
|
10
|
+
with console.capture() as capture:
|
|
11
|
+
console.print(markdown)
|
|
12
|
+
return capture.get()
|
zrb/util/cli/text.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import subprocess
|
|
3
|
+
import tempfile
|
|
4
|
+
|
|
5
|
+
from zrb.util.file import read_file
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def edit_text(
|
|
9
|
+
prompt_message: str,
|
|
10
|
+
value: str,
|
|
11
|
+
editor: str = "vi",
|
|
12
|
+
extension: str = ".txt",
|
|
13
|
+
) -> str:
|
|
14
|
+
with tempfile.NamedTemporaryFile(delete=False, suffix=extension) as temp_file:
|
|
15
|
+
temp_file_name = temp_file.name
|
|
16
|
+
if prompt_message.strip() != "":
|
|
17
|
+
prompt_message_eol = f"{prompt_message}\n"
|
|
18
|
+
temp_file.write(prompt_message_eol.encode())
|
|
19
|
+
# Pre-fill with default content
|
|
20
|
+
if value:
|
|
21
|
+
temp_file.write(value.encode())
|
|
22
|
+
temp_file.flush()
|
|
23
|
+
subprocess.call([editor, temp_file_name])
|
|
24
|
+
# Read the edited content
|
|
25
|
+
edited_content = read_file(temp_file_name)
|
|
26
|
+
if prompt_message.strip() != "":
|
|
27
|
+
parts = [text.strip() for text in edited_content.split(prompt_message, 1)]
|
|
28
|
+
edited_content = "\n".join(parts).lstrip()
|
|
29
|
+
os.remove(temp_file_name)
|
|
30
|
+
return edited_content
|
zrb/util/file.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import re
|
|
3
|
+
from typing import Literal
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
def read_file(file_path: str, replace_map: dict[str, str] = {}) -> str:
|
|
@@ -14,14 +15,21 @@ def read_file(file_path: str, replace_map: dict[str, str] = {}) -> str:
|
|
|
14
15
|
"""
|
|
15
16
|
abs_file_path = os.path.abspath(os.path.expanduser(file_path))
|
|
16
17
|
is_pdf = abs_file_path.lower().endswith(".pdf")
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
try:
|
|
19
|
+
content = (
|
|
20
|
+
_read_pdf_file_content(abs_file_path)
|
|
21
|
+
if is_pdf
|
|
22
|
+
else _read_text_file_content(abs_file_path)
|
|
23
|
+
)
|
|
24
|
+
for key, val in replace_map.items():
|
|
25
|
+
content = content.replace(key, val)
|
|
26
|
+
return content
|
|
27
|
+
except Exception:
|
|
28
|
+
import base64
|
|
29
|
+
from pathlib import Path
|
|
30
|
+
|
|
31
|
+
data = Path(abs_file_path).read_bytes()
|
|
32
|
+
return base64.b64encode(data).decode("ascii")
|
|
25
33
|
|
|
26
34
|
|
|
27
35
|
def _read_text_file_content(file_path: str) -> str:
|
|
@@ -54,6 +62,8 @@ def read_file_with_line_numbers(
|
|
|
54
62
|
The content of the file with line numbers and replacements applied.
|
|
55
63
|
"""
|
|
56
64
|
content = read_file(file_path, replace_map)
|
|
65
|
+
if not content:
|
|
66
|
+
return ""
|
|
57
67
|
lines = content.splitlines()
|
|
58
68
|
numbered_lines = [f"{i + 1} | {line}" for i, line in enumerate(lines)]
|
|
59
69
|
return "\n".join(numbered_lines)
|
|
@@ -71,16 +81,22 @@ def read_dir(dir_path: str) -> list[str]:
|
|
|
71
81
|
return [f for f in os.listdir(os.path.abspath(os.path.expanduser(dir_path)))]
|
|
72
82
|
|
|
73
83
|
|
|
74
|
-
def write_file(
|
|
84
|
+
def write_file(
|
|
85
|
+
file_path: str,
|
|
86
|
+
content: str | list[str],
|
|
87
|
+
mode: Literal["w", "wt", "tw", "a", "at", "ta", "x", "xt", "tx"] = "w",
|
|
88
|
+
):
|
|
75
89
|
"""Writes content to a file.
|
|
76
90
|
|
|
77
91
|
Args:
|
|
78
92
|
file_path: The path to the file.
|
|
79
93
|
content: The content to write, either a string or a list of strings.
|
|
94
|
+
mode: Writing mode (by default "w")
|
|
80
95
|
"""
|
|
81
96
|
if isinstance(content, list):
|
|
82
97
|
content = "\n".join([line for line in content if line is not None])
|
|
83
|
-
|
|
98
|
+
abs_file_path = os.path.abspath(os.path.expanduser(file_path))
|
|
99
|
+
dir_path = os.path.dirname(abs_file_path)
|
|
84
100
|
os.makedirs(dir_path, exist_ok=True)
|
|
85
101
|
should_add_eol = content.endswith("\n")
|
|
86
102
|
# Remove trailing newlines, but keep one if the file originally ended up with newline
|
|
@@ -88,5 +104,5 @@ def write_file(file_path: str, content: str | list[str]):
|
|
|
88
104
|
content = content.rstrip("\n")
|
|
89
105
|
if should_add_eol:
|
|
90
106
|
content += "\n"
|
|
91
|
-
with open(
|
|
107
|
+
with open(abs_file_path, mode) as f:
|
|
92
108
|
f.write(content)
|
|
@@ -8,7 +8,6 @@ def _adjust_markdown_headers(md: str, level_change: int) -> str:
|
|
|
8
8
|
for line in lines:
|
|
9
9
|
stripped_line = line.strip()
|
|
10
10
|
fence_match = re.match(r"^([`~]{3,})", stripped_line)
|
|
11
|
-
|
|
12
11
|
if fence_match:
|
|
13
12
|
current_fence = fence_match.group(1)
|
|
14
13
|
if (
|
|
@@ -31,7 +30,7 @@ def _adjust_markdown_headers(md: str, level_change: int) -> str:
|
|
|
31
30
|
new_lines.append(new_header)
|
|
32
31
|
else:
|
|
33
32
|
new_lines.append(line)
|
|
34
|
-
return "\n".join(new_lines)
|
|
33
|
+
return "\n".join(new_lines).rstrip()
|
|
35
34
|
|
|
36
35
|
|
|
37
36
|
def demote_markdown_headers(md: str) -> str:
|
|
@@ -42,7 +41,7 @@ def promote_markdown_headers(md: str) -> str:
|
|
|
42
41
|
return _adjust_markdown_headers(md, level_change=-1)
|
|
43
42
|
|
|
44
43
|
|
|
45
|
-
def
|
|
44
|
+
def make_markdown_section(header: str, content: str, as_code: bool = False) -> str:
|
|
46
45
|
if content.strip() == "":
|
|
47
46
|
return ""
|
|
48
47
|
if as_code:
|
zrb/util/string/conversion.py
CHANGED
zrb/util/truncate.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from collections.abc import Mapping, Sequence
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def truncate_str(value: Any, limit: int):
|
|
6
|
+
# If value is a string, truncate
|
|
7
|
+
if isinstance(value, str):
|
|
8
|
+
if len(value) > limit:
|
|
9
|
+
if limit < 4:
|
|
10
|
+
return value[:limit]
|
|
11
|
+
return value[: limit - 4] + " ..."
|
|
12
|
+
# If value is a dict, process recursively
|
|
13
|
+
elif isinstance(value, Mapping):
|
|
14
|
+
return {k: truncate_str(v, limit) for k, v in value.items()}
|
|
15
|
+
# If value is a list or tuple, process recursively preserving type
|
|
16
|
+
elif isinstance(value, Sequence) and not isinstance(value, (str, bytes, bytearray)):
|
|
17
|
+
t = type(value)
|
|
18
|
+
return t(truncate_str(v, limit) for v in value)
|
|
19
|
+
# If value is a set, process recursively preserving type
|
|
20
|
+
elif isinstance(value, set):
|
|
21
|
+
return {truncate_str(v, limit) for v in value}
|
|
22
|
+
# Other types are returned unchanged
|
|
23
|
+
return value
|
zrb/util/yaml.py
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def yaml_dump(obj: Any, key: str = "") -> str:
|
|
5
|
+
"""
|
|
6
|
+
Convert any Python object to a YAML string representation.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
obj: Any Python object to convert to YAML
|
|
10
|
+
|
|
11
|
+
Returns:
|
|
12
|
+
str: YAML string representation of the object
|
|
13
|
+
|
|
14
|
+
Rules:
|
|
15
|
+
- Any non-first level multiline string should be rendered as block (using `|`)
|
|
16
|
+
- None values are rendered correctly (not omitted)
|
|
17
|
+
- Non-primitive/list/dict/set objects are ignored
|
|
18
|
+
"""
|
|
19
|
+
import yaml
|
|
20
|
+
|
|
21
|
+
# Process the object
|
|
22
|
+
processed_obj = _sanitize_obj(obj)
|
|
23
|
+
if key:
|
|
24
|
+
key_parts = _parse_key(key)
|
|
25
|
+
obj_to_dump = _get_obj_value(processed_obj, key_parts)
|
|
26
|
+
else:
|
|
27
|
+
obj_to_dump = processed_obj
|
|
28
|
+
# Add custom representer for multiline strings
|
|
29
|
+
yaml.add_representer(str, _multiline_string_presenter)
|
|
30
|
+
# Generate YAML
|
|
31
|
+
yaml_str = yaml.dump(
|
|
32
|
+
obj_to_dump,
|
|
33
|
+
default_flow_style=False,
|
|
34
|
+
allow_unicode=True,
|
|
35
|
+
sort_keys=False,
|
|
36
|
+
explicit_end=False,
|
|
37
|
+
width=float("inf"),
|
|
38
|
+
)
|
|
39
|
+
if not isinstance(obj_to_dump, (dict, list)):
|
|
40
|
+
# PyYAML appends '...\n' (document-end) for top-level scalars.
|
|
41
|
+
# So, we remove it.
|
|
42
|
+
if yaml_str.endswith("...\n"):
|
|
43
|
+
yaml_str = yaml_str[:-4]
|
|
44
|
+
return yaml_str
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def edit_obj(obj: Any, key: str, val: str) -> Any:
|
|
48
|
+
"""
|
|
49
|
+
Edit a property or subproperty of an object using YAML syntax.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
obj: The object to edit
|
|
53
|
+
key: The key to edit, can be nested with '.' as separator
|
|
54
|
+
val: The string value to set, will be parsed as YAML
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
Any: The modified object
|
|
58
|
+
|
|
59
|
+
Example:
|
|
60
|
+
edit({"a": {"b": 1}}, "a.b", "2") -> {"a": {"b": 2}}
|
|
61
|
+
edit({"flag": False}, "flag", "true") -> {"flag": True}
|
|
62
|
+
edit({"a": 1}, "", "2") -> 2 # Replace entire object with scalar
|
|
63
|
+
edit({"a": 1}, "", "b: 2") -> {"a": 1, "b": 2} # Patch dict if obj is dict
|
|
64
|
+
"""
|
|
65
|
+
# Parse the value using YAML rules
|
|
66
|
+
parsed_value = _load_yaml(val)
|
|
67
|
+
|
|
68
|
+
# Handle empty key - replace entire object
|
|
69
|
+
if not key:
|
|
70
|
+
if isinstance(obj, dict) and isinstance(parsed_value, dict):
|
|
71
|
+
# Patch/merge the dict values
|
|
72
|
+
return {**obj, **parsed_value}
|
|
73
|
+
# Replace entire object with parsed value
|
|
74
|
+
return parsed_value
|
|
75
|
+
|
|
76
|
+
# Split the key by dots
|
|
77
|
+
key_parts = _parse_key(key)
|
|
78
|
+
# Set the nested value
|
|
79
|
+
return _set_obj_value(obj, key_parts, parsed_value)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _sanitize_obj(obj: Any) -> Any:
|
|
83
|
+
"""Process a value for YAML conversion."""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
elif isinstance(obj, (int, float, bool, str)):
|
|
87
|
+
return obj
|
|
88
|
+
elif isinstance(obj, (list, tuple)):
|
|
89
|
+
return [_sanitize_obj(item) for item in obj if not _is_complex_obj(item)]
|
|
90
|
+
elif isinstance(obj, dict):
|
|
91
|
+
return {k: _sanitize_obj(v) for k, v in obj.items() if not _is_complex_obj(v)}
|
|
92
|
+
elif isinstance(obj, set):
|
|
93
|
+
return [
|
|
94
|
+
_sanitize_obj(item) for item in sorted(obj) if not _is_complex_obj(item)
|
|
95
|
+
]
|
|
96
|
+
else:
|
|
97
|
+
# Ignore non-primitive/list/dict/set objects
|
|
98
|
+
return None
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _is_complex_obj(obj: Any) -> bool:
|
|
102
|
+
return obj is not None and not isinstance(
|
|
103
|
+
obj, (int, float, bool, str, list, tuple, dict, set)
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def _multiline_string_presenter(dumper, data):
|
|
108
|
+
"""Custom representer for multiline strings."""
|
|
109
|
+
if "\n" in data:
|
|
110
|
+
# Clean up the string for block style
|
|
111
|
+
lines = [line.rstrip() for line in data.splitlines()]
|
|
112
|
+
clean_data = "\n".join(lines)
|
|
113
|
+
return dumper.represent_scalar("tag:yaml.org,2002:str", clean_data, style="|")
|
|
114
|
+
return dumper.represent_scalar("tag:yaml.org,2002:str", data)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def _parse_key(key: str) -> list[str]:
|
|
118
|
+
return key.split(".")
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _load_yaml(value_str: str) -> Any:
|
|
122
|
+
"""Parse a string value using YAML rules."""
|
|
123
|
+
import yaml
|
|
124
|
+
|
|
125
|
+
# Handle empty string explicitly
|
|
126
|
+
if value_str == "":
|
|
127
|
+
return ""
|
|
128
|
+
try:
|
|
129
|
+
# Use yaml.safe_load to parse the value
|
|
130
|
+
parsed = yaml.safe_load(value_str)
|
|
131
|
+
return parsed
|
|
132
|
+
except yaml.YAMLError:
|
|
133
|
+
# If YAML parsing fails, treat as string
|
|
134
|
+
return value_str
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _set_obj_value(obj: Any, keys: list[str], value: Any) -> Any:
|
|
138
|
+
"""Set a value in a nested structure."""
|
|
139
|
+
if not keys:
|
|
140
|
+
return value
|
|
141
|
+
current_key = keys[0]
|
|
142
|
+
remaining_keys = keys[1:]
|
|
143
|
+
if isinstance(obj, dict):
|
|
144
|
+
# Handle dictionary
|
|
145
|
+
if remaining_keys:
|
|
146
|
+
# There are more keys to traverse
|
|
147
|
+
if current_key not in obj:
|
|
148
|
+
obj[current_key] = {}
|
|
149
|
+
obj[current_key] = _set_obj_value(obj[current_key], remaining_keys, value)
|
|
150
|
+
else:
|
|
151
|
+
# This is the final key
|
|
152
|
+
obj[current_key] = value
|
|
153
|
+
return obj
|
|
154
|
+
elif isinstance(obj, list):
|
|
155
|
+
# Handle list - convert key to index
|
|
156
|
+
try:
|
|
157
|
+
index = int(current_key)
|
|
158
|
+
if 0 <= index < len(obj):
|
|
159
|
+
if remaining_keys:
|
|
160
|
+
obj[index] = _set_obj_value(obj[index], remaining_keys, value)
|
|
161
|
+
else:
|
|
162
|
+
obj[index] = value
|
|
163
|
+
else:
|
|
164
|
+
raise IndexError(
|
|
165
|
+
f"Index {index} out of range for list of length {len(obj)}"
|
|
166
|
+
)
|
|
167
|
+
except ValueError:
|
|
168
|
+
raise KeyError(f"Cannot use non-integer key '{current_key}' with list")
|
|
169
|
+
return obj
|
|
170
|
+
else:
|
|
171
|
+
# Handle other types by converting to dict
|
|
172
|
+
if remaining_keys:
|
|
173
|
+
# Create nested structure
|
|
174
|
+
new_obj = {current_key: _set_obj_value({}, remaining_keys, value)}
|
|
175
|
+
return new_obj
|
|
176
|
+
else:
|
|
177
|
+
# Replace the entire object
|
|
178
|
+
return {current_key: value}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def _get_obj_value(obj: Any, keys: list[str]) -> Any:
|
|
182
|
+
"""
|
|
183
|
+
Get a value from a nested structure using a list of keys.
|
|
184
|
+
Returns None if the key path does not exist.
|
|
185
|
+
"""
|
|
186
|
+
current_val = obj
|
|
187
|
+
for key in keys:
|
|
188
|
+
if isinstance(current_val, dict):
|
|
189
|
+
if key in current_val:
|
|
190
|
+
current_val = current_val[key]
|
|
191
|
+
else:
|
|
192
|
+
return None
|
|
193
|
+
elif isinstance(current_val, list):
|
|
194
|
+
try:
|
|
195
|
+
index = int(key)
|
|
196
|
+
if 0 <= index < len(current_val):
|
|
197
|
+
current_val = current_val[index]
|
|
198
|
+
else:
|
|
199
|
+
return None
|
|
200
|
+
except (ValueError, TypeError):
|
|
201
|
+
return None
|
|
202
|
+
else:
|
|
203
|
+
return None
|
|
204
|
+
return current_val
|
|
@@ -1,41 +1,61 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: zrb
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.21.17
|
|
4
4
|
Summary: Your Automation Powerhouse
|
|
5
|
-
Home-page: https://github.com/state-alchemists/zrb
|
|
6
5
|
License: AGPL-3.0-or-later
|
|
7
6
|
Keywords: Automation,Task Runner,Code Generator,Monorepo,Low Code
|
|
8
7
|
Author: Go Frendi Gunawan
|
|
9
8
|
Author-email: gofrendiasgard@gmail.com
|
|
10
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.11.0,<4.0.0
|
|
11
10
|
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
|
12
11
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
16
|
Provides-Extra: all
|
|
17
|
+
Provides-Extra: anthropic
|
|
18
|
+
Provides-Extra: bedrock
|
|
19
|
+
Provides-Extra: cohere
|
|
20
|
+
Provides-Extra: google
|
|
21
|
+
Provides-Extra: groq
|
|
22
|
+
Provides-Extra: huggingface
|
|
23
|
+
Provides-Extra: mistral
|
|
17
24
|
Provides-Extra: playwright
|
|
18
25
|
Provides-Extra: rag
|
|
19
|
-
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist:
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
Requires-Dist:
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
26
|
+
Provides-Extra: vertexai
|
|
27
|
+
Requires-Dist: anthropic (>=0.70.0) ; extra == "anthropic" or extra == "all"
|
|
28
|
+
Requires-Dist: beautifulsoup4 (>=4.14.2,<5.0.0)
|
|
29
|
+
Requires-Dist: black (>=25.11.0,<26.0.0)
|
|
30
|
+
Requires-Dist: boto3 (>=1.40.14) ; extra == "bedrock"
|
|
31
|
+
Requires-Dist: chromadb (>=1.3.5,<2.0.0) ; extra == "rag" or extra == "all"
|
|
32
|
+
Requires-Dist: cohere (>=5.18.0) ; extra == "cohere" or extra == "all"
|
|
33
|
+
Requires-Dist: fastapi[standard] (>=0.123.9,<0.124.0)
|
|
34
|
+
Requires-Dist: google-auth (>=2.36.0) ; extra == "vertexai" or extra == "all"
|
|
35
|
+
Requires-Dist: google-genai (>=1.51.0) ; extra == "google" or extra == "all"
|
|
36
|
+
Requires-Dist: groq (>=0.25.0) ; extra == "groq" or extra == "all"
|
|
37
|
+
Requires-Dist: huggingface-hub[inference] (>=0.33.5,<1.0.0) ; extra == "huggingface"
|
|
38
|
+
Requires-Dist: isort (>=7.0.0,<8.0.0)
|
|
39
|
+
Requires-Dist: libcst (>=1.8.6,<2.0.0)
|
|
40
|
+
Requires-Dist: markdownify (>=1.2.2,<2.0.0)
|
|
41
|
+
Requires-Dist: mcp (>1.18.0)
|
|
42
|
+
Requires-Dist: mistralai (>=1.9.10) ; extra == "mistral"
|
|
43
|
+
Requires-Dist: openai (>=2.8.0)
|
|
44
|
+
Requires-Dist: pdfplumber (>=0.11.7,<0.12.0)
|
|
45
|
+
Requires-Dist: playwright (>=1.56.0,<2.0.0) ; extra == "playwright" or extra == "all"
|
|
46
|
+
Requires-Dist: prompt-toolkit (>=3)
|
|
29
47
|
Requires-Dist: psutil (>=7.0.0,<8.0.0)
|
|
30
|
-
Requires-Dist: pydantic-ai (>=
|
|
48
|
+
Requires-Dist: pydantic-ai-slim (>=1.27.0,<1.28.0)
|
|
31
49
|
Requires-Dist: pyjwt (>=2.10.1,<3.0.0)
|
|
32
50
|
Requires-Dist: python-dotenv (>=1.1.1,<2.0.0)
|
|
33
|
-
Requires-Dist: python-jose[cryptography] (>=3.
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist:
|
|
36
|
-
Requires-Dist:
|
|
51
|
+
Requires-Dist: python-jose[cryptography] (>=3.5.0,<4.0.0)
|
|
52
|
+
Requires-Dist: pyyaml (>=6.0.3,<7.0.0)
|
|
53
|
+
Requires-Dist: requests (>=2.32.5,<3.0.0)
|
|
54
|
+
Requires-Dist: rich (>=13)
|
|
55
|
+
Requires-Dist: tiktoken (>=0.12.0,<0.13.0)
|
|
37
56
|
Requires-Dist: ulid-py (>=1.1.0,<2.0.0)
|
|
38
57
|
Project-URL: Documentation, https://github.com/state-alchemists/zrb
|
|
58
|
+
Project-URL: Homepage, https://github.com/state-alchemists/zrb
|
|
39
59
|
Project-URL: Repository, https://github.com/state-alchemists/zrb
|
|
40
60
|
Description-Content-Type: text/markdown
|
|
41
61
|
|