waldiez 0.1.6__tar.gz → 0.1.7__tar.gz

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.

Files changed (95) hide show
  1. {waldiez-0.1.6 → waldiez-0.1.7}/PKG-INFO +40 -11
  2. {waldiez-0.1.6 → waldiez-0.1.7}/README.md +32 -3
  3. {waldiez-0.1.6 → waldiez-0.1.7}/pyproject.toml +17 -9
  4. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/__init__.py +0 -2
  5. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/_version.py +1 -1
  6. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/cli.py +10 -6
  7. {waldiez-0.1.6/waldiez → waldiez-0.1.7/waldiez/io}/stream/provider.py +5 -1
  8. {waldiez-0.1.6/waldiez → waldiez-0.1.7/waldiez/io}/stream/server.py +50 -24
  9. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/waldiez.py +13 -3
  10. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/runner.py +24 -10
  11. {waldiez-0.1.6 → waldiez-0.1.7}/.gitignore +0 -0
  12. {waldiez-0.1.6 → waldiez-0.1.7}/LICENSE +0 -0
  13. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/__main__.py +0 -0
  14. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporter.py +0 -0
  15. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/__init__.py +0 -0
  16. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/__init__.py +0 -0
  17. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/agent.py +0 -0
  18. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/agent_skills.py +0 -0
  19. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/code_execution.py +0 -0
  20. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/group_manager.py +0 -0
  21. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/llm_config.py +0 -0
  22. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/rag_user/__init__.py +0 -0
  23. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/rag_user/chroma_utils.py +0 -0
  24. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/rag_user/mongo_utils.py +0 -0
  25. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/rag_user/pgvector_utils.py +0 -0
  26. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/rag_user/qdrant_utils.py +0 -0
  27. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/rag_user/rag_user.py +0 -0
  28. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/rag_user/vector_db.py +0 -0
  29. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/teachability.py +0 -0
  30. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/agents/termination_message.py +0 -0
  31. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/chats/__init__.py +0 -0
  32. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/chats/chats.py +0 -0
  33. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/chats/helpers.py +0 -0
  34. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/chats/nested.py +0 -0
  35. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/flow/__init__.py +0 -0
  36. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/flow/def_main.py +0 -0
  37. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/flow/flow.py +0 -0
  38. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/models/__init__.py +0 -0
  39. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/skills/__init__.py +0 -0
  40. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/utils/__init__.py +0 -0
  41. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/utils/comments.py +0 -0
  42. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/utils/importing.py +0 -0
  43. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/utils/logging_utils.py +0 -0
  44. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/utils/method_utils.py +0 -0
  45. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/utils/naming.py +0 -0
  46. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/utils/object_string.py +0 -0
  47. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/exporting/utils/path_check.py +0 -0
  48. /waldiez-0.1.6/waldiez/io_stream.py → /waldiez-0.1.7/waldiez/io/__init__.py +0 -0
  49. {waldiez-0.1.6/waldiez → waldiez-0.1.7/waldiez/io}/stream/__init__.py +0 -0
  50. {waldiez-0.1.6/waldiez → waldiez-0.1.7/waldiez/io}/stream/consumer.py +0 -0
  51. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/__init__.py +0 -0
  52. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/__init__.py +0 -0
  53. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/agent/__init__.py +0 -0
  54. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/agent/agent.py +0 -0
  55. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/agent/agent_data.py +0 -0
  56. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/agent/code_execution.py +0 -0
  57. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/agent/linked_skill.py +0 -0
  58. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/agent/nested_chat.py +0 -0
  59. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/agent/teachability.py +0 -0
  60. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/agent/termination_message.py +0 -0
  61. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/agents.py +0 -0
  62. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/assistant/__init__.py +0 -0
  63. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/assistant/assistant.py +0 -0
  64. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/assistant/assistant_data.py +0 -0
  65. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/group_manager/__init__.py +0 -0
  66. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/group_manager/group_manager.py +0 -0
  67. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/group_manager/group_manager_data.py +0 -0
  68. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/group_manager/speakers.py +0 -0
  69. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/rag_user/__init__.py +0 -0
  70. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/rag_user/rag_user.py +0 -0
  71. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/rag_user/rag_user_data.py +0 -0
  72. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/rag_user/retrieve_config.py +0 -0
  73. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/rag_user/vector_db_config.py +0 -0
  74. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/user_proxy/__init__.py +0 -0
  75. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/user_proxy/user_proxy.py +0 -0
  76. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/agents/user_proxy/user_proxy_data.py +0 -0
  77. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/chat/__init__.py +0 -0
  78. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/chat/chat.py +0 -0
  79. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/chat/chat_data.py +0 -0
  80. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/chat/chat_message.py +0 -0
  81. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/chat/chat_nested.py +0 -0
  82. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/chat/chat_summary.py +0 -0
  83. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/common/__init__.py +0 -0
  84. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/common/base.py +0 -0
  85. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/common/method_utils.py +0 -0
  86. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/flow/__init__.py +0 -0
  87. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/flow/flow.py +0 -0
  88. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/flow/flow_data.py +0 -0
  89. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/model/__init__.py +0 -0
  90. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/model/model.py +0 -0
  91. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/model/model_data.py +0 -0
  92. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/skill/__init__.py +0 -0
  93. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/skill/skill.py +0 -0
  94. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/models/skill/skill_data.py +0 -0
  95. {waldiez-0.1.6 → waldiez-0.1.7}/waldiez/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: waldiez
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: waldiez
5
5
  Project-URL: homepage, https://waldiez.github.io/py/
