waldiez 0.3.12__py3-none-any.whl → 0.4.1__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.
Potentially problematic release.
This version of waldiez might be problematic. Click here for more details.
- waldiez/_version.py +1 -1
- waldiez/cli.py +1 -3
- waldiez/exporting/agent/agent_exporter.py +5 -1
- waldiez/exporting/agent/utils/captain_agent.py +9 -12
- waldiez/exporting/agent/utils/swarm_agent.py +12 -7
- waldiez/exporting/base/utils/comments.py +1 -0
- waldiez/exporting/chats/utils/swarm.py +1 -1
- waldiez/exporting/flow/flow_exporter.py +3 -1
- waldiez/exporting/flow/utils/__init__.py +3 -6
- waldiez/exporting/flow/utils/flow_content.py +38 -0
- waldiez/exporting/flow/utils/importing_utils.py +64 -30
- waldiez/exporting/flow/utils/logging_utils.py +25 -4
- waldiez/exporting/skills/skills_exporter.py +13 -6
- waldiez/exporting/skills/utils.py +92 -6
- waldiez/models/agents/agent/__init__.py +2 -1
- waldiez/models/agents/agent/agent.py +5 -8
- waldiez/models/agents/agent/agent_type.py +11 -0
- waldiez/models/agents/captain_agent/captain_agent.py +1 -1
- waldiez/models/agents/group_manager/speakers.py +3 -0
- waldiez/models/agents/rag_user/retrieve_config.py +3 -0
- waldiez/models/agents/reasoning/reasoning_agent_reason_config.py +1 -0
- waldiez/models/agents/swarm_agent/after_work.py +13 -11
- waldiez/models/agents/swarm_agent/on_condition.py +3 -2
- waldiez/models/agents/swarm_agent/on_condition_available.py +1 -0
- waldiez/models/agents/swarm_agent/swarm_agent_data.py +3 -3
- waldiez/models/agents/swarm_agent/update_system_message.py +1 -0
- waldiez/models/chat/chat_message.py +1 -0
- waldiez/models/chat/chat_summary.py +1 -0
- waldiez/models/common/__init__.py +2 -0
- waldiez/models/common/method_utils.py +98 -0
- waldiez/models/model/__init__.py +2 -1
- waldiez/models/model/extra_requirements.py +2 -0
- waldiez/models/model/model.py +25 -6
- waldiez/models/model/model_data.py +1 -0
- waldiez/models/skill/__init__.py +4 -0
- waldiez/models/skill/extra_requirements.py +39 -0
- waldiez/models/skill/skill.py +157 -13
- waldiez/models/skill/skill_data.py +14 -0
- waldiez/models/skill/skill_type.py +8 -0
- waldiez/models/waldiez.py +36 -6
- waldiez/runner.py +19 -7
- waldiez/running/environment.py +30 -1
- waldiez/running/running.py +0 -6
- waldiez/utils/pysqlite3_checker.py +18 -5
- {waldiez-0.3.12.dist-info → waldiez-0.4.1.dist-info}/METADATA +25 -22
- {waldiez-0.3.12.dist-info → waldiez-0.4.1.dist-info}/RECORD +50 -47
- {waldiez-0.3.12.dist-info → waldiez-0.4.1.dist-info}/WHEEL +0 -0
- {waldiez-0.3.12.dist-info → waldiez-0.4.1.dist-info}/entry_points.txt +0 -0
- {waldiez-0.3.12.dist-info → waldiez-0.4.1.dist-info}/licenses/LICENSE +0 -0
- {waldiez-0.3.12.dist-info → waldiez-0.4.1.dist-info}/licenses/NOTICE.md +0 -0
waldiez/models/skill/skill.py
CHANGED
|
@@ -2,13 +2,23 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez Skill model."""
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import json
|
|
6
|
+
import re
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any, Dict, List, Tuple, Union
|
|
6
9
|
|
|
7
10
|
from pydantic import Field, model_validator
|
|
8
11
|
from typing_extensions import Annotated, Literal, Self
|
|
9
12
|
|
|
10
|
-
from ..common import
|
|
13
|
+
from ..common import (
|
|
14
|
+
WaldiezBase,
|
|
15
|
+
gather_code_imports,
|
|
16
|
+
get_function,
|
|
17
|
+
now,
|
|
18
|
+
parse_code_string,
|
|
19
|
+
)
|
|
11
20
|
from .skill_data import WaldiezSkillData
|
|
21
|
+
from .skill_type import WaldiezSkillType
|
|
12
22
|
|
|
13
23
|
SHARED_SKILL_NAME = "waldiez_shared"
|
|
14
24
|
|
|
@@ -97,6 +107,66 @@ class WaldiezSkill(WaldiezBase):
|
|
|
97
107
|
),
|
|
98
108
|
]
|
|
99
109
|
|
|
110
|
+
@staticmethod
|
|
111
|
+
def load(data_or_path: Union[str, Path, Dict[str, Any]]) -> "WaldiezSkill":
|
|
112
|
+
"""Load a skill from a read-only file.
|
|
113
|
+
|
|
114
|
+
Parameters
|
|
115
|
+
----------
|
|
116
|
+
data_or_path : Union[str, Path, Dict[str, Any]]
|
|
117
|
+
The path to the read-only file or the loaded data.
|
|
118
|
+
|
|
119
|
+
Returns
|
|
120
|
+
-------
|
|
121
|
+
WaldiezSkill
|
|
122
|
+
The skill.
|
|
123
|
+
|
|
124
|
+
Raises
|
|
125
|
+
------
|
|
126
|
+
FileNotFoundError
|
|
127
|
+
If the file is not found.
|
|
128
|
+
ValueError
|
|
129
|
+
If the JSON is invalid or the data is invalid.
|
|
130
|
+
"""
|
|
131
|
+
if isinstance(data_or_path, dict):
|
|
132
|
+
return WaldiezSkill.model_validate(data_or_path)
|
|
133
|
+
if not isinstance(data_or_path, Path):
|
|
134
|
+
data_or_path = Path(data_or_path)
|
|
135
|
+
resolved = data_or_path.resolve()
|
|
136
|
+
if not resolved.is_file():
|
|
137
|
+
raise FileNotFoundError(f"File not found: {resolved}")
|
|
138
|
+
with resolved.open("r", encoding="utf-8") as file:
|
|
139
|
+
data_string = file.read()
|
|
140
|
+
try:
|
|
141
|
+
data_dict = json.loads(data_string)
|
|
142
|
+
except BaseException as exc: # pylint: disable=broad-except
|
|
143
|
+
raise ValueError(f"Invalid WaldiezSkill/JSON: {exc}") from exc
|
|
144
|
+
return WaldiezSkill.model_validate(data_dict)
|
|
145
|
+
|
|
146
|
+
@property
|
|
147
|
+
def skill_type(self) -> WaldiezSkillType:
|
|
148
|
+
"""Get the skill type.
|
|
149
|
+
|
|
150
|
+
Returns
|
|
151
|
+
-------
|
|
152
|
+
WaldiezSkillType
|
|
153
|
+
The type of the skill:
|
|
154
|
+
[shared, custom, langchain, crewai].
|
|
155
|
+
"""
|
|
156
|
+
return self.data.skill_type
|
|
157
|
+
|
|
158
|
+
_skill_imports: Tuple[List[str], List[str]] = ([], [])
|
|
159
|
+
|
|
160
|
+
def get_imports(self) -> Tuple[List[str], List[str]]:
|
|
161
|
+
"""Get the skill imports.
|
|
162
|
+
|
|
163
|
+
Returns
|
|
164
|
+
-------
|
|
165
|
+
Tuple[List[str], List[str]]
|
|
166
|
+
The builtin and external imports.
|
|
167
|
+
"""
|
|
168
|
+
return self._skill_imports
|
|
169
|
+
|
|
100
170
|
@property
|
|
101
171
|
def is_shared(self) -> bool:
|
|
102
172
|
"""Check if the skill is shared.
|
|
@@ -106,7 +176,18 @@ class WaldiezSkill(WaldiezBase):
|
|
|
106
176
|
bool
|
|
107
177
|
True if the skill is shared, False otherwise.
|
|
108
178
|
"""
|
|
109
|
-
return self.name == SHARED_SKILL_NAME
|
|
179
|
+
return self.skill_type == "shared" or self.name == SHARED_SKILL_NAME
|
|
180
|
+
|
|
181
|
+
@property
|
|
182
|
+
def is_interop(self) -> bool:
|
|
183
|
+
"""Check if the skill is interoperability.
|
|
184
|
+
|
|
185
|
+
Returns
|
|
186
|
+
-------
|
|
187
|
+
bool
|
|
188
|
+
True if the skill is interoperability, False otherwise.
|
|
189
|
+
"""
|
|
190
|
+
return self.skill_type in ("langchain", "crewai")
|
|
110
191
|
|
|
111
192
|
def get_content(self) -> str:
|
|
112
193
|
"""Get the content of the skill.
|
|
@@ -116,11 +197,61 @@ class WaldiezSkill(WaldiezBase):
|
|
|
116
197
|
str
|
|
117
198
|
The content of the skill.
|
|
118
199
|
"""
|
|
119
|
-
if self.
|
|
120
|
-
# the whole content (globals)
|
|
200
|
+
if self.is_shared or self.is_interop:
|
|
121
201
|
return self.data.content
|
|
202
|
+
# if custom, only the function content
|
|
122
203
|
return get_function(self.data.content, self.name)
|
|
123
204
|
|
|
205
|
+
def _validate_interop_skill(self) -> None:
|
|
206
|
+
"""Validate the interoperability skill.
|
|
207
|
+
|
|
208
|
+
Raises
|
|
209
|
+
------
|
|
210
|
+
ValueError
|
|
211
|
+
If the skill name is not in the content.
|
|
212
|
+
"""
|
|
213
|
+
if self.is_interop:
|
|
214
|
+
# we expect sth like:
|
|
215
|
+
# with single or double quotes for type={skill_type}
|
|
216
|
+
# {skill_name} = *.convert_tool(..., type="{skill_type}", ...)
|
|
217
|
+
if f"{self.name} = " not in self.data.content:
|
|
218
|
+
raise ValueError(
|
|
219
|
+
f"The skill name '{self.name}' is not in the content."
|
|
220
|
+
)
|
|
221
|
+
# we don't want the conversion to ag2 tool (we do it internally)
|
|
222
|
+
# or the skill registration (we do it after having the agent names)
|
|
223
|
+
# so no" .convert_tool(... type="...")
|
|
224
|
+
# or .register_for_llm(...), .register_for_execution(...)
|
|
225
|
+
to_exclude = [
|
|
226
|
+
r".convert_tool\(.+?type=",
|
|
227
|
+
rf"{self.name}.register_for_llm\(",
|
|
228
|
+
rf"{self.name}.register_for_execution\(",
|
|
229
|
+
]
|
|
230
|
+
for exclude in to_exclude:
|
|
231
|
+
if re.search(exclude, self.data.content):
|
|
232
|
+
raise ValueError(
|
|
233
|
+
f"Invalid skill content: '{exclude}' is not allowed."
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
def _validate_custom_skill(self) -> None:
|
|
237
|
+
"""Validate a custom skill.
|
|
238
|
+
|
|
239
|
+
Raises
|
|
240
|
+
------
|
|
241
|
+
ValueError
|
|
242
|
+
If the skill name is not in the content.
|
|
243
|
+
If the skill content is invalid.
|
|
244
|
+
"""
|
|
245
|
+
search = f"def {self.name}("
|
|
246
|
+
if self.skill_type == "custom" and not self.is_shared:
|
|
247
|
+
if search not in self.data.content:
|
|
248
|
+
raise ValueError(
|
|
249
|
+
f"The skill name '{self.name}' is not in the content."
|
|
250
|
+
)
|
|
251
|
+
error, tree = parse_code_string(self.data.content)
|
|
252
|
+
if error is not None or tree is None:
|
|
253
|
+
raise ValueError(f"Invalid skill content: {error}")
|
|
254
|
+
|
|
124
255
|
@model_validator(mode="after")
|
|
125
256
|
def validate_data(self) -> Self:
|
|
126
257
|
"""Validate the data.
|
|
@@ -136,14 +267,27 @@ class WaldiezSkill(WaldiezBase):
|
|
|
136
267
|
If the skill name is not in the content.
|
|
137
268
|
If the skill content is invalid.
|
|
138
269
|
"""
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
270
|
+
self._validate_custom_skill()
|
|
271
|
+
self._validate_interop_skill()
|
|
272
|
+
self._skill_imports = gather_code_imports(
|
|
273
|
+
self.data.content, self.is_interop
|
|
274
|
+
)
|
|
275
|
+
# remove the imports from the content
|
|
276
|
+
# we 'll place them at the top of the file
|
|
277
|
+
all_imports = self._skill_imports[0] + self._skill_imports[1]
|
|
278
|
+
code_lines = self.data.content.splitlines()
|
|
279
|
+
valid_lines = [
|
|
280
|
+
line
|
|
281
|
+
for line in code_lines
|
|
282
|
+
if not any(line.startswith(imp) for imp in all_imports)
|
|
283
|
+
]
|
|
284
|
+
# remove empty lines at the beginning and end
|
|
285
|
+
# of the content
|
|
286
|
+
while valid_lines and not valid_lines[0].strip():
|
|
287
|
+
valid_lines.pop(0)
|
|
288
|
+
while valid_lines and not valid_lines[-1].strip():
|
|
289
|
+
valid_lines.pop()
|
|
290
|
+
self.data.content = "\n".join(valid_lines)
|
|
147
291
|
return self
|
|
148
292
|
|
|
149
293
|
@property
|
|
@@ -8,6 +8,7 @@ from pydantic import Field
|
|
|
8
8
|
from typing_extensions import Annotated
|
|
9
9
|
|
|
10
10
|
from ..common import WaldiezBase
|
|
11
|
+
from .skill_type import WaldiezSkillType
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class WaldiezSkillData(WaldiezBase):
|
|
@@ -15,12 +16,25 @@ class WaldiezSkillData(WaldiezBase):
|
|
|
15
16
|
|
|
16
17
|
Attributes
|
|
17
18
|
----------
|
|
19
|
+
skill_type : WaldiezSkillType
|
|
20
|
+
The type of the skill: shared, custom, langchain, crewai.
|
|
18
21
|
content : str
|
|
19
22
|
The content (source code) of the skill.
|
|
20
23
|
secrets : Dict[str, str]
|
|
21
24
|
The secrets (environment variables) of the skill.
|
|
22
25
|
"""
|
|
23
26
|
|
|
27
|
+
skill_type: Annotated[
|
|
28
|
+
WaldiezSkillType,
|
|
29
|
+
Field(
|
|
30
|
+
"custom",
|
|
31
|
+
alias="skillType",
|
|
32
|
+
title="Skill Type",
|
|
33
|
+
description=(
|
|
34
|
+
"The type of the skill: shared, custom, langchain, crewai."
|
|
35
|
+
),
|
|
36
|
+
),
|
|
37
|
+
] = "custom"
|
|
24
38
|
content: Annotated[
|
|
25
39
|
str,
|
|
26
40
|
Field(
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0.
|
|
2
|
+
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
"""Waldiez Skill types."""
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal
|
|
6
|
+
|
|
7
|
+
WaldiezSkillType = Literal["shared", "custom", "langchain", "crewai"]
|
|
8
|
+
"""Possible types of a Waldiez Skill."""
|
waldiez/models/waldiez.py
CHANGED
|
@@ -12,15 +12,12 @@ from dataclasses import dataclass
|
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
|
14
14
|
|
|
15
|
-
from .agents import
|
|
16
|
-
WaldiezAgent,
|
|
17
|
-
get_retrievechat_extra_requirements,
|
|
18
|
-
)
|
|
15
|
+
from .agents import WaldiezAgent, get_retrievechat_extra_requirements
|
|
19
16
|
from .chat import WaldiezChat
|
|
20
17
|
from .common import get_autogen_version
|
|
21
18
|
from .flow import WaldiezFlow, get_flow_data
|
|
22
19
|
from .model import WaldiezModel, get_models_extra_requirements
|
|
23
|
-
from .skill import WaldiezSkill
|
|
20
|
+
from .skill import WaldiezSkill, get_skills_extra_requirements
|
|
24
21
|
|
|
25
22
|
|
|
26
23
|
@dataclass(frozen=True, slots=True)
|
|
@@ -155,6 +152,11 @@ class Waldiez:
|
|
|
155
152
|
"""Check if the flow has multimodal agents."""
|
|
156
153
|
return any(agent.data.is_multimodal for agent in self.agents)
|
|
157
154
|
|
|
155
|
+
@property
|
|
156
|
+
def has_captain_agents(self) -> bool:
|
|
157
|
+
"""Check if the flow has captain agents."""
|
|
158
|
+
return any(agent.agent_type == "captain" for agent in self.agents)
|
|
159
|
+
|
|
158
160
|
@property
|
|
159
161
|
def chats(self) -> List[Tuple[WaldiezChat, WaldiezAgent, WaldiezAgent]]:
|
|
160
162
|
"""Get the chats."""
|
|
@@ -243,8 +245,36 @@ class Waldiez:
|
|
|
243
245
|
requirements.update(rag_extras)
|
|
244
246
|
if self.has_multimodal_agents:
|
|
245
247
|
requirements.add(f"pyautogen[lmm]=={autogen_version}")
|
|
248
|
+
if self.has_captain_agents:
|
|
249
|
+
# pysqlite3-binary might not get installed on windows
|
|
250
|
+
captain_extras = [
|
|
251
|
+
"chromadb",
|
|
252
|
+
"sentence-transformers",
|
|
253
|
+
"huggingface-hub",
|
|
254
|
+
# tools:
|
|
255
|
+
"pillow",
|
|
256
|
+
"markdownify",
|
|
257
|
+
"arxiv",
|
|
258
|
+
"pymupdf",
|
|
259
|
+
"wikipedia-api",
|
|
260
|
+
"easyocr",
|
|
261
|
+
"python-pptx",
|
|
262
|
+
"openai-whisper",
|
|
263
|
+
"pandas",
|
|
264
|
+
"scipy",
|
|
265
|
+
]
|
|
266
|
+
requirements.update(captain_extras)
|
|
267
|
+
requirements.update(
|
|
268
|
+
get_models_extra_requirements(
|
|
269
|
+
self.models,
|
|
270
|
+
autogen_version=autogen_version,
|
|
271
|
+
)
|
|
272
|
+
)
|
|
246
273
|
requirements.update(
|
|
247
|
-
|
|
274
|
+
get_skills_extra_requirements(
|
|
275
|
+
self.skills,
|
|
276
|
+
autogen_version=autogen_version,
|
|
277
|
+
)
|
|
248
278
|
)
|
|
249
279
|
return sorted(list(requirements))
|
|
250
280
|
|
waldiez/runner.py
CHANGED
|
@@ -14,7 +14,7 @@ import sys
|
|
|
14
14
|
import tempfile
|
|
15
15
|
from pathlib import Path
|
|
16
16
|
from types import TracebackType
|
|
17
|
-
from typing import TYPE_CHECKING, Dict, List, Optional, Type, Union
|
|
17
|
+
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Type, Union
|
|
18
18
|
|
|
19
19
|
from .exporter import WaldiezExporter
|
|
20
20
|
from .models.waldiez import Waldiez
|
|
@@ -30,6 +30,7 @@ from .running import (
|
|
|
30
30
|
reset_env_vars,
|
|
31
31
|
set_env_vars,
|
|
32
32
|
)
|
|
33
|
+
from .utils import check_pysqlite3
|
|
33
34
|
|
|
34
35
|
if TYPE_CHECKING:
|
|
35
36
|
from autogen import ChatResult # type: ignore
|
|
@@ -135,13 +136,26 @@ class WaldiezRunner:
|
|
|
135
136
|
"""Get the running status."""
|
|
136
137
|
return self._running
|
|
137
138
|
|
|
139
|
+
def gather_requirements(self) -> Set[str]:
|
|
140
|
+
"""Gather extra requirements to install before running the flow.
|
|
141
|
+
|
|
142
|
+
Returns
|
|
143
|
+
-------
|
|
144
|
+
Set[str]
|
|
145
|
+
The extra requirements.
|
|
146
|
+
"""
|
|
147
|
+
extra_requirements = set(
|
|
148
|
+
req for req in self.waldiez.requirements if req not in sys.modules
|
|
149
|
+
)
|
|
150
|
+
if self.waldiez.has_captain_agents:
|
|
151
|
+
check_pysqlite3()
|
|
152
|
+
return extra_requirements
|
|
153
|
+
|
|
138
154
|
def install_requirements(self) -> None:
|
|
139
155
|
"""Install the requirements for the flow."""
|
|
140
156
|
self._called_install_requirements = True
|
|
141
157
|
printer = get_printer()
|
|
142
|
-
extra_requirements =
|
|
143
|
-
req for req in self.waldiez.requirements if req not in sys.modules
|
|
144
|
-
)
|
|
158
|
+
extra_requirements = self.gather_requirements()
|
|
145
159
|
if extra_requirements:
|
|
146
160
|
install_requirements(extra_requirements, printer)
|
|
147
161
|
refresh_environment()
|
|
@@ -150,9 +164,7 @@ class WaldiezRunner:
|
|
|
150
164
|
"""Install the requirements for the flow asynchronously."""
|
|
151
165
|
self._called_install_requirements = True
|
|
152
166
|
printer = get_printer()
|
|
153
|
-
extra_requirements =
|
|
154
|
-
req for req in self.waldiez.requirements if req not in sys.modules
|
|
155
|
-
)
|
|
167
|
+
extra_requirements = self.gather_requirements()
|
|
156
168
|
if extra_requirements:
|
|
157
169
|
await a_install_requirements(extra_requirements, printer)
|
|
158
170
|
refresh_environment()
|
waldiez/running/environment.py
CHANGED
|
@@ -8,7 +8,7 @@ import os
|
|
|
8
8
|
import site
|
|
9
9
|
import sys
|
|
10
10
|
import warnings
|
|
11
|
-
from typing import Dict, List, Tuple
|
|
11
|
+
from typing import Dict, Generator, List, Tuple
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def in_virtualenv() -> bool:
|
|
@@ -50,6 +50,35 @@ def refresh_environment() -> None:
|
|
|
50
50
|
for mod in modules_to_reload:
|
|
51
51
|
if mod not in sys.modules:
|
|
52
52
|
importlib.import_module(mod)
|
|
53
|
+
# a swarm chat without a user agent
|
|
54
|
+
# creates a new user (this has a default code execution with docker)
|
|
55
|
+
# captain also generates new agents that also have
|
|
56
|
+
# default code execution with docker
|
|
57
|
+
# temp (until we handle/detect docker setup)
|
|
58
|
+
os.environ["AUTOGEN_USE_DOCKER"] = "0"
|
|
59
|
+
# we might get:
|
|
60
|
+
# module 'numpy' has no attribute '_no_nep50_warning'
|
|
61
|
+
# in autogen/agentchat/contrib/captainagent/tool_retriever.py
|
|
62
|
+
os.environ["NEP50_DEPRECATION_WARNING"] = "0"
|
|
63
|
+
os.environ["NEP50_DISABLE_WARNING"] = "1"
|
|
64
|
+
os.environ["NPY_PROMOTION_STATE"] = "weak"
|
|
65
|
+
import numpy as np
|
|
66
|
+
|
|
67
|
+
if not hasattr(np, "_no_pep50_warning"):
|
|
68
|
+
import contextlib
|
|
69
|
+
|
|
70
|
+
@contextlib.contextmanager
|
|
71
|
+
def _np_no_nep50_warning() -> Generator[None, None, None]:
|
|
72
|
+
"""Dummy function to avoid the warning.
|
|
73
|
+
|
|
74
|
+
Yields
|
|
75
|
+
------
|
|
76
|
+
None
|
|
77
|
+
Dummy value.
|
|
78
|
+
"""
|
|
79
|
+
yield
|
|
80
|
+
|
|
81
|
+
setattr(np, "_no_pep50_warning", _np_no_nep50_warning) # noqa
|
|
53
82
|
|
|
54
83
|
|
|
55
84
|
def set_env_vars(flow_env_vars: List[Tuple[str, str]]) -> Dict[str, str]:
|
waldiez/running/running.py
CHANGED
|
@@ -91,12 +91,6 @@ def before_run(
|
|
|
91
91
|
str
|
|
92
92
|
The file name.
|
|
93
93
|
"""
|
|
94
|
-
printer = get_printer()
|
|
95
|
-
printer(
|
|
96
|
-
"Requirements installed.\n"
|
|
97
|
-
"NOTE: If new packages were added and you are using Jupyter, "
|
|
98
|
-
"you might need to restart the kernel."
|
|
99
|
-
)
|
|
100
94
|
if not uploads_root:
|
|
101
95
|
uploads_root = Path(tempfile.mkdtemp())
|
|
102
96
|
else:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
# pylint: disable=import-error
|
|
3
4
|
# flake8: noqa: E501
|
|
4
5
|
"""Try to install pysqlite3-binary.
|
|
5
6
|
|
|
@@ -205,18 +206,30 @@ def check_pysqlite3() -> None:
|
|
|
205
206
|
import pysqlite3 # type: ignore[unused-ignore, import-untyped, import-not-found] # noqa
|
|
206
207
|
except ImportError:
|
|
207
208
|
print("pysqlite3 not found or cannot be imported.")
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
if sys.platform.lower() == "linux":
|
|
210
|
+
pip_install("pysqlite3-binary")
|
|
211
|
+
else:
|
|
212
|
+
# Uninstall pysqlite3-binary if it is already installed
|
|
213
|
+
pip_uninstall("pysqlite3", "pysqlite3-binary")
|
|
214
|
+
cwd = os.getcwd()
|
|
215
|
+
tmpdir = tempfile.mkdtemp()
|
|
216
|
+
os.chdir(tmpdir)
|
|
217
|
+
source_path = download_sqlite_amalgamation()
|
|
218
|
+
install_pysqlite3(source_path)
|
|
219
|
+
os.chdir(cwd)
|
|
220
|
+
shutil.rmtree(tmpdir)
|
|
212
221
|
site.main()
|
|
213
222
|
# Re-import pysqlite3 as sqlite3
|
|
214
223
|
import pysqlite3 # type: ignore[unused-ignore, import-untyped, import-not-found] # noqa
|
|
215
224
|
|
|
225
|
+
sys.modules["sqlite3"] = sys.modules["pysqlite3"]
|
|
226
|
+
|
|
216
227
|
|
|
217
228
|
def test_sqlite_usage() -> None:
|
|
218
229
|
"""Test the usage of the sqlite3 module."""
|
|
219
|
-
# pylint: disable=import-outside-toplevel
|
|
230
|
+
# pylint: disable=import-outside-toplevel, unused-import, line-too-long
|
|
231
|
+
import pysqlite3 # type: ignore[unused-ignore, import-untyped, import-not-found] # noqa
|
|
232
|
+
|
|
220
233
|
sys.modules["sqlite3"] = sys.modules.pop("pysqlite3")
|
|
221
234
|
import sqlite3 # noqa
|
|
222
235
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: waldiez
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: waldiez
|
|
5
5
|
Project-URL: homepage, https://waldiez.github.io/waldiez/python
|
|
6
6
|
Project-URL: repository, https://github.com/waldiez/python.git
|
|
@@ -25,9 +25,10 @@ Requires-Dist: asyncer==0.0.8
|
|
|
25
25
|
Requires-Dist: graphviz==0.20.3
|
|
26
26
|
Requires-Dist: httpx<1
|
|
27
27
|
Requires-Dist: jupytext
|
|
28
|
+
Requires-Dist: numpy<2.2.0
|
|
28
29
|
Requires-Dist: pandas>=2
|
|
29
30
|
Requires-Dist: parso==0.8.4
|
|
30
|
-
Requires-Dist: pyautogen==0.7.
|
|
31
|
+
Requires-Dist: pyautogen==0.7.4
|
|
31
32
|
Requires-Dist: pydantic<3,>=2.6.1
|
|
32
33
|
Requires-Dist: typer<0.16,>=0.9
|
|
33
34
|
Provides-Extra: ag2-extras
|
|
@@ -44,36 +45,38 @@ Requires-Dist: pgvector>=0.3.6; extra == 'ag2-extras'
|
|
|
44
45
|
Requires-Dist: protobuf>=4.25.3; extra == 'ag2-extras'
|
|
45
46
|
Requires-Dist: psycopg[binary]>=3.2.3; extra == 'ag2-extras'
|
|
46
47
|
Requires-Dist: psycopg[binary]>=3.2.4; extra == 'ag2-extras'
|
|
47
|
-
Requires-Dist: pyautogen[anthropic]==0.7.
|
|
48
|
-
Requires-Dist: pyautogen[bedrock]==0.7.
|
|
49
|
-
Requires-Dist: pyautogen[cohere]==0.7.
|
|
50
|
-
Requires-Dist: pyautogen[gemini]==0.7.
|
|
51
|
-
Requires-Dist: pyautogen[groq]==0.7.
|
|
52
|
-
Requires-Dist: pyautogen[
|
|
53
|
-
Requires-Dist: pyautogen[
|
|
54
|
-
Requires-Dist: pyautogen[
|
|
55
|
-
Requires-Dist: pyautogen[
|
|
56
|
-
Requires-Dist: pyautogen[
|
|
57
|
-
Requires-Dist: pyautogen[
|
|
58
|
-
Requires-Dist:
|
|
48
|
+
Requires-Dist: pyautogen[anthropic]==0.7.4; extra == 'ag2-extras'
|
|
49
|
+
Requires-Dist: pyautogen[bedrock]==0.7.4; extra == 'ag2-extras'
|
|
50
|
+
Requires-Dist: pyautogen[cohere]==0.7.4; extra == 'ag2-extras'
|
|
51
|
+
Requires-Dist: pyautogen[gemini]==0.7.4; extra == 'ag2-extras'
|
|
52
|
+
Requires-Dist: pyautogen[groq]==0.7.4; extra == 'ag2-extras'
|
|
53
|
+
Requires-Dist: pyautogen[interop-crewai]==0.7.4; extra == 'ag2-extras'
|
|
54
|
+
Requires-Dist: pyautogen[interop-langchain]==0.7.4; extra == 'ag2-extras'
|
|
55
|
+
Requires-Dist: pyautogen[lmm]==0.7.4; extra == 'ag2-extras'
|
|
56
|
+
Requires-Dist: pyautogen[mistral]==0.7.4; extra == 'ag2-extras'
|
|
57
|
+
Requires-Dist: pyautogen[neo4j]==0.7.4; extra == 'ag2-extras'
|
|
58
|
+
Requires-Dist: pyautogen[ollama]==0.7.4; extra == 'ag2-extras'
|
|
59
|
+
Requires-Dist: pyautogen[together]==0.7.4; extra == 'ag2-extras'
|
|
60
|
+
Requires-Dist: pyautogen[websurfer]==0.7.4; extra == 'ag2-extras'
|
|
61
|
+
Requires-Dist: pydantic-ai>=0.0.21; extra == 'ag2-extras'
|
|
59
62
|
Requires-Dist: pymongo>=4.11; extra == 'ag2-extras'
|
|
60
63
|
Requires-Dist: pypdf; extra == 'ag2-extras'
|
|
61
64
|
Requires-Dist: qdrant-client[fastembed]; extra == 'ag2-extras'
|
|
62
65
|
Requires-Dist: sentence-transformers; extra == 'ag2-extras'
|
|
63
|
-
Requires-Dist: weaviate-client
|
|
66
|
+
Requires-Dist: weaviate-client>=4.10.2; extra == 'ag2-extras'
|
|
64
67
|
Provides-Extra: dev
|
|
65
68
|
Requires-Dist: autoflake==2.3.1; extra == 'dev'
|
|
66
69
|
Requires-Dist: bandit==1.8.2; extra == 'dev'
|
|
67
70
|
Requires-Dist: black[jupyter]==25.1.0; extra == 'dev'
|
|
68
71
|
Requires-Dist: flake8==7.1.1; extra == 'dev'
|
|
69
72
|
Requires-Dist: isort==6.0.0; extra == 'dev'
|
|
70
|
-
Requires-Dist: mypy==1.
|
|
73
|
+
Requires-Dist: mypy==1.15.0; extra == 'dev'
|
|
71
74
|
Requires-Dist: pandas-stubs; extra == 'dev'
|
|
72
75
|
Requires-Dist: pre-commit==4.1.0; extra == 'dev'
|
|
73
76
|
Requires-Dist: pydocstyle==6.3.0; extra == 'dev'
|
|
74
77
|
Requires-Dist: pylint==3.3.4; extra == 'dev'
|
|
75
78
|
Requires-Dist: python-dotenv==1.0.1; extra == 'dev'
|
|
76
|
-
Requires-Dist: ruff==0.9.
|
|
79
|
+
Requires-Dist: ruff==0.9.6; extra == 'dev'
|
|
77
80
|
Requires-Dist: toml; (python_version <= '3.10') and extra == 'dev'
|
|
78
81
|
Requires-Dist: types-pyyaml==6.0.12.20241230; extra == 'dev'
|
|
79
82
|
Requires-Dist: types-toml==0.10.8.20240310; extra == 'dev'
|
|
@@ -83,16 +86,16 @@ Requires-Dist: mdx-include==1.4.2; extra == 'docs'
|
|
|
83
86
|
Requires-Dist: mdx-truly-sane-lists==1.3; extra == 'docs'
|
|
84
87
|
Requires-Dist: mkdocs-jupyter==0.25.1; extra == 'docs'
|
|
85
88
|
Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == 'docs'
|
|
86
|
-
Requires-Dist: mkdocs-material==9.6.
|
|
89
|
+
Requires-Dist: mkdocs-material==9.6.4; extra == 'docs'
|
|
87
90
|
Requires-Dist: mkdocs-minify-html-plugin==0.2.4; extra == 'docs'
|
|
88
91
|
Requires-Dist: mkdocs==1.6.1; extra == 'docs'
|
|
89
|
-
Requires-Dist: mkdocstrings-python==1.
|
|
90
|
-
Requires-Dist: mkdocstrings[crystal,python]==0.28.
|
|
92
|
+
Requires-Dist: mkdocstrings-python==1.15.0; extra == 'docs'
|
|
93
|
+
Requires-Dist: mkdocstrings[crystal,python]==0.28.1; extra == 'docs'
|
|
91
94
|
Provides-Extra: jupyter
|
|
92
95
|
Requires-Dist: jupyterlab>=4.3.0; extra == 'jupyter'
|
|
93
|
-
Requires-Dist: waldiez-jupyter==0.
|
|
96
|
+
Requires-Dist: waldiez-jupyter==0.4.1; extra == 'jupyter'
|
|
94
97
|
Provides-Extra: studio
|
|
95
|
-
Requires-Dist: waldiez-studio==0.
|
|
98
|
+
Requires-Dist: waldiez-studio==0.4.1; extra == 'studio'
|
|
96
99
|
Provides-Extra: test
|
|
97
100
|
Requires-Dist: pytest-asyncio==0.25.3; extra == 'test'
|
|
98
101
|
Requires-Dist: pytest-cov==6.0.0; extra == 'test'
|