DeepFabric 4.4.0__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.
Files changed (202) hide show
  1. deepfabric-4.4.0/.github/config.yml +50 -0
  2. deepfabric-4.4.0/.github/dependabot.yml +14 -0
  3. deepfabric-4.4.0/.github/workflows/docs.yml +60 -0
  4. deepfabric-4.4.0/.github/workflows/integration.yml +48 -0
  5. deepfabric-4.4.0/.github/workflows/publish.yml +35 -0
  6. deepfabric-4.4.0/.github/workflows/test.yml +45 -0
  7. deepfabric-4.4.0/.github/workflows/tools-sdk-docker.yml +147 -0
  8. deepfabric-4.4.0/.gitignore +135 -0
  9. deepfabric-4.4.0/CLAUDE.md +100 -0
  10. deepfabric-4.4.0/LICENSE +201 -0
  11. deepfabric-4.4.0/Makefile +36 -0
  12. deepfabric-4.4.0/PKG-INFO +702 -0
  13. deepfabric-4.4.0/README.md +658 -0
  14. deepfabric-4.4.0/assets/df-demo.gif +0 -0
  15. deepfabric-4.4.0/assets/logo-light-hols.png +0 -0
  16. deepfabric-4.4.0/assets/logo-light.png +0 -0
  17. deepfabric-4.4.0/assets/star.gif +0 -0
  18. deepfabric-4.4.0/coverage.xml +688 -0
  19. deepfabric-4.4.0/deepfabric/__init__.py +70 -0
  20. deepfabric-4.4.0/deepfabric/__main__.py +6 -0
  21. deepfabric-4.4.0/deepfabric/auth.py +382 -0
  22. deepfabric-4.4.0/deepfabric/builders.py +303 -0
  23. deepfabric-4.4.0/deepfabric/builders_agent.py +1304 -0
  24. deepfabric-4.4.0/deepfabric/cli.py +1288 -0
  25. deepfabric-4.4.0/deepfabric/config.py +899 -0
  26. deepfabric-4.4.0/deepfabric/config_manager.py +251 -0
  27. deepfabric-4.4.0/deepfabric/constants.py +94 -0
  28. deepfabric-4.4.0/deepfabric/dataset_manager.py +534 -0
  29. deepfabric-4.4.0/deepfabric/error_codes.py +581 -0
  30. deepfabric-4.4.0/deepfabric/evaluation/__init__.py +47 -0
  31. deepfabric-4.4.0/deepfabric/evaluation/backends/__init__.py +32 -0
  32. deepfabric-4.4.0/deepfabric/evaluation/backends/ollama_backend.py +137 -0
  33. deepfabric-4.4.0/deepfabric/evaluation/backends/tool_call_parsers.py +409 -0
  34. deepfabric-4.4.0/deepfabric/evaluation/backends/transformers_backend.py +326 -0
  35. deepfabric-4.4.0/deepfabric/evaluation/evaluator.py +845 -0
  36. deepfabric-4.4.0/deepfabric/evaluation/evaluators/__init__.py +13 -0
  37. deepfabric-4.4.0/deepfabric/evaluation/evaluators/base.py +104 -0
  38. deepfabric-4.4.0/deepfabric/evaluation/evaluators/builtin/__init__.py +5 -0
  39. deepfabric-4.4.0/deepfabric/evaluation/evaluators/builtin/tool_calling.py +93 -0
  40. deepfabric-4.4.0/deepfabric/evaluation/evaluators/registry.py +66 -0
  41. deepfabric-4.4.0/deepfabric/evaluation/inference.py +155 -0
  42. deepfabric-4.4.0/deepfabric/evaluation/metrics.py +397 -0
  43. deepfabric-4.4.0/deepfabric/evaluation/parser.py +304 -0
  44. deepfabric-4.4.0/deepfabric/evaluation/reporters/__init__.py +13 -0
  45. deepfabric-4.4.0/deepfabric/evaluation/reporters/base.py +56 -0
  46. deepfabric-4.4.0/deepfabric/evaluation/reporters/cloud_reporter.py +195 -0
  47. deepfabric-4.4.0/deepfabric/evaluation/reporters/file_reporter.py +61 -0
  48. deepfabric-4.4.0/deepfabric/evaluation/reporters/multi_reporter.py +56 -0
  49. deepfabric-4.4.0/deepfabric/exceptions.py +67 -0
  50. deepfabric-4.4.0/deepfabric/factory.py +26 -0
  51. deepfabric-4.4.0/deepfabric/generator.py +1084 -0
  52. deepfabric-4.4.0/deepfabric/graph.py +545 -0
  53. deepfabric-4.4.0/deepfabric/hf_hub.py +214 -0
  54. deepfabric-4.4.0/deepfabric/kaggle_hub.py +219 -0
  55. deepfabric-4.4.0/deepfabric/llm/__init__.py +41 -0
  56. deepfabric-4.4.0/deepfabric/llm/api_key_verifier.py +534 -0
  57. deepfabric-4.4.0/deepfabric/llm/client.py +1206 -0
  58. deepfabric-4.4.0/deepfabric/llm/errors.py +105 -0
  59. deepfabric-4.4.0/deepfabric/llm/rate_limit_config.py +262 -0
  60. deepfabric-4.4.0/deepfabric/llm/rate_limit_detector.py +278 -0
  61. deepfabric-4.4.0/deepfabric/llm/retry_handler.py +270 -0
  62. deepfabric-4.4.0/deepfabric/metrics.py +212 -0
  63. deepfabric-4.4.0/deepfabric/progress.py +262 -0
  64. deepfabric-4.4.0/deepfabric/prompts.py +290 -0
  65. deepfabric-4.4.0/deepfabric/schemas.py +1000 -0
  66. deepfabric-4.4.0/deepfabric/spin/__init__.py +6 -0
  67. deepfabric-4.4.0/deepfabric/spin/client.py +263 -0
  68. deepfabric-4.4.0/deepfabric/spin/models.py +26 -0
  69. deepfabric-4.4.0/deepfabric/stream_simulator.py +90 -0
  70. deepfabric-4.4.0/deepfabric/tools/__init__.py +5 -0
  71. deepfabric-4.4.0/deepfabric/tools/defaults.py +85 -0
  72. deepfabric-4.4.0/deepfabric/tools/loader.py +87 -0
  73. deepfabric-4.4.0/deepfabric/tools/mcp_client.py +677 -0
  74. deepfabric-4.4.0/deepfabric/topic_manager.py +303 -0
  75. deepfabric-4.4.0/deepfabric/topic_model.py +20 -0
  76. deepfabric-4.4.0/deepfabric/training/__init__.py +35 -0
  77. deepfabric-4.4.0/deepfabric/training/api_key_prompt.py +302 -0
  78. deepfabric-4.4.0/deepfabric/training/callback.py +363 -0
  79. deepfabric-4.4.0/deepfabric/training/metrics_sender.py +301 -0
  80. deepfabric-4.4.0/deepfabric/tree.py +438 -0
  81. deepfabric-4.4.0/deepfabric/tui.py +1267 -0
  82. deepfabric-4.4.0/deepfabric/update_checker.py +166 -0
  83. deepfabric-4.4.0/deepfabric/utils.py +150 -0
  84. deepfabric-4.4.0/deepfabric/validation.py +143 -0
  85. deepfabric-4.4.0/docs/api/config.md +325 -0
  86. deepfabric-4.4.0/docs/api/generator.md +458 -0
  87. deepfabric-4.4.0/docs/api/graph.md +327 -0
  88. deepfabric-4.4.0/docs/api/index.md +135 -0
  89. deepfabric-4.4.0/docs/api/tree.md +283 -0
  90. deepfabric-4.4.0/docs/cli/format.md +240 -0
  91. deepfabric-4.4.0/docs/cli/generate.md +165 -0
  92. deepfabric-4.4.0/docs/cli/import-tools.md +323 -0
  93. deepfabric-4.4.0/docs/cli/index.md +89 -0
  94. deepfabric-4.4.0/docs/cli/upload.md +153 -0
  95. deepfabric-4.4.0/docs/cli/validate.md +144 -0
  96. deepfabric-4.4.0/docs/cli/visualize.md +115 -0
  97. deepfabric-4.4.0/docs/dataset-generation/agent.md +137 -0
  98. deepfabric-4.4.0/docs/dataset-generation/basic.md +92 -0
  99. deepfabric-4.4.0/docs/dataset-generation/configuration.md +177 -0
  100. deepfabric-4.4.0/docs/dataset-generation/index.md +60 -0
  101. deepfabric-4.4.0/docs/dataset-generation/rate-limiting.md +213 -0
  102. deepfabric-4.4.0/docs/dataset-generation/reasoning.md +99 -0
  103. deepfabric-4.4.0/docs/evaluation/index.md +54 -0
  104. deepfabric-4.4.0/docs/evaluation/metrics.md +136 -0
  105. deepfabric-4.4.0/docs/evaluation/running.md +179 -0
  106. deepfabric-4.4.0/docs/getting-started/index.md +98 -0
  107. deepfabric-4.4.0/docs/images/logo-light.png +0 -0
  108. deepfabric-4.4.0/docs/index.md +94 -0
  109. deepfabric-4.4.0/docs/tools/custom.md +223 -0
  110. deepfabric-4.4.0/docs/tools/index.md +91 -0
  111. deepfabric-4.4.0/docs/tools/mcp.md +165 -0
  112. deepfabric-4.4.0/docs/tools/mock.md +194 -0
  113. deepfabric-4.4.0/docs/tools/spin.md +135 -0
  114. deepfabric-4.4.0/docs/tools/vfs.md +118 -0
  115. deepfabric-4.4.0/docs/training/chat-templates.md +162 -0
  116. deepfabric-4.4.0/docs/training/frameworks.md +155 -0
  117. deepfabric-4.4.0/docs/training/index.md +60 -0
  118. deepfabric-4.4.0/docs/training/loading.md +115 -0
  119. deepfabric-4.4.0/examples/agent-tools-multi.yaml +157 -0
  120. deepfabric-4.4.0/examples/agent-tools-single.yaml +110 -0
  121. deepfabric-4.4.0/examples/basic-anthropic.yaml +51 -0
  122. deepfabric-4.4.0/examples/basic-gemini.yaml +51 -0
  123. deepfabric-4.4.0/examples/basic-graph.yaml +51 -0
  124. deepfabric-4.4.0/examples/basic-ollama.yaml +51 -0
  125. deepfabric-4.4.0/examples/basic-openai.yaml +51 -0
  126. deepfabric-4.4.0/examples/basic-openrouter.yaml +51 -0
  127. deepfabric-4.4.0/examples/basic-tree.yaml +51 -0
  128. deepfabric-4.4.0/examples/coding-agent.yaml +151 -0
  129. deepfabric-4.4.0/examples/complete.yaml +158 -0
  130. deepfabric-4.4.0/examples/custom-tools.yaml +93 -0
  131. deepfabric-4.4.0/examples/github-mock-tools.yaml +203 -0
  132. deepfabric-4.4.0/examples/reasoning.yaml +54 -0
  133. deepfabric-4.4.0/examples/spin-vfs-tools.yaml +89 -0
  134. deepfabric-4.4.0/examples/tools-sdk-examples/blender/blender-mock-data.json +915 -0
  135. deepfabric-4.4.0/examples/tools-sdk-examples/blender/load-blender-mock-data.sh +128 -0
  136. deepfabric-4.4.0/examples/tools-sdk-examples/blender/spin-blender.yaml +185 -0
  137. deepfabric-4.4.0/examples/tools-sdk-examples/figma/figma-mock-data.json +586 -0
  138. deepfabric-4.4.0/examples/tools-sdk-examples/figma/load-figma-mock-data.sh +113 -0
  139. deepfabric-4.4.0/examples/tools-sdk-examples/figma/spin-figma.yaml +109 -0
  140. deepfabric-4.4.0/examples/tools-sdk-examples/github/github-mock-data.json +542 -0
  141. deepfabric-4.4.0/examples/tools-sdk-examples/github/load-github-mock-data.sh +104 -0
  142. deepfabric-4.4.0/examples/tools-sdk-examples/github/spin-github-tools.yaml +96 -0
  143. deepfabric-4.4.0/examples/tools-sdk-examples/kubernetes/kubernetes-mock-data.json +1277 -0
  144. deepfabric-4.4.0/examples/tools-sdk-examples/kubernetes/load-kubernetes-mock-data.sh +131 -0
  145. deepfabric-4.4.0/examples/tools-sdk-examples/kubernetes/spin-kubernetes.yaml +185 -0
  146. deepfabric-4.4.0/examples/tools-sdk-examples/kubernetes/tools.json +607 -0
  147. deepfabric-4.4.0/misc/test_update_manual.py +27 -0
  148. deepfabric-4.4.0/mkdocs.yml +107 -0
  149. deepfabric-4.4.0/notebooks/trl_sft_training.ipynb +602 -0
  150. deepfabric-4.4.0/pyproject.toml +160 -0
  151. deepfabric-4.4.0/test-run/01-alpaca.txt +4 -0
  152. deepfabric-4.4.0/test-run/01-chatml.txt +176 -0
  153. deepfabric-4.4.0/test-run/01-grpo.txt +4 -0
  154. deepfabric-4.4.0/test-run/01-xlam_v2.txt +0 -0
  155. deepfabric-4.4.0/test-run/02-trl2.txt +4 -0
  156. deepfabric-4.4.0/test-run/02-xlam_v2.txt +52 -0
  157. deepfabric-4.4.0/test-run/04-agent-tool-conversations.jsnl +4 -0
  158. deepfabric-4.4.0/test-run/04-single-agent-tools +515 -0
  159. deepfabric-4.4.0/tests/__init__.py +0 -0
  160. deepfabric-4.4.0/tests/integration/__init__.py +0 -0
  161. deepfabric-4.4.0/tests/integration/test_tree_integration.py +186 -0
  162. deepfabric-4.4.0/tests/unit/__init__.py +0 -0
  163. deepfabric-4.4.0/tests/unit/conftest.py +20 -0
  164. deepfabric-4.4.0/tests/unit/test_api_key_validation.py +375 -0
  165. deepfabric-4.4.0/tests/unit/test_cli.py +700 -0
  166. deepfabric-4.4.0/tests/unit/test_config.py +280 -0
  167. deepfabric-4.4.0/tests/unit/test_error_codes.py +439 -0
  168. deepfabric-4.4.0/tests/unit/test_gemini_schema.py +393 -0
  169. deepfabric-4.4.0/tests/unit/test_generator.py +235 -0
  170. deepfabric-4.4.0/tests/unit/test_hf_hub.py +164 -0
  171. deepfabric-4.4.0/tests/unit/test_kaggle_hub.py +209 -0
  172. deepfabric-4.4.0/tests/unit/test_modular_config.py +272 -0
  173. deepfabric-4.4.0/tests/unit/test_rate_limiting.py +476 -0
  174. deepfabric-4.4.0/tests/unit/test_schemas.py +441 -0
  175. deepfabric-4.4.0/tests/unit/test_tool_call_parsers.py +424 -0
  176. deepfabric-4.4.0/tests/unit/test_topic_graph.py +490 -0
  177. deepfabric-4.4.0/tests/unit/test_training_callback.py +424 -0
  178. deepfabric-4.4.0/tests/unit/test_update_checker.py +318 -0
  179. deepfabric-4.4.0/tools/extract_messages.py +48 -0
  180. deepfabric-4.4.0/tools/function.py +20 -0
  181. deepfabric-4.4.0/tools/yaml_to_openai_tools.py +127 -0
  182. deepfabric-4.4.0/tools-sdk/.dockerignore +37 -0
  183. deepfabric-4.4.0/tools-sdk/Dockerfile +91 -0
  184. deepfabric-4.4.0/tools-sdk/README.md +277 -0
  185. deepfabric-4.4.0/tools-sdk/components/github/README.md +348 -0
  186. deepfabric-4.4.0/tools-sdk/components/github/app.py +701 -0
  187. deepfabric-4.4.0/tools-sdk/components/github/github.wasm +0 -0
  188. deepfabric-4.4.0/tools-sdk/components/github/pyproject.toml +11 -0
  189. deepfabric-4.4.0/tools-sdk/components/github/requirements.txt +1 -0
  190. deepfabric-4.4.0/tools-sdk/components/github/spin.toml +6 -0
  191. deepfabric-4.4.0/tools-sdk/components/github/uv.lock +40 -0
  192. deepfabric-4.4.0/tools-sdk/components/mock/Cargo.lock +867 -0
  193. deepfabric-4.4.0/tools-sdk/components/mock/Cargo.toml +14 -0
  194. deepfabric-4.4.0/tools-sdk/components/mock/README.md +357 -0
  195. deepfabric-4.4.0/tools-sdk/components/mock/src/lib.rs +635 -0
  196. deepfabric-4.4.0/tools-sdk/components/vfs/Cargo.lock +847 -0
  197. deepfabric-4.4.0/tools-sdk/components/vfs/Cargo.toml +19 -0
  198. deepfabric-4.4.0/tools-sdk/components/vfs/src/lib.rs +330 -0
  199. deepfabric-4.4.0/tools-sdk/docker-compose.yaml +43 -0
  200. deepfabric-4.4.0/tools-sdk/runtime-config.toml +5 -0
  201. deepfabric-4.4.0/tools-sdk/spin.toml +76 -0
  202. deepfabric-4.4.0/uv.lock +3478 -0
