quantology-modelmaker 0.1.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 (103) hide show
  1. quantology_modelmaker-0.1.0/LICENSE +204 -0
  2. quantology_modelmaker-0.1.0/MANIFEST.in +6 -0
  3. quantology_modelmaker-0.1.0/NOTICE +12 -0
  4. quantology_modelmaker-0.1.0/PKG-INFO +247 -0
  5. quantology_modelmaker-0.1.0/README.md +207 -0
  6. quantology_modelmaker-0.1.0/frontend/.gitignore +24 -0
  7. quantology_modelmaker-0.1.0/frontend/.npmrc +1 -0
  8. quantology_modelmaker-0.1.0/frontend/.oxlintrc.json +8 -0
  9. quantology_modelmaker-0.1.0/frontend/README.md +32 -0
  10. quantology_modelmaker-0.1.0/frontend/index.html +19 -0
  11. quantology_modelmaker-0.1.0/frontend/package-lock.json +1708 -0
  12. quantology_modelmaker-0.1.0/frontend/package.json +31 -0
  13. quantology_modelmaker-0.1.0/frontend/public/brand-quantology/favicon.svg +4 -0
  14. quantology_modelmaker-0.1.0/frontend/public/brand-quantology/icon-mark-light.svg +13 -0
  15. quantology_modelmaker-0.1.0/frontend/public/icons.svg +24 -0
  16. quantology_modelmaker-0.1.0/frontend/src/App.tsx +535 -0
  17. quantology_modelmaker-0.1.0/frontend/src/BlockNode.tsx +195 -0
  18. quantology_modelmaker-0.1.0/frontend/src/CodeEditor.tsx +87 -0
  19. quantology_modelmaker-0.1.0/frontend/src/DataModal.tsx +142 -0
  20. quantology_modelmaker-0.1.0/frontend/src/DataWireEdge.tsx +31 -0
  21. quantology_modelmaker-0.1.0/frontend/src/FileBrowser.tsx +131 -0
  22. quantology_modelmaker-0.1.0/frontend/src/Inspector.tsx +616 -0
  23. quantology_modelmaker-0.1.0/frontend/src/LaneBand.tsx +61 -0
  24. quantology_modelmaker-0.1.0/frontend/src/LaneLabels.tsx +168 -0
  25. quantology_modelmaker-0.1.0/frontend/src/Palette.tsx +183 -0
  26. quantology_modelmaker-0.1.0/frontend/src/ParamsForm.tsx +272 -0
  27. quantology_modelmaker-0.1.0/frontend/src/PortDataView.tsx +95 -0
  28. quantology_modelmaker-0.1.0/frontend/src/PortInspector.tsx +85 -0
  29. quantology_modelmaker-0.1.0/frontend/src/SettingsPanel.tsx +251 -0
  30. quantology_modelmaker-0.1.0/frontend/src/Toolbar.tsx +275 -0
  31. quantology_modelmaker-0.1.0/frontend/src/api.ts +153 -0
  32. quantology_modelmaker-0.1.0/frontend/src/assets/hero.png +0 -0
  33. quantology_modelmaker-0.1.0/frontend/src/assets/react.svg +1 -0
  34. quantology_modelmaker-0.1.0/frontend/src/assets/vite.svg +1 -0
  35. quantology_modelmaker-0.1.0/frontend/src/index.css +91 -0
  36. quantology_modelmaker-0.1.0/frontend/src/main.tsx +10 -0
  37. quantology_modelmaker-0.1.0/frontend/src/roles.ts +17 -0
  38. quantology_modelmaker-0.1.0/frontend/src/types.ts +166 -0
  39. quantology_modelmaker-0.1.0/frontend/tsconfig.app.json +26 -0
  40. quantology_modelmaker-0.1.0/frontend/tsconfig.json +7 -0
  41. quantology_modelmaker-0.1.0/frontend/tsconfig.node.json +23 -0
  42. quantology_modelmaker-0.1.0/frontend/vite.config.ts +20 -0
  43. quantology_modelmaker-0.1.0/modelmaker/__init__.py +2 -0
  44. quantology_modelmaker-0.1.0/modelmaker/api.py +1073 -0
  45. quantology_modelmaker-0.1.0/modelmaker/blocks/__init__.py +0 -0
  46. quantology_modelmaker-0.1.0/modelmaker/blocks/base.py +78 -0
  47. quantology_modelmaker-0.1.0/modelmaker/blocks/library.py +327 -0
  48. quantology_modelmaker-0.1.0/modelmaker/blocks/modelling.py +312 -0
  49. quantology_modelmaker-0.1.0/modelmaker/blocks/stat_tests.py +133 -0
  50. quantology_modelmaker-0.1.0/modelmaker/cache.py +44 -0
  51. quantology_modelmaker-0.1.0/modelmaker/compiler.py +478 -0
  52. quantology_modelmaker-0.1.0/modelmaker/graph.py +171 -0
  53. quantology_modelmaker-0.1.0/modelmaker/llm/__init__.py +28 -0
  54. quantology_modelmaker-0.1.0/modelmaker/llm/anthropic_provider.py +79 -0
  55. quantology_modelmaker-0.1.0/modelmaker/llm/base.py +85 -0
  56. quantology_modelmaker-0.1.0/modelmaker/llm/claude_cli_provider.py +90 -0
  57. quantology_modelmaker-0.1.0/modelmaker/llm/gemini_provider.py +138 -0
  58. quantology_modelmaker-0.1.0/modelmaker/llm/lmstudio_provider.py +140 -0
  59. quantology_modelmaker-0.1.0/modelmaker/llm/openai_provider.py +138 -0
  60. quantology_modelmaker-0.1.0/modelmaker/llm/prompts.py +189 -0
  61. quantology_modelmaker-0.1.0/modelmaker/llm/settings.py +47 -0
  62. quantology_modelmaker-0.1.0/modelmaker/llm/stub_provider.py +29 -0
  63. quantology_modelmaker-0.1.0/modelmaker/metadata_transforms.py +109 -0
  64. quantology_modelmaker-0.1.0/modelmaker/packet.py +111 -0
  65. quantology_modelmaker-0.1.0/modelmaker/project.py +129 -0
  66. quantology_modelmaker-0.1.0/modelmaker/run_worker.py +143 -0
  67. quantology_modelmaker-0.1.0/modelmaker/runner.py +1313 -0
  68. quantology_modelmaker-0.1.0/modelmaker/session.py +400 -0
  69. quantology_modelmaker-0.1.0/modelmaker/tui/__init__.py +0 -0
  70. quantology_modelmaker-0.1.0/modelmaker/tui/app.py +785 -0
  71. quantology_modelmaker-0.1.0/modelmaker/tui/canvas.py +388 -0
  72. quantology_modelmaker-0.1.0/modelmaker/tui/charts.py +84 -0
  73. quantology_modelmaker-0.1.0/modelmaker/tui/client.py +270 -0
  74. quantology_modelmaker-0.1.0/modelmaker/tui/inspector.py +285 -0
  75. quantology_modelmaker-0.1.0/modelmaker/tui/paramspecs.py +128 -0
  76. quantology_modelmaker-0.1.0/modelmaker/tui/preview.py +71 -0
  77. quantology_modelmaker-0.1.0/modelmaker/tui/screens.py +182 -0
  78. quantology_modelmaker-0.1.0/modelmaker/util.py +44 -0
  79. quantology_modelmaker-0.1.0/pyproject.toml +61 -0
  80. quantology_modelmaker-0.1.0/quantology_modelmaker.egg-info/PKG-INFO +247 -0
  81. quantology_modelmaker-0.1.0/quantology_modelmaker.egg-info/SOURCES.txt +101 -0
  82. quantology_modelmaker-0.1.0/quantology_modelmaker.egg-info/dependency_links.txt +1 -0
  83. quantology_modelmaker-0.1.0/quantology_modelmaker.egg-info/entry_points.txt +3 -0
  84. quantology_modelmaker-0.1.0/quantology_modelmaker.egg-info/requires.txt +19 -0
  85. quantology_modelmaker-0.1.0/quantology_modelmaker.egg-info/top_level.txt +1 -0
  86. quantology_modelmaker-0.1.0/run.bat +23 -0
  87. quantology_modelmaker-0.1.0/setup.cfg +4 -0
  88. quantology_modelmaker-0.1.0/setup.py +52 -0
  89. quantology_modelmaker-0.1.0/tests/test_api.py +677 -0
  90. quantology_modelmaker-0.1.0/tests/test_compiler.py +415 -0
  91. quantology_modelmaker-0.1.0/tests/test_demo_project.py +61 -0
  92. quantology_modelmaker-0.1.0/tests/test_graph.py +75 -0
  93. quantology_modelmaker-0.1.0/tests/test_library.py +31 -0
  94. quantology_modelmaker-0.1.0/tests/test_llm.py +256 -0
  95. quantology_modelmaker-0.1.0/tests/test_master_scale.py +150 -0
  96. quantology_modelmaker-0.1.0/tests/test_packet.py +77 -0
  97. quantology_modelmaker-0.1.0/tests/test_project.py +66 -0
  98. quantology_modelmaker-0.1.0/tests/test_runner.py +784 -0
  99. quantology_modelmaker-0.1.0/tests/test_runner_streaming.py +403 -0
  100. quantology_modelmaker-0.1.0/tests/test_session.py +244 -0
  101. quantology_modelmaker-0.1.0/tests/test_tui_app.py +279 -0
  102. quantology_modelmaker-0.1.0/tests/test_tui_charts.py +60 -0
  103. quantology_modelmaker-0.1.0/tests/test_tui_client.py +126 -0