6
6
  Project-URL: repository, https://github.com/waldiez/py.git
@@ -33,12 +33,12 @@ Requires-Dist: autogen-agentchat[retrievechat-qdrant]==0.2.37; extra == 'autogen
33
33
  Requires-Dist: autogen-agentchat[retrievechat]==0.2.37; extra == 'autogen-extras'
34
34
  Requires-Dist: autogen-agentchat[together]==0.2.37; extra == 'autogen-extras'
35
35
  Requires-Dist: autogen-agentchat[websurfer]==0.2.37; extra == 'autogen-extras'
36
- Requires-Dist: chromadb==0.5.15; extra == 'autogen-extras'
36
+ Requires-Dist: chromadb==0.5.17; extra == 'autogen-extras'
37
37
  Requires-Dist: fastembed==0.4.1; extra == 'autogen-extras'
38
- Requires-Dist: pgvector==0.3.5; extra == 'autogen-extras'
38
+ Requires-Dist: pgvector==0.3.6; extra == 'autogen-extras'
39
39
  Requires-Dist: psycopg[binary]>=3.2.3; extra == 'autogen-extras'
40
40
  Requires-Dist: pymongo==4.10.1; extra == 'autogen-extras'
41
- Requires-Dist: qdrant-client==1.12.0; extra == 'autogen-extras'
41
+ Requires-Dist: qdrant-client==1.12.1; extra == 'autogen-extras'
42
42
  Provides-Extra: dev
43
43
  Requires-Dist: autoflake==2.3.1; extra == 'dev'
44
44
  Requires-Dist: bandit==1.7.10; extra == 'dev'
@@ -50,21 +50,21 @@ Requires-Dist: pre-commit==4.0.1; extra == 'dev'
50
50
  Requires-Dist: pydocstyle==6.3.0; extra == 'dev'
51
51
  Requires-Dist: pylint==3.3.1; extra == 'dev'
52
52
  Requires-Dist: python-dotenv==1.0.1; extra == 'dev'
53
- Requires-Dist: ruff==0.7.1; extra == 'dev'
53
+ Requires-Dist: ruff==0.7.2; extra == 'dev'
54
54
  Requires-Dist: types-pyyaml==6.0.12; extra == 'dev'
55
55
  Requires-Dist: yamllint==1.35.1; extra == 'dev'