@@ -0,0 +1,50 @@
1
+ # Configuration for welcome - https://github.com/behaviorbot/welcome
2
+
3
+ # Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
4
+
5
+ # Comment to be posted to on first time issues
6
+ newIssueWelcomeComment: >
7
+ 🎉 **Welcome to the DeepFabric project!** 🎉
8
+ Thanks for opening your first issue here — we’re *so excited* to have you contributing! 😄
9
+ Please make sure to follow the issue template so we can help you faster 🧵✨
10
+
11
+ 💬 Join our amazing community on Discord for live discussions, sneak peeks, and good vibes:
12
+ 👉 [**DeepFabric Discord**](https://discord.gg/pPcjYzGvbS)
13
+
14
+ 🧠 Let’s build something *deep* together! 🚀💡
15
+
16
+ ![welcome gif](https://media.giphy.com/media/OkJat1YNdoD3W/giphy.gif)
17
+
18
+ ---
19
+
20
+ # Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
21
+
22
+ # Comment to be posted to on PRs from first time contributors in your repository
23
+ newPRWelcomeComment: >
24
+ 👏 **Thank you for your first pull request!** 👏
25
+ Welcome to **DeepFabric** — you’re officially part of the weave now! 🧶✨
26
+
27
+ Please take a moment to check out our **contributing guidelines** before your PR is reviewed 💪
28
+ Every thread you add helps strengthen the fabric of this project 🕸️💙
29
+
30
+ 💬 Hop into our Discord to say hi or share your progress:
31
+ 👉 [**DeepFabric Discord**](https://discord.gg/pPcjYzGvbS)
32
+
33
+ ![thank you gif](https://media.giphy.com/media/l0MYt5jPR6QX5pnqM/giphy.gif)
34
+
35
+ ---
36
+
37
+ # Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
38
+
39
+ # Comment to be posted to on pull requests merged by a first time user
40
+ firstPRMergeComment: >
41
+ 🥳 **Congratulations on merging your first PR!** 🥳
42
+ The **DeepFabric** team is *so proud* of you! 🌟
43
+
44
+ You’ve officially added your thread to the ever-growing fabric of this project 🧵💫
45
+ Keep up the great work and let’s keep building amazing things together! 🚀
46
+
47
+ 💬 Come celebrate with us on Discord — you’ve earned it!
48
+ 👉 [**DeepFabric Discord**](https://discord.gg/pPcjYzGvbS)
49
+
50
+ ![celebration gif](https://media.giphy.com/media/111ebonMs90YLu/giphy.gif)
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "daily"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "daily"
11
+ # - package-ecosystem: "docker"
12
+ # directory: "/"
13
+ # schedule:
14
+ # interval: "daily"
@@ -0,0 +1,60 @@
1
+ name: Build and Deploy Documentation
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ permissions:
10
+ contents: read
11
+ pages: write
12
+ id-token: write
13
+
14
+ concurrency:
15
+ group: "pages"
16
+ cancel-in-progress: false
17
+
18
+ jobs:
19
+ build:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Checkout
23
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5
24
+
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7
27
+
28
+ - name: Set up Python
29
+ run: uv python install
30
+
31
+ - name: Create virtual environment
32
+ run: uv venv
33
+
34
+ - name: Install dependencies
35
+ run: uv pip install mkdocs-material "mkdocstrings[python]>=0.30.0"
36
+
37
+ - name: Build documentation
38
+ run: |
39
+ source .venv/bin/activate
40
+ mkdocs build --strict
41
+
42
+ - name: Setup Pages
43
+ uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
44
+
45
+ - name: Upload artifact
46
+ uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
47
+ with:
48
+ path: ./site
49
+
50
+ deploy:
51
+ if: github.ref == 'refs/heads/main'
52
+ environment:
53
+ name: github-pages
54
+ url: ${{ steps.deployment.outputs.page_url }}
55
+ runs-on: ubuntu-latest
56
+ needs: build
57
+ steps:
58
+ - name: Deploy to GitHub Pages
59
+ id: deployment
60
+ uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
@@ -0,0 +1,48 @@
1
+ name: Integration Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths-ignore:
8
+ - '**/README.md'
9
+ - '**/docs/**'
10
+ - '**/.github/workflows/publish.yml'
11
+ pull_request:
12
+ paths-ignore:
13
+ - '**/README.md'
14
+ - '**/docs/**'
15
+ - '**/.github/workflows/publish.yml'
16
+
17
+ jobs:
18
+ integration-tests:
19
+ name: Run integration tests (Python ${{ matrix.python-version }})
20
+ runs-on: ubuntu-latest
21
+
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ python-version: [ '3.10', '3.11', '3.12' ]
26
+
27
+ steps:
28
+ - name: Checkout code
29
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5
30
+
31
+ - name: Set up Python
32
+ uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
33
+ with:
34
+ python-version: ${{ matrix.python-version }}
35
+ cache: pip
36
+
37
+ - name: Install uv
38
+ uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7
39
+ with:
40
+ enable-cache: true
41
+
42
+ - name: Install dependencies
43
+ run: uv sync --all-extras
44
+
45
+ - name: Run integration tests
46
+ run: make test-integration
47
+ env:
48
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
@@ -0,0 +1,35 @@
1
+ name: CI/CD
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ pypi-publish:
9
+ name: Upload release to PyPI
10
+ runs-on: ubuntu-latest
11
+ environment:
12
+ name: release
13
+ url: https://pypi.org/p/deepfabric
14
+ permissions:
15
+ id-token: write
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5
20
+
21
+ - name: Set up Python
22
+ uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
23
+ with:
24
+ python-version: '3.x'
25
+
26
+ - name: Install uv
27
+ uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7
28
+
29
+ - name: Build distributions
30
+ run: uv build
31
+
32
+ - name: Publish package distributions to PyPI
33
+ uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1
34
+ with:
35
+ attestations: true
@@ -0,0 +1,45 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ['3.11']
15
+
16
+ steps:
17
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7
26
+ with:
27
+ enable-cache: true
28
+
29
+ - name: Install dependencies
30
+ run: uv sync --all-extras
31
+
32
+ - name: Run code formatting
33
+ run: make format
34
+
35
+ - name: Run linting
36
+ run: make lint
37
+
38
+ - name: Run tests
39
+ run: make test-unit
40
+
41
+ - name: Run security checks
42
+ run: make security
43
+
44
+ - name: Run build
45
+ run: make build
@@ -0,0 +1,147 @@
1
+ name: Tools-SDK Docker Build and Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - 'tools-sdk/**'
9
+ - '.github/workflows/tools-sdk-docker.yml'
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ paths:
14
+ - 'tools-sdk/**'
15
+ - '.github/workflows/tools-sdk-docker.yml'
16
+ release:
17
+ types: [published]
18
+ workflow_dispatch:
19
+
20
+ env:
21
+ REGISTRY: ghcr.io
22
+ IMAGE_NAME: ${{ github.repository }}/tools-sdk
23
+
24
+ jobs:
25
+ build:
26
+ name: Build ${{ matrix.platform }}
27
+ runs-on: ${{ matrix.runner }}
28
+ permissions:
29
+ contents: read
30
+ packages: write
31
+ strategy:
32
+ fail-fast: false
33
+ matrix:
34
+ include:
35
+ - platform: linux/amd64
36
+ runner: ubuntu-latest
37
+ - platform: linux/arm64
38
+ runner: ubuntu-24.04-arm
39
+
40
+ steps:
41
+ - name: Checkout code
42
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
43
+
44
+ - name: Set up Docker Buildx
45
+ uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
46
+
47
+ - name: Log in to Container Registry
48
+ if: github.event_name != 'pull_request'
49
+ uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
50
+ with:
51
+ registry: ${{ env.REGISTRY }}
52
+ username: ${{ github.actor }}
53
+ password: ${{ secrets.GITHUB_TOKEN }}
54
+
55
+ - name: Extract metadata for Docker
56
+ id: meta
57
+ uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
58
+ with:
59
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
60
+
61
+ - name: Build and push by digest
62
+ id: build
63
+ uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
64
+ with:
65
+ context: ./tools-sdk
66
+ file: ./tools-sdk/Dockerfile
67
+ platforms: ${{ matrix.platform }}
68
+ labels: ${{ steps.meta.outputs.labels }}
69
+ cache-from: type=gha,scope=${{ matrix.platform }}
70
+ cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
71
+ outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
72
+
73
+ - name: Export digest
74
+ if: github.event_name != 'pull_request'
75
+ run: |
76
+ mkdir -p /tmp/digests
77
+ digest="${{ steps.build.outputs.digest }}"
78
+ touch "/tmp/digests/${digest#sha256:}"
79
+
80
+ - name: Upload digest
81
+ if: github.event_name != 'pull_request'
82
+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
83
+ with:
84
+ name: digests-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
85
+ path: /tmp/digests/*
86
+ if-no-files-found: error
87
+ retention-days: 1
88
+
89
+ merge:
90
+ name: Merge and Push Manifest
91
+ runs-on: ubuntu-latest
92
+ if: github.event_name != 'pull_request'
93
+ needs: build
94
+ permissions:
95
+ contents: read
96
+ packages: write
97
+ id-token: write
98
+
99
+ steps:
100
+ - name: Download digests
101
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
102
+ with:
103
+ path: /tmp/digests
104
+ pattern: digests-*
105
+ merge-multiple: true
106
+
107
+ - name: Set up Docker Buildx
108
+ uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
109
+
110
+ - name: Log in to Container Registry
111
+ uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
112
+ with:
113
+ registry: ${{ env.REGISTRY }}
114
+ username: ${{ github.actor }}
115
+ password: ${{ secrets.GITHUB_TOKEN }}
116
+
117
+ - name: Extract metadata for Docker
118
+ id: meta
119
+ uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
120
+ with:
121
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
122
+ tags: |
123
+ type=ref,event=branch
124
+ type=ref,event=pr
125
+ type=semver,pattern={{version}}
126
+ type=semver,pattern={{major}}.{{minor}}
127
+ type=sha,prefix=
128
+ type=raw,value=latest,enable={{is_default_branch}}
129
+
130
+ - name: Create manifest list and push
131
+ working-directory: /tmp/digests
132
+ run: |
133
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
134
+ $(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
135
+
136
+ - name: Inspect image
137
+ run: |
138
+ docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
139
+
140
+ - name: Install Cosign
141
+ uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
142
+
143
+ - name: Sign the container image
144
+ env:
145
+ DIGEST: ${{ steps.meta.outputs.version }}
146
+ run: |
147
+ cosign sign --yes "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${DIGEST}"
@@ -0,0 +1,135 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ *.cover
45
+ *.py,cover
46
+ .hypothesis/
47
+
48
+ # mypy
49
+ .mypy_cache/
50
+ .dmypy.json
51
+ dmypy.json
52
+
53
+ # Pyre type checker
54
+ .pyre/
55
+
56
+ # Pytype static type analyzer
57
+ .pytype/
58
+
59
+ # Environments
60
+ .env
61
+ .venv
62
+ env/
63
+ venv/
64
+ ENV/
65
+ env.bak/
66
+ venv.bak/
67
+
68
+ # Spyder project settings
69
+ .spyderproject
70
+ .spyproject
71
+
72
+ # Rope project settings
73
+ .ropeproject
74
+
75
+ # Jupyter Notebook
76
+ .ipynb_checkpoints
77
+
78
+ # pyenv
79
+ .python-version
80
+
81
+ # Celery
82
+ celerybeat-schedule
83
+ *.sage.py
84
+
85
+ # Django stuff:
86
+ *.log
87
+ local_settings.py
88
+ db.sqlite3
89
+ db.sqlite3-journal
90
+
91
+ # Flask stuff:
92
+ instance/
93
+ .webassets-cache
94
+
95
+ # Scrapy stuff:
96
+ .scrapy
97
+
98
+ # Sphinx documentation
99
+ docs/_build/
100
+
101
+ # PyBuilder
102
+ target/
103
+
104
+ # Jupyter Notebook metadata
105
+ .ipynb_checkpoints
106
+
107
+ # VS Code settings
108
+ .vscode/
109
+ .vscode/settings.json
110
+
111
+ # macOS specific
112
+ .DS_Store
113
+
114
+ # Temporary and backup files
115
+ *.bak
116
+ *.swp
117
+ *.swo
118
+
119
+ # IDE specific settings
120
+ .idea/
121
+ *.iml
122
+ .serena/
123
+
124
+ # Logs
125
+ *.log
126
+ *.out
127
+ *.err
128
+
129
+ # Project files
130
+ venv/
131
+ *.jsonl
132
+ formats/*
133
+ # coverage files
134
+ .coverage.*
135
+ tools-sdk/.spin/*
@@ -0,0 +1,100 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ DeepFabric is a Python library for generating synthetic datasets using LLM providers. It consists of three main components that work together in a pipeline:
8
+
9
+ 1. **Tree**: Generates hierarchical topic structures from a root prompt
10
+ 2. **DataSetGenerator**: Creates training examples based on topics
11
+ 3. **Dataset**: Manages and exports the final dataset
12
+
13
+ ## Development Commands
14
+
15
+ ### Package Management
16
+ - `uv sync --all-extras` - Install all dependencies including dev tools
17
+ - `make install` - Same as above via Makefile
18
+
19
+ ### Code Quality
20
+ - `make format` - Format code with black and ruff auto-fix
21
+ - `make lint` - Run ruff linting checks
22
+ - `make security` - Run bandit security analysis on deepfabric/ directory
23
+
24
+ ### Testing
25
+ - `make test` - Run pytest test suite
26
+ - `uv run pytest` - Direct pytest execution
27
+ - Test files are in `tests/` directory
28
+
29
+ ### Build and Release
30
+ - `make build` - Clean, test, and build package
31
+ - `make clean` - Remove build artifacts and cache files
32
+ - `make all` - Complete workflow: install, format, lint, test, security, build
33
+
34
+ ## Core Architecture
35
+
36
+ ### Configuration System
37
+ - YAML-based configuration with direct system prompt specification
38
+ - CLI supports extensive parameter overrides
39
+
40
+ ### Data Flow
41
+ 1. Tree generates topic hierarchy from root prompt
42
+ 2. DataSetGenerator uses topics to create question/answer pairs
43
+ 3. Dataset validates, stores, and exports training examples
44
+ 4. Optional HuggingFace Hub upload with auto-generated dataset cards
45
+
46
+ ### Key Classes and Their Relationships
47
+ - `DeepFabricConfig`: Loads YAML and provides argument objects
48
+ - `TreeArguments`/`DataSetGeneratorArguments`: Pydantic-style dataclasses for parameters
49
+ - `Dataset`: Handles JSONL import/export and validation
50
+ - `HFUploader`: Manages Hugging Face Hub integration
51
+
52
+ ## Important Implementation Details
53
+
54
+ ### JSON Validation
55
+ The engine includes robust JSON parsing with regex extraction and retry logic for handling LLM response inconsistencies.
56
+
57
+ ### Error Handling
58
+ - Max retries configurable for failed LLM calls
59
+ - Failed samples tracked separately from successful ones
60
+ - Comprehensive error reporting in final summary
61
+
62
+ ### System Message Control
63
+ The `sys_msg` parameter controls whether system messages are included in the final dataset format - this affects training data structure.
64
+
65
+ ## Configuration Patterns
66
+
67
+ ### YAML Structure
68
+ ```yaml
69
+ dataset_system_prompt: "..."
70
+ topic_tree:
71
+ args: {...}
72
+ save_as: "file.jsonl"
73
+ data_engine:
74
+ args: {...}
75
+ dataset:
76
+ creation: {...}
77
+ save_as: "file.jsonl"
78
+ huggingface: {...} # optional
79
+ ```
80
+
81
+ ### Provider Configuration
82
+ Specify provider and model separately in config, or use combined format in code:
83
+ - Config: `provider: "ollama"`, `model: "mistral:latest"`
84
+ - Code: `model_name: "ollama/mistral:latest"`
85
+
86
+ ## CLI Usage Patterns
87
+
88
+ The CLI supports both YAML configuration and parameter overrides:
89
+ ```bash
90
+ deepfabric start config.yaml --model gpt-4 --temperature 0.8 --hf-repo user/dataset
91
+ ```
92
+
93
+ ## Code Style Notes
94
+ - Uses uv for dependency management
95
+ - Ruff for linting with extensive rule set
96
+ - Black for formatting
97
+ - Bandit for security analysis
98
+ - Python 3.11+ required
99
+ - Google-style docstrings preferred
100
+ - do not place imports anywhere but the top of the file