@@ -0,0 +1,204 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the
44
+ purposes of this License, Derivative Works shall not include works
45
+ that remain separable from, or merely link (or bind by name) to the
46
+ interfaces of, the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including the
49
+ original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright
52
+ owner or by an individual or Legal Entity authorized to submit on
53
+ behalf of the copyright owner. For the purposes of this definition,
54
+ "submitted" means any form of electronic, verbal, or written
55
+ communication sent to the Licensor or its representatives,
56
+ including but not limited to communication on electronic mailing
57
+ lists, source code control systems, and issue tracking systems that
58
+ are managed by, or on behalf of, the Licensor for the purpose of
59
+ discussing and improving the Work, but excluding communication that
60
+ is conspicuously marked or otherwise designated in writing by the
61
+ copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing
142
+ the origin of the Work and reproducing the content of the NOTICE
143
+ file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this
154
+ License.
155
+
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+
168
+ 9. Accepting Warranty or Additional Liability. While redistributing
169
+ the Work or Derivative Works thereof, You may choose to offer,
170
+ and charge a fee for, acceptance of support, warranty, indemnity,
171
+ or other liability obligations and/or rights consistent with this
172
+ License. However, in accepting such obligations, You may act only
173
+ on Your own behalf and on Your sole responsibility, not on behalf
174
+ of any other Contributor, and only if You agree to indemnify,
175
+ defend, and hold each Contributor harmless for any liability
176
+ incurred by, or claims asserted against, such Contributor by reason
177
+ of your accepting any such warranty or additional liability.
178
+
179
+ END OF TERMS AND CONDITIONS
180
+
181
+ APPENDIX: How to apply the Apache License to your work.
182
+
183
+ To apply the Apache License to your work, attach the following
184
+ boilerplate notice, with the fields enclosed by brackets "[]"
185
+ replaced with your own identifying information. (Don't include
186
+ the brackets!) The text should be enclosed in the appropriate
187
+ comment syntax for the file format. We also recommend that a
188
+ file or class name and description of purpose be included on the
189
+ same "printed page" as the copyright notice for easier
190
+ identification within third-party archives.
191
+
192
+ Copyright [yyyy] [name of copyright owner]
193
+
194
+ Licensed under the Apache License, Version 2.0 (the "License");
195
+ you may not use this file except in compliance with the License.
196
+ You may obtain a copy of the License at
197
+
198
+ http://www.apache.org/licenses/LICENSE-2.0
199
+
200
+ Unless required by applicable law or agreed to in writing, software
201
+ distributed under the License is distributed on an "AS IS" BASIS,
202
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203
+ See the License for the specific language governing permissions and
204
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ include README.md LICENSE NOTICE run.bat
2
+ graft frontend
3
+ prune frontend/node_modules
4
+ prune frontend/dist
5
+ global-exclude __pycache__
6
+ global-exclude *.py[cod]
@@ -0,0 +1,12 @@
1
+ Modelmaker
2
+ Copyright 2026 Maurits Malkus, Quantology (quantology.nl)
3
+
4
+ This product is licensed under the Apache License, Version 2.0.
5
+ See the LICENSE file for the full terms.
6
+
7
+ Attribution notice (must be preserved and carried forward in any
8
+ distribution, publication, or public deployment of this Software or
9
+ any Derivative Work thereof, per Section 4(d) of the Apache License,
10
+ Version 2.0):
11
+
12
+ Originally developed by Maurits Malkus, Quantology (quantology.nl).
@@ -0,0 +1,247 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantology-modelmaker
3
+ Version: 0.1.0
4
+ Summary: Visual pipeline builder for financial model development
5
+ Author-email: Maurits Malkus <10948172+mmalkus@users.noreply.github.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://www.quantology.nl/
8
+ Project-URL: Repository, https://github.com/mmalkus/Model-Maker
9
+ Project-URL: Issues, https://github.com/mmalkus/Model-Maker/issues
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Financial and Insurance Industry
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Office/Business :: Financial
18
+ Classifier: Topic :: Scientific/Engineering :: Visualization
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ License-File: NOTICE
23
+ Requires-Dist: polars>=1.0.0
24
+ Requires-Dist: fastapi>=0.110.0
25
+ Requires-Dist: uvicorn>=0.29.0
26
+ Requires-Dist: matplotlib>=3.8.0
27
+ Requires-Dist: scikit-learn>=1.4.0
28
+ Requires-Dist: scipy>=1.11.0
29
+ Requires-Dist: python-dotenv>=1.0.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
32
+ Requires-Dist: httpx>=0.27.0; extra == "dev"
33
+ Provides-Extra: anthropic
34
+ Requires-Dist: anthropic>=0.70.0; extra == "anthropic"
35
+ Provides-Extra: tui
36
+ Requires-Dist: textual>=0.80.0; extra == "tui"
37
+ Requires-Dist: httpx>=0.27.0; extra == "tui"
38
+ Requires-Dist: plotext<6,>=5.2.0; extra == "tui"
39
+ Dynamic: license-file
40
+
41
+ # Model-Maker
42
+
43
+ A visual pipeline builder for financial model development in Python, with
44
+ both a web GUI and a terminal UI, and an embedded, pluggable AI provider
45
+ that can draft and fix blocks for you. Blocks contain functional Python
46
+ code, are wired together via Polars DataFrames carrying metadata,
47
+ organized visually into phase-labelled swimlanes, and compile down to a
48
+ single, human-readable, self-contained Python script.
49
+
50
+ See [`modelmaker-v2-plan.md`](modelmaker-v2-plan.md) for the full design.
51
+
52
+ The project has two parts:
53
+
54
+ - **`modelmaker/`** — the Python backend: block registry, graph/session
55
+ model, execution runner, single-file compiler, pluggable AI-assisted
56
+ block drafting, a FastAPI HTTP API, and a Textual-based terminal UI
57
+ (`modelmaker-tui`, see [Terminal UI](#terminal-ui)).
58
+ - **`frontend/`** — a React + Vite web UI for building and running
59
+ pipelines against that API.
60
+
61
+ The [`quantology-modelmaker`](https://pypi.org/project/quantology-modelmaker/)
62
+ package on PyPI ships both: the frontend's built bundle is baked into the
63
+ wheel, so `modelmaker-api` alone serves the whole app on one port with no
64
+ separate frontend build or Node.js install required.
65
+
66
+ ## Install
67
+
68
+ ```bash
69
+ pip install quantology-modelmaker
70
+ modelmaker-api
71
+ ```
72
+
73
+ Then open `http://127.0.0.1:8001` in a browser. Requires Python >= 3.11.
74
+
75
+ Optional extras:
76
+
77
+ ```bash
78
+ pip install "quantology-modelmaker[anthropic]" # call the Anthropic API directly
79
+ pip install "quantology-modelmaker[tui]" # terminal UI, see below
80
+ ```
81
+
82
+ (Optional) the [Claude Code](https://claude.com/claude-code) CLI (`claude`)
83
+ on `PATH` and logged in enables AI-assisted block drafting with no extra
84
+ install — it's the default LLM provider. See [LLM provider](#llm-provider)
85
+ for alternatives that don't need it.
86
+
87
+ ## Quick start (Windows)
88
+
89
+ Download [`run.bat`](run.bat) by itself (no clone needed) and double-click
90
+ it. It creates a `.venv` next to itself if missing, installs/upgrades
91
+ `quantology-modelmaker` into it, and starts `modelmaker-api` at
92
+ `http://127.0.0.1:8001`. Safe to re-run any time to pick up updates.
93
+
94
+ ## The demo project
95
+
96
+ [`projects/demo_pd_model.json`](projects/demo_pd_model.json) is a complete,
97
+ runnable PD pipeline over [`sample_data/pd_model_data.csv`](sample_data):
98
+ load → clean → weight-of-evidence → train/test split → logistic regression →
99
+ Gini, KS and PSI. Open it with **Load** (it's what the file dialog opens on),
100
+ then **Run all** — it reads the CSV source itself since it's never been read
101
+ before, then runs the rest of the pipeline.
102
+
103
+ It's the quickest way to see what a finished graph looks like, and the test
104
+ suite runs it end to end so it can't rot. These files live in the git
105
+ repository rather than the PyPI package — clone the repo (or just download
106
+ those two files) to try it.
107
+
108
+ ## Working in the tool
109
+
110
+ A few things worth knowing beyond the canvas itself.
111
+
112
+ - **Sample mode** — the `Sample` toggle in the top bar caps *every* source at
113
+ the first N rows, so a whole pipeline stays fast to iterate on. It changes
114
+ every block's cache key, so sampled and full results never mix; a banner
115
+ keeps it obvious that what you're looking at isn't the full population.
116
+ Switching back off needs the sources re-read.
117
+ - **Why a block is orange** — a stale block says what made it stale (a param
118
+ it names, a code edit, a re-read source, sample mode), following a cascade
119
+ back to the edit that started it rather than blaming its neighbour.
120
+ - **Undo/redo** — `Ctrl`/`Cmd-Z` and `Ctrl`/`Cmd-Shift-Z`, or the arrows in
121
+ the top bar, over graph edits: adding, deleting, rewiring, renaming,
122
+ retagging and param/code changes. Text fields and the code editor keep
123
+ their own undo. Undo restores the graph, not what you've run: reverting a
124
+ param lands back on a cache key that's already computed, so results you
125
+ already have aren't thrown away.
126
+ - **Unsaved work** — saving to the project file stays explicit (a `•` on the
127
+ Save button marks unsaved edits), but every edit is snapshotted to
128
+ `.modelmaker-cache/recovery.json`. After a crash or a closed browser, the
129
+ app offers to restore it on next start. Nothing ever writes your project
130
+ file behind your back.
131
+ - **Editing during a run** — a run is pinned to the graph as it stood when
132
+ it started, so you can keep editing (or undo, or toggle sample mode) while
133
+ a long sweep executes. The run finishes against its own version; anything
134
+ you changed in the meantime simply shows as stale afterwards, saying so.
135
+ - **Editing block code** — custom/AI-authored blocks use a real code editor
136
+ (syntax highlighting, line numbers, bracket matching, `Ctrl-F` search);
137
+ `Ctrl`/`Cmd-S` saves.
138
+
139
+ ## Terminal UI
140
+
141
+ `modelmaker-tui` (installed by the `tui` extra, see [Install](#install)) is a
142
+ [Textual](https://textual.textualize.io/)-based terminal alternative to the
143
+ web UI, talking to the same backend over the same HTTP API. Lanes render as
144
+ titled, horizontally-scrolling rows of block chips (a free 2D canvas
145
+ doesn't map to a character grid at a readable size) colored by status; a
146
+ Wires panel lists connections as `from.port → to.port` rather than drawn
147
+ ASCII lines. Charts (`generate_image` blocks) render as ANSI plots via
148
+ [plotext](https://github.com/piccolomo/plotext) instead of matplotlib, and
149
+ can be saved to a `.txt`/`.html` file alongside the block's own PNG.
150
+
151
+ ```bash
152
+ modelmaker-tui # spawns its own modelmaker-api, zero setup
153
+ modelmaker-tui projects/demo_pd_model.json # ...and loads a project on startup
154
+ modelmaker-tui --host 127.0.0.1 --port 8001 # attach to an already-running modelmaker-api instead
155
+ ```
156
+
157
+ Standalone mode spawns a real `modelmaker-api` subprocess on a loopback
158
+ port rather than importing the backend in-process -- block execution
159
+ spawns its own `multiprocessing` subprocesses (see `runner.py`), and
160
+ running that inside the same process as the terminal driver risks fd-table
161
+ conflicts between the two. `--host`/`--port` skips spawning and attaches
162
+ to a server you already started (e.g. so the TUI and the web UI can drive
163
+ the same session live).
164
+
165
+ Key bindings (also shown in the footer): arrow keys move block selection;
166
+ `a` adds a block, `Delete` removes the focused block or wires-list row,
167
+ `w` starts/completes a wire (select the source block, `w`, select the
168
+ target block, `w` again); `r` runs the selected block, `Shift+R` runs to
169
+ it, `g`/`Ctrl+G` refresh the selected/all input sources, `Ctrl+R` runs
170
+ all, `x` cancels a run, `m` toggles sample mode; `t` tags a column's role;
171
+ `i` exports the selected block's chart/image; `c` compiles; `Ctrl+D`/
172
+ `Ctrl+F` draft with AI / suggest a fix for the selected block (`Ctrl+A`
173
+ applies the proposal, `Esc` discards it); `Ctrl+S` saves (the project, or
174
+ the block being edited if the inspector has focus), `Ctrl+O` opens,
175
+ `Ctrl+Z`/`Ctrl+Y` undo/redo.
176
+
177
+ ## LLM provider
178
+
179
+ AI-assisted block drafting ("Draft with AI", suggest-a-fix) is pluggable:
180
+
181
+ | Provider | Value | Requirements |
182
+ |---|---|---|
183
+ | Claude Code CLI (default) | `claude_cli` | `claude` binary on `PATH`, logged in (`claude` or `claude /login`) |
184
+ | Anthropic API | `anthropic` | The `anthropic` extra (see [Install](#install)) and an API key (Settings, or `ANTHROPIC_API_KEY` / an `ant auth login` profile) |
185
+ | OpenAI API / OpenAI-compatible endpoint | `openai` | An API key (Settings, or `OPENAI_API_KEY`) and a model id. Defaults to `https://api.openai.com/v1`, but the base URL is configurable — point it at Groq, Together, OpenRouter, Fireworks, Azure OpenAI's `/openai` surface, or a self-hosted vLLM/text-generation-webui server instead |
186
+ | Google Gemini API | `gemini` | An API key (Settings, or `GEMINI_API_KEY` / `GOOGLE_API_KEY`) and a model id, e.g. `gemini-2.5-pro` |
187
+ | LM Studio (local) | `lmstudio` | LM Studio running with its local server started (Developer tab → Start Server) and a model loaded |
188
+ | Stub (no network, deterministic) | `stub` | none — used by default in tests |
189
+
190
+ The `openai` and `gemini` providers talk plain HTTPS via the standard
191
+ library, so they need no extra `pip install`.
192
+
193
+ The **Settings** menu in the app's top bar picks the active provider and,
194
+ per provider, its model, base URL (`lmstudio`/`openai`), and API key
195
+ (`anthropic`/`openai`/`gemini`) — "Fetch" queries the endpoint for the
196
+ models it has available, so you can pick one instead of typing an id by
197
+ hand. A "Include Polars reference examples in prompts" toggle there applies
198
+ to every provider; it's mainly useful for smaller/local models that know
199
+ Polars' shape but not its exact syntax.
200
+
201
+ These are in-memory server settings (no restart needed) that override the
202
+ env vars below when set — including API keys: a key entered in Settings is
203
+ held only in the running server process's memory, is never written to
204
+ disk, and is never sent back to the browser (the settings endpoint reports
205
+ only whether a key is currently set and whether it came from Settings or
206
+ an env var, never the value itself). Like every other setting here, it
207
+ does not survive a server restart — set the corresponding env var instead
208
+ for a value that should.
209
+
210
+ Env vars are still honored as defaults (useful for headless/CI use, or to
211
+ set a starting point before the server starts) -- copy
212
+ [`.env.example`](.env.example) to `.env` and fill in what you need; it's
213
+ loaded automatically on startup (and gitignored, so keys never get
214
+ committed) and a real exported environment variable always overrides it.
215
+ `MODELMAKER_LLM_PROVIDER`
216
+ picks the provider, `MODELMAKER_LLM_MODEL` pins a model, and
217
+ `MODELMAKER_LLM_INCLUDE_REFERENCE` (default on) controls the Polars
218
+ reference toggle. Per provider: `lmstudio` reads `MODELMAKER_LLM_BASE_URL`
219
+ (default `http://localhost:1234/v1`); `openai` reads `OPENAI_API_KEY` (or
220
+ `MODELMAKER_OPENAI_API_KEY`) and `MODELMAKER_OPENAI_BASE_URL`; `gemini`
221
+ reads `GEMINI_API_KEY` / `GOOGLE_API_KEY` (or `MODELMAKER_GEMINI_API_KEY`).
222
+
223
+ ```bash
224
+ export MODELMAKER_LLM_PROVIDER=openai
225
+ export OPENAI_API_KEY=sk-...
226
+ export MODELMAKER_LLM_MODEL=gpt-5.1
227
+ modelmaker-api
228
+ ```
229
+
230
+ ## Project structure
231
+
232
+ ```
233
+ modelmaker/
234
+ api.py FastAPI app and HTTP routes
235
+ blocks/ Block registry (standard library, modelling, stat tests)
236
+ llm/ Pluggable LLM providers for AI-assisted drafting
237
+ graph.py Graph/block/wire data model
238
+ session.py Mutable project session wrapping the graph + runner
239
+ runner.py Block execution + caching engine
240
+ compiler.py Compiles a graph to a single Python script
241
+ packet.py DataFramePacket: the typed value flowing over wires
242
+ project.py Load/save project files (JSON + block source files)
243
+ static/ Built frontend bundle (generated, gitignored)
244
+ frontend/ React + Vite UI
245
+ tests/ Pytest suite for the backend
246
+ sample_data/ Example CSVs for building demo pipelines
247
+ ```