56
56
  Provides-Extra: docs
57
57
  Requires-Dist: mdx-include==1.4.2; extra == 'docs'
58
58
  Requires-Dist: mdx-truly-sane-lists==1.3; extra == 'docs'
59
59
  Requires-Dist: mkdocs-jupyter==0.25.1; extra == 'docs'
60
- Requires-Dist: mkdocs-macros-plugin==1.3.6; extra == 'docs'
61
- Requires-Dist: mkdocs-material==9.5.42; extra == 'docs'
60
+ Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == 'docs'
61
+ Requires-Dist: mkdocs-material==9.5.43; extra == 'docs'
62
62
  Requires-Dist: mkdocs-minify-html-plugin==0.2.3; extra == 'docs'
63
63
  Requires-Dist: mkdocs==1.6.1; extra == 'docs'
64
64
  Requires-Dist: mkdocstrings-python==1.12.2; extra == 'docs'
65
65
  Requires-Dist: mkdocstrings[crystal,python]==0.26.2; extra == 'docs'
66
66
  Provides-Extra: test
67
- Requires-Dist: pytest-cov==5.0.0; extra == 'test'
67
+ Requires-Dist: pytest-cov==6.0.0; extra == 'test'
68
68
  Requires-Dist: pytest-html==4.1.1; extra == 'test'
69
69
  Requires-Dist: pytest-sugar==1.0.0; extra == 'test'
70
70
  Requires-Dist: pytest-timeout==2.3.1; extra == 'test'
@@ -109,9 +109,37 @@ python -m pip install git+https://github.com/waldiez/py.git
109
109
 
110
110
  ```bash
111
111
  # Export a Waldiez flow to a python script or a jupyter notebook
112
- waldiez --export /path/to/a/flow.waldiez --output /path/to/an/output[.py|.ipynb]
112
+ waldiez --export /path/to/a/flow.waldiez --output /path/to/an/output/flow[.py|.ipynb]
113
113
  # Export and run the script, optionally force generation if the output file already exists
114
- waldiez /path/to/a/flow.waldiez --output /path/to/an/output[.py] [--force]
114
+ waldiez /path/to/a/flow.waldiez --output /path/to/an/output/flow[.py] [--force]
115
+ ```
116
+
117
+ ### Using docker/podman
118
+
119
+ ```shell
120
+ CONTAINER_COMMAND=docker # or podman
121
+ # pull the image
122
+ $CONTAINER_COMMAND pull waldiez/py
123
+ # Export a Waldiez flow to a python script or a jupyter notebook
124
+ $CONTAINER_COMMAND run \
125
+ --rm \
126
+ -v /path/to/a/flow.waldiez:/flow.waldiez \
127
+ -v /path/to/an/output:/output \
128
+ waldiez/py --export /flow.waldiez --output /output/flow[.py|.ipynb]
129
+
130
+ # with selinux and/or podman, you might get permission (or file not found) errors, so you can try:
131
+ $CONTAINER_COMMAND run \
132
+ --rm \
133
+ -v /path/to/a/flow.waldiez:/flow.waldiez \
134
+ -v /path/to/an/output:/output \
135
+ --userns=keep-id \
136
+ --security-opt label=disable \
137
+ waldiez/py --export /flow.waldiez --output /output/flow[.py|.ipynb]
138
+ ```
139
+
140
+ ```shell
141
+ # Export and run the script
142
+ $CONTAINER_COMMAND run --rm -v /path/to/a/flow.waldiez:/flow.waldiez -v /path/to/an/output:/output waldiez/py /flow.waldiez --output /output/output[.py]
115
143
  ```
116
144
 
117
145
  ### As a library
@@ -142,7 +170,8 @@ runner.run(output_path=output_path)
142
170
 
143
171
  ```python
144
172
  # Run the flow with a custom IOStream
145
- from waldiez import WaldiezIOStream, WaldiezRunner
173
+ from waldiez import WaldiezRunner
174
+ from waldiez.io import WaldiezIOStream
146
175
 
147
176
  flow_path = "/path/to/a/flow.waldiez"
148
177
  output_path = "/path/to/an/output.py"
@@ -35,9 +35,37 @@ python -m pip install git+https://github.com/waldiez/py.git
35
35
 
36
36
  ```bash
37
37
  # Export a Waldiez flow to a python script or a jupyter notebook
38
- waldiez --export /path/to/a/flow.waldiez --output /path/to/an/output[.py|.ipynb]
38
+ waldiez --export /path/to/a/flow.waldiez --output /path/to/an/output/flow[.py|.ipynb]
39
39
  # Export and run the script, optionally force generation if the output file already exists
40
- waldiez /path/to/a/flow.waldiez --output /path/to/an/output[.py] [--force]
40
+ waldiez /path/to/a/flow.waldiez --output /path/to/an/output/flow[.py] [--force]
41
+ ```
42
+
43
+ ### Using docker/podman
44
+
45
+ ```shell
46
+ CONTAINER_COMMAND=docker # or podman
47
+ # pull the image
48
+ $CONTAINER_COMMAND pull waldiez/py
49
+ # Export a Waldiez flow to a python script or a jupyter notebook
50
+ $CONTAINER_COMMAND run \
51
+ --rm \
52
+ -v /path/to/a/flow.waldiez:/flow.waldiez \
53
+ -v /path/to/an/output:/output \
54
+ waldiez/py --export /flow.waldiez --output /output/flow[.py|.ipynb]
55
+
56
+ # with selinux and/or podman, you might get permission (or file not found) errors, so you can try:
57
+ $CONTAINER_COMMAND run \
58
+ --rm \
59
+ -v /path/to/a/flow.waldiez:/flow.waldiez \
60
+ -v /path/to/an/output:/output \
61
+ --userns=keep-id \
62
+ --security-opt label=disable \
63
+ waldiez/py --export /flow.waldiez --output /output/flow[.py|.ipynb]
64
+ ```
65
+
66
+ ```shell
67
+ # Export and run the script
68
+ $CONTAINER_COMMAND run --rm -v /path/to/a/flow.waldiez:/flow.waldiez -v /path/to/an/output:/output waldiez/py /flow.waldiez --output /output/output[.py]
41
69
  ```
42
70
 
43
71
  ### As a library
@@ -68,7 +96,8 @@ runner.run(output_path=output_path)
68
96
 
69
97
  ```python
70
98
  # Run the flow with a custom IOStream
71
- from waldiez import WaldiezIOStream, WaldiezRunner
99
+ from waldiez import WaldiezRunner
100
+ from waldiez.io import WaldiezIOStream
72
101
 
73
102
  flow_path = "/path/to/a/flow.waldiez"
74
103
  output_path = "/path/to/an/output.py"
@@ -50,14 +50,14 @@ dev = [
50
50
  'pydocstyle==6.3.0',
51
51
  'pylint==3.3.1',
52
52
  'python-dotenv==1.0.1',
53
- 'ruff==0.7.1',
53
+ 'ruff==0.7.2',
54
54
  'types-PyYAML==6.0.12',
55
55
  'yamllint==1.35.1',
56
56
  ]
57
57
  autogen_extras =[
58
- 'chromadb==0.5.15',
58
+ 'chromadb==0.5.17',
59
59
  'fastembed==0.4.1',
60
- 'pgvector==0.3.5',
60
+ 'pgvector==0.3.6',
61
61
  'psycopg[binary]>=3.2.3',
62
62
  'autogen-agentchat[retrievechat]==0.2.37',
63
63
  'autogen-agentchat[retrievechat-pgvector]==0.2.37',
@@ -72,11 +72,11 @@ autogen_extras =[
72
72
  'autogen-agentchat[bedrock]==0.2.37',
73
73
  'autogen-agentchat[websurfer]==0.2.37',
74
74
  'pymongo==4.10.1',
75
- 'qdrant-client==1.12.0',
75
+ 'qdrant-client==1.12.1',
76
76
  ]
77
77
  test = [
78
78
  'pytest==8.3.3',
79
- 'pytest-cov==5.0.0',
79
+ 'pytest-cov==6.0.0',
80
80
  'pytest-html==4.1.1',
81
81
  'pytest-sugar==1.0.0',
82
82
  'pytest-timeout==2.3.1',
@@ -87,8 +87,8 @@ docs = [
87
87
  'mdx_truly_sane_lists==1.3',
88
88
  'mkdocs==1.6.1',
89
89
  'mkdocs-jupyter==0.25.1',
90
- 'mkdocs-macros-plugin==1.3.6',
91
- 'mkdocs-material==9.5.42',
90
+ 'mkdocs-macros-plugin==1.3.7',
91
+ 'mkdocs-material==9.5.43',
92
92
  'mkdocs-minify-html-plugin==0.2.3',
93
93
  'mkdocstrings[crystal,python]==0.26.2',
94
94
  'mkdocstrings-python==1.12.2'
@@ -271,7 +271,15 @@ line-ending = "lf"
271
271
 
272
272
  # pytest
273
273
  [tool.pytest.ini_options]
274
- # filterwarnings = []
274
+ filterwarnings = [
275
+ # DeprecationWarning:
276
+ # Type google._upb._message.MessageMapContainer uses PyType_Spec with a metaclass that has custom tp_new.
277
+ # This is deprecated and will no longer be allowed in Python 3.14.
278
+ #
279
+ # autogen/logger/logger_utils.py:9: DeprecationWarning:
280
+ # datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version
281
+ "ignore::DeprecationWarning",
282
+ ]
275
283
  python_files = [
276
284
  "tests.py",
277
285
  "test_*.py",
@@ -283,7 +291,7 @@ addopts = """
283
291
  --exitfirst \
284
292
  --durations=10 \
285
293
  --color=yes \
286
- --timeout=30
294
+ --timeout=60
287
295
  """
288
296
 
289
297
 
@@ -2,14 +2,12 @@
2
2
 
3
3
  from ._version import __version__
4
4
  from .exporter import WaldiezExporter
5
- from .io_stream import WaldiezIOStream
6
5
  from .models import Waldiez
7
6
  from .runner import WaldiezRunner
8
7
 
9
8
  __all__ = [
10
9
  "Waldiez",
11
10
  "WaldiezExporter",
12
- "WaldiezIOStream",
13
11
  "WaldiezRunner",
14
12
  "__version__",
15
13
  ]
@@ -1,3 +1,3 @@
1
1
  """Version information for Waldiez."""
2
2
 
3
- __version__ = "0.1.6"
3
+ __version__ = "0.1.7"
@@ -6,14 +6,15 @@ import logging
6
6
  import os
7
7
  import sys
8
8
  from pathlib import Path
9
- from typing import Any, Dict, Optional
10
-
11
- from autogen import ChatResult # type: ignore[import-untyped]
9
+ from typing import TYPE_CHECKING, Any, Dict, Optional
12
10
 
13
11
  from . import Waldiez, __version__
14
12
  from .exporter import WaldiezExporter
15
13
  from .runner import WaldiezRunner
16
14
 
15
+ if TYPE_CHECKING:
16
+ from autogen import ChatResult # type: ignore[import-untyped]
17
+
17
18
 
18
19
  def get_parser() -> argparse.ArgumentParser:
19
20
  """Get the argument parser for the Waldiez package.
@@ -28,7 +29,7 @@ def get_parser() -> argparse.ArgumentParser:
28
29
  prog="waldiez",
29
30
  )
30
31
  parser.add_argument(
31
- "waldiez",
32
+ "file",
32
33
  type=str,
33
34
  help="Path to the Waldiez flow (*.waldiez) file.",
34
35
  )
@@ -66,7 +67,7 @@ def get_parser() -> argparse.ArgumentParser:
66
67
  return parser
67
68
 
68
69
 
69
- def _log_result(result: ChatResult) -> None:
70
+ def _log_result(result: "ChatResult") -> None:
70
71
  """Log the result of the Waldiez flow."""
71
72
  logger = logging.getLogger("waldiez::cli")
72
73
  logger.info("Chat History:\n")
@@ -94,9 +95,12 @@ def _run(data: Dict[str, Any], output_path: Optional[str]) -> None:
94
95
  def main() -> None:
95
96
  """Parse the command line arguments and run the Waldiez flow."""
96
97
  parser = get_parser()
98
+ if len(sys.argv) == 1:
99
+ parser.print_help()
100
+ sys.exit(0)
97
101
  args = parser.parse_args()
98
102
  logger = _get_logger()
99
- waldiez_file: str = args.waldiez
103
+ waldiez_file: str = args.file
100
104
  if not os.path.exists(waldiez_file):
101
105
  logger.error("File not found: %s", waldiez_file)
102
106
  sys.exit(1)
@@ -185,7 +185,11 @@ class InputProviderWrapper:
185
185
  """Stop the provider."""
186
186
  if self.thread:
187
187
  self.thread.running = False
188
- self.thread.join(timeout=1)
188
+ try:
189
+ self.thread.socket.close()
190
+ except OSError: # pragma: no cover
191
+ pass
192
+ self.thread.join(timeout=0)
189
193
  del self.thread
190
194
  self.thread = None
191
195
 
@@ -7,6 +7,7 @@ and forwards messages between them.
7
7
  # pylint: disable=import-outside-toplevel,no-member,reimported,unused-import,redefined-outer-name,invalid-name # noqa
8
8
  import logging
9
9
  import sys
10
+ import time
10
11
  from threading import Thread
11
12
  from types import TracebackType
12
13
  from typing import Dict, Optional, Type, cast
@@ -179,7 +180,6 @@ class TCPServerThread(Thread):
179
180
  self,
180
181
  interface: str,
181
182
  port: int,
182
- timeout: Optional[float] = None,
183
183
  ) -> None:
184
184
  """Create a new TCP server.
185
185
 
@@ -189,33 +189,53 @@ class TCPServerThread(Thread):
189
189
  Interface to listen on. Defaults to '' (all interfaces)
190
190
  port : int
191
191
  Port to listen on.
192
- timeout : Optional[float]
193
- Timeout for the server.
194
192
  """
195
193
  super().__init__(
196
194
  name="TCPServerThread",
197
- daemon=True,
195
+ daemon=False,
198
196
  target=self.run,
199
197
  )
200
- from twisted.internet.endpoints import TCP4ServerEndpoint
201
-
202
- self.timeout = timeout
203
198
  self.reactor = get_reactor()
204
199
  self._port = port
205
- endpoint = TCP4ServerEndpoint( # type: ignore[no-untyped-call]
200
+ self._interface = interface
201
+ self._initialize()
202
+
203
+ def _initialize(self) -> None:
204
+ """Initialize the server."""
205
+ from twisted.internet.endpoints import TCP4ServerEndpoint
206
+
207
+ self.endpoint = TCP4ServerEndpoint( # type: ignore[no-untyped-call]
206
208
  self.reactor,
207
- port,
208
- interface=interface,
209
+ self._port,
210
+ interface=self._interface,
209
211
  )
210
212
  server_factory = ServerFactory()
211
- deferred = endpoint.listen(server_factory) # type: ignore
213
+ deferred = self.endpoint.listen(server_factory) # type: ignore
212
214
  deferred.addCallback(callback=self.on_start)
215
+ deferred.addErrback(errback=self.on_error)
213
216
 
214
217
  @property
215
218
  def port(self) -> int:
216
219
  """Get the port."""
217
220
  return self._port
218
221
 
222
+ def on_error(self, failure: Failure) -> None: # pragma: no cover
223
+ """On error callback.
224
+
225
+ Parameters
226
+ ----------
227
+ failure : Failure
228
+ The failure.
229
+
230
+ Raises
231
+ ------
232
+ RuntimeError
233
+ If the failure is not handled.
234
+ """
235
+ LOGGER.error(failure.getErrorMessage())
236
+ del self.endpoint
237
+ self._initialize()
238
+
219
239
  def on_start(self, port: Port) -> None:
220
240
  """On connect callback.
221
241
 
@@ -257,12 +277,7 @@ class ServerWrapper:
257
277
  server: TCPServerThread
258
278
  timeout: float
259
279
 
260
- def __init__(
261
- self,
262
- interface: str,
263
- port: int,
264
- timeout: Optional[float] = None,
265
- ) -> None:
280
+ def __init__(self, interface: str, port: int) -> None:
266
281
  """Create a new TCP server.
267
282
 
268
283
  Parameters
@@ -272,10 +287,21 @@ class ServerWrapper:
272
287
  port : int
273
288
  Port to listen on.
274
289
  """
275
- self.timeout = timeout if timeout is not None else 0.2
290
+ self._interface = interface
291
+ self._port = port
292
+ self._init_server()
293
+
294
+ def _init_server(self) -> None:
295
+ """Initialize the server."""
276
296
  self.server = TCPServerThread(
277
- interface=interface, port=port, timeout=self.timeout
297
+ interface=self._interface, port=self._port
278
298
  )
299
+ retries = 0
300
+ while self.server.factory is None and retries < 30: # pragma: no cover
301
+ retries += 1
302
+ time.sleep(1)
303
+ if self.server.factory is None: # pragma: no cover
304
+ raise RuntimeError("Server not started")
279
305
 
280
306
  @property
281
307
  def port(self) -> int:
@@ -286,7 +312,7 @@ class ServerWrapper:
286
312
  RuntimeError
287
313
  If the server is not running
288
314
  """
289
- if self.server.factory is None:
315
+ if self.server.factory is None: # pragma: no cover
290
316
  raise RuntimeError("server is not running")
291
317
  return self.server.port
292
318
 
@@ -298,8 +324,9 @@ class ServerWrapper:
298
324
  RuntimeError
299
325
  If the server is not running
300
326
  """
301
- if self.server is None:
302
- raise RuntimeError("server is not running")
327
+ if self.server.factory is None: # pragma: no cover
328
+ del self.server
329
+ self._init_server()
303
330
  self.server.start()
304
331
 
305
332
  def stop(self) -> None:
@@ -340,7 +367,7 @@ class TCPServer:
340
367
  @property
341
368
  def port(self) -> int:
342
369
  """Get the port."""
343
- if self._wrapper is None:
370
+ if self._wrapper is None: # pragma: no cover
344
371
  return self._port
345
372
  return self._wrapper.port
346
373
 
@@ -348,7 +375,6 @@ class TCPServer:
348
375
  """Initialize the wrapper."""
349
376
  self._wrapper = ServerWrapper(
350
377
  port=self._port,
351
- timeout=self._timeout,
352
378
  interface=self._interface,
353
379
  )
354
380
 
@@ -7,12 +7,10 @@ definitions and their optional additional skills to be used.
7
7
 
8
8
  import json
9
9
  from dataclasses import dataclass
10
+ from functools import cache
10
11
  from pathlib import Path
11
12
  from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
12
13
 
13
- # let's be strict with autogen version
14
- from autogen.version import __version__ as autogen_version # type: ignore
15
-
16
14
  from .agents import WaldiezAgent
17
15
  from .chat import WaldiezChat
18
16
  from .flow import WaldiezFlow
@@ -203,6 +201,7 @@ class Waldiez:
203
201
  @property
204
202
  def requirements(self) -> List[str]:
205
203
  """Get the flow requirements."""
204
+ autogen_version = _get_autogen_version()
206
205
  requirements_list = filter(
207
206
  lambda requirement: not (
208
207
  requirement.startswith("pyautogen")
@@ -299,3 +298,14 @@ def _get_flow(
299
298
  if "requirements" not in data:
300
299
  data["requirements"] = []
301
300
  return data
301
+
302
+
303
+ @cache
304
+ def _get_autogen_version() -> str:
305
+ """Get the autogen version."""
306
+ # pylint: disable=import-outside-toplevel
307
+ try:
308
+ from autogen.version import __version__ as atg_version # type: ignore
309
+ except ImportError: # pragma: no cover
310
+ atg_version = "0.0.0"
311
+ return atg_version
@@ -19,14 +19,25 @@ from contextlib import contextmanager
19
19
  from contextvars import ContextVar
20
20
  from pathlib import Path
21
21
  from types import TracebackType
22
- from typing import Callable, Dict, Iterator, List, Optional, Type, Union
23
-
24
- from autogen import ChatResult # type: ignore
22
+ from typing import (
23
+ TYPE_CHECKING,
24
+ Callable,
25
+ Dict,
26
+ Iterator,
27
+ List,
28
+ Optional,
29
+ Type,
30
+ Union,
31
+ )
25
32
 
26
33
  from .exporter import WaldiezExporter
27
- from .io_stream import WaldiezIOStream
28
34
  from .models.waldiez import Waldiez
29
35
 
36
+ if TYPE_CHECKING:
37
+ from autogen import ChatResult # type: ignore
38
+
39
+ from .io import WaldiezIOStream
40
+
30
41
 
31
42
  @contextmanager
32
43
  def _chdir(to: Union[str, Path]) -> Iterator[None]:
@@ -60,7 +71,7 @@ class WaldiezRunner:
60
71
  self._waldiez = waldiez
61
72
  self._running = False
62
73
  self._file_path = file_path
63
- self._stream: ContextVar[Optional[WaldiezIOStream]] = ContextVar(
74
+ self._stream: ContextVar[Optional["WaldiezIOStream"]] = ContextVar(
64
75
  "waldiez_stream", default=None
65
76
  )
66
77
  self._exporter = WaldiezExporter(waldiez)
@@ -225,9 +236,9 @@ class WaldiezRunner:
225
236
 
226
237
  def _do_run(
227
238
  self, output_path: Optional[Union[str, Path]]
228
- ) -> Union[ChatResult, List[ChatResult]]:
239
+ ) -> Union["ChatResult", List["ChatResult"]]:
229
240
  """Run the Waldiez workflow."""
230
- results: Union[ChatResult, List[ChatResult]] = []
241
+ results: Union["ChatResult", List["ChatResult"]] = []
231
242
  temp_dir = Path(tempfile.mkdtemp())
232
243
  file_name = "flow.py" if not output_path else Path(output_path).name
233
244
  if file_name.endswith((".json", ".waldiez")):
@@ -259,19 +270,22 @@ class WaldiezRunner:
259
270
  def _run(
260
271
  self,
261
272
  output_path: Optional[Union[str, Path]],
262
- ) -> Union[ChatResult, List[ChatResult]]:
273
+ ) -> Union["ChatResult", List["ChatResult"]]:
263
274
  self._install_requirements()
264
275
  token = self._stream.get()
265
276
  if token is not None:
277
+ # pylint: disable=import-outside-toplevel
278
+ from .io import WaldiezIOStream
279
+
266
280
  with WaldiezIOStream.set_default(token):
267
281
  return self._do_run(output_path)
268
282
  return self._do_run(output_path)
269
283
 
270
284
  def run(
271
285
  self,
272
- stream: Optional[WaldiezIOStream] = None,
286
+ stream: Optional["WaldiezIOStream"] = None,
273
287
  output_path: Optional[Union[str, Path]] = None,
274
- ) -> Union[ChatResult, List[ChatResult]]:
288
+ ) -> Union["ChatResult", List["ChatResult"]]:
275
289
  """Run the Waldiez workflow.
276
290
 
277
291
  Parameters
File without changes
File without changes
File without changes
File without changes
File without changes