quantology-modelmaker 0.1.1__tar.gz → 0.1.2__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 (129) hide show
  1. {quantology_modelmaker-0.1.1/quantology_modelmaker.egg-info → quantology_modelmaker-0.1.2}/PKG-INFO +11 -1
  2. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/BlockNode.tsx +4 -0
  3. quantology_modelmaker-0.1.2/frontend/src/EnvVarField.tsx +89 -0
  4. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/Inspector.tsx +18 -3
  5. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/Palette.tsx +3 -1
  6. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/ParamsForm.tsx +112 -0
  7. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/api.ts +6 -0
  8. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/types.ts +24 -1
  9. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/api.py +66 -0
  10. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/blocks/base.py +15 -1
  11. quantology_modelmaker-0.1.2/modelmaker/blocks/data_quality.py +297 -0
  12. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/blocks/library.py +128 -2
  13. quantology_modelmaker-0.1.2/modelmaker/blocks/stochastic.py +858 -0
  14. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/compiler.py +18 -1
  15. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/graph.py +16 -0
  16. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/run_worker.py +66 -0
  17. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/runner.py +240 -4
  18. quantology_modelmaker-0.1.2/modelmaker/stochastic/__init__.py +12 -0
  19. quantology_modelmaker-0.1.2/modelmaker/stochastic/accumulate.py +174 -0
  20. quantology_modelmaker-0.1.2/modelmaker/stochastic/credit.py +107 -0
  21. quantology_modelmaker-0.1.2/modelmaker/stochastic/dependency.py +118 -0
  22. quantology_modelmaker-0.1.2/modelmaker/stochastic/distributions.py +200 -0
  23. quantology_modelmaker-0.1.2/modelmaker/stochastic/proxy.py +137 -0
  24. quantology_modelmaker-0.1.2/modelmaker/stochastic/seed.py +28 -0
  25. quantology_modelmaker-0.1.2/modelmaker/stochastic/var_covar.py +206 -0
  26. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/pyproject.toml +13 -2
  27. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2/quantology_modelmaker.egg-info}/PKG-INFO +11 -1
  28. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/quantology_modelmaker.egg-info/SOURCES.txt +19 -0
  29. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/quantology_modelmaker.egg-info/requires.txt +12 -0
  30. quantology_modelmaker-0.1.2/tests/test_data_quality.py +155 -0
  31. quantology_modelmaker-0.1.2/tests/test_env_vars.py +91 -0
  32. quantology_modelmaker-0.1.2/tests/test_input_blocks.py +241 -0
  33. quantology_modelmaker-0.1.2/tests/test_stochastic_blocks.py +213 -0
  34. quantology_modelmaker-0.1.2/tests/test_stochastic_core.py +334 -0
  35. quantology_modelmaker-0.1.2/tests/test_stochastic_credit.py +231 -0
  36. quantology_modelmaker-0.1.2/tests/test_stochastic_fan_out.py +209 -0
  37. quantology_modelmaker-0.1.2/tests/test_stochastic_runner.py +95 -0
  38. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/LICENSE +0 -0
  39. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/MANIFEST.in +0 -0
  40. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/NOTICE +0 -0
  41. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/README.md +0 -0
  42. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/.gitignore +0 -0
  43. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/.npmrc +0 -0
  44. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/.oxlintrc.json +0 -0
  45. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/README.md +0 -0
  46. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/index.html +0 -0
  47. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/package-lock.json +0 -0
  48. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/package.json +0 -0
  49. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/public/brand-quantology/favicon.svg +0 -0
  50. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/public/brand-quantology/icon-mark-light.svg +0 -0
  51. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/public/icons.svg +0 -0
  52. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/App.tsx +0 -0
  53. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/CodeEditor.tsx +0 -0
  54. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/DataModal.tsx +0 -0
  55. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/DataWireEdge.tsx +0 -0
  56. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/FileBrowser.tsx +0 -0
  57. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/GitPanel.tsx +0 -0
  58. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/LaneBand.tsx +0 -0
  59. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/LaneLabels.tsx +0 -0
  60. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/PortDataView.tsx +0 -0
  61. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/PortInspector.tsx +0 -0
  62. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/SettingsPanel.tsx +0 -0
  63. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/Toolbar.tsx +0 -0
  64. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/assets/hero.png +0 -0
  65. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/assets/react.svg +0 -0
  66. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/assets/vite.svg +0 -0
  67. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/index.css +0 -0
  68. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/main.tsx +0 -0
  69. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/src/roles.ts +0 -0
  70. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/tsconfig.app.json +0 -0
  71. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/tsconfig.json +0 -0
  72. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/tsconfig.node.json +0 -0
  73. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/frontend/vite.config.ts +0 -0
  74. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/__init__.py +0 -0
  75. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/blocks/__init__.py +0 -0
  76. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/blocks/feature_analysis.py +0 -0
  77. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/blocks/modelling.py +0 -0
  78. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/blocks/stat_tests.py +0 -0
  79. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/cache.py +0 -0
  80. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/gitops.py +0 -0
  81. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/llm/__init__.py +0 -0
  82. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/llm/anthropic_provider.py +0 -0
  83. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/llm/base.py +0 -0
  84. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/llm/claude_cli_provider.py +0 -0
  85. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/llm/gemini_provider.py +0 -0
  86. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/llm/lmstudio_provider.py +0 -0
  87. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/llm/openai_provider.py +0 -0
  88. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/llm/prompts.py +0 -0
  89. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/llm/settings.py +0 -0
  90. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/llm/stub_provider.py +0 -0
  91. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/metadata_transforms.py +0 -0
  92. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/packet.py +0 -0
  93. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/project.py +0 -0
  94. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/session.py +0 -0
  95. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/tui/__init__.py +0 -0
  96. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/tui/app.py +0 -0
  97. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/tui/canvas.py +0 -0
  98. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/tui/charts.py +0 -0
  99. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/tui/client.py +0 -0
  100. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/tui/inspector.py +0 -0
  101. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/tui/paramspecs.py +0 -0
  102. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/tui/preview.py +0 -0
  103. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/tui/screens.py +0 -0
  104. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/modelmaker/util.py +0 -0
  105. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/quantology_modelmaker.egg-info/dependency_links.txt +0 -0
  106. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/quantology_modelmaker.egg-info/entry_points.txt +0 -0
  107. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/quantology_modelmaker.egg-info/top_level.txt +0 -0
  108. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/run.bat +0 -0
  109. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/setup.cfg +0 -0
  110. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/setup.py +0 -0
  111. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_api.py +0 -0
  112. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_compiler.py +0 -0
  113. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_demo_project.py +0 -0
  114. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_feature_analysis.py +0 -0
  115. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_gitops.py +0 -0
  116. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_graph.py +0 -0
  117. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_library.py +0 -0
  118. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_llm.py +0 -0
  119. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_master_scale.py +0 -0
  120. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_modelling.py +0 -0
  121. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_packet.py +0 -0
  122. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_project.py +0 -0
  123. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_runner.py +0 -0
  124. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_runner_streaming.py +0 -0
  125. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_session.py +0 -0
  126. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_stat_tests.py +0 -0
  127. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_tui_app.py +0 -0
  128. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_tui_charts.py +0 -0
  129. {quantology_modelmaker-0.1.1 → quantology_modelmaker-0.1.2}/tests/test_tui_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantology-modelmaker
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Visual pipeline builder for financial model development
5
5
  Author-email: Maurits Malkus <10948172+mmalkus@users.noreply.github.com>
6
6
  License-Expression: Apache-2.0
@@ -26,16 +26,26 @@ Requires-Dist: uvicorn>=0.29.0
26
26
  Requires-Dist: matplotlib>=3.8.0
27
27
  Requires-Dist: scikit-learn>=1.4.0
28
28
  Requires-Dist: scipy>=1.11.0
29
+ Requires-Dist: numpy>=1.26.0
29
30
  Requires-Dist: python-dotenv>=1.0.0
30
31
  Provides-Extra: dev
31
32
  Requires-Dist: pytest>=8.0.0; extra == "dev"
32
33
  Requires-Dist: httpx>=0.27.0; extra == "dev"
34
+ Requires-Dist: fastexcel>=0.10.0; extra == "dev"
35
+ Requires-Dist: xlsxwriter>=3.0.0; extra == "dev"
36
+ Requires-Dist: connectorx>=0.3.3; extra == "dev"
37
+ Requires-Dist: pyarrow>=16.0.0; extra == "dev"
33
38
  Provides-Extra: anthropic
34
39
  Requires-Dist: anthropic>=0.70.0; extra == "anthropic"
35
40
  Provides-Extra: tui
36
41
  Requires-Dist: textual>=0.80.0; extra == "tui"
37
42
  Requires-Dist: httpx>=0.27.0; extra == "tui"
38
43
  Requires-Dist: plotext<6,>=5.2.0; extra == "tui"
44
+ Provides-Extra: excel
45
+ Requires-Dist: fastexcel>=0.10.0; extra == "excel"
46
+ Provides-Extra: db
47
+ Requires-Dist: connectorx>=0.3.3; extra == "db"
48
+ Requires-Dist: pyarrow>=16.0.0; extra == "db"
39
49
  Dynamic: license-file
40
50
 
41
51
  # Model-Maker
@@ -19,6 +19,10 @@ const PORT_BADGE: Record<PortType, { icon: string; label: string; color: string
19
19
  image: { icon: '▨', label: 'image', color: '#ea580c' },
20
20
  master_scale: { icon: '▤', label: 'scale', color: '#0891b2' },
21
21
  any: { icon: '?', label: 'value', color: '#6b7280' },
22
+ distribution: { icon: '~', label: 'distribution', color: '#db2777' },
23
+ dependency: { icon: '⋈', label: 'dependency', color: '#4338ca' },
24
+ proxy_function: { icon: '≈', label: 'proxy', color: '#b45309' },
25
+ simulation_result: { icon: '◈', label: 'sim result', color: '#0d9488' },
22
26
  }
23
27
 
24
28
  function formatParamValue(v: unknown): string {
@@ -0,0 +1,89 @@
1
+ import { useEffect, useState } from 'react'
2
+ import { api } from './api'
3
+ import type { EnvVarStatus } from './types'
4
+
5
+ // Lets the user set an env var's value straight from the UI -- e.g. a Read
6
+ // SQL block's connection_env -- instead of having to edit a .env file or
7
+ // export it in their shell before starting the server. The value itself
8
+ // never comes back from the API (see types.EnvVarStatus); only whether
9
+ // it's set, and whether that came from here ("override", session-only) or
10
+ // was already present in the environment ("env").
11
+ export function EnvVarField({ name }: { name: string }) {
12
+ const [status, setStatus] = useState<EnvVarStatus | null>(null)
13
+ const [value, setValue] = useState('')
14
+ const [busy, setBusy] = useState(false)
15
+ const [error, setError] = useState<string | null>(null)
16
+
17
+ useEffect(() => {
18
+ setStatus(null)
19
+ setValue('')
20
+ setError(null)
21
+ const trimmed = name.trim()
22
+ if (!trimmed) return
23
+ api
24
+ .envVar(trimmed)
25
+ .then(setStatus)
26
+ .catch((e) => setError((e as Error).message))
27
+ }, [name])
28
+
29
+ const trimmedName = name.trim()
30
+ if (!trimmedName) return null
31
+
32
+ const save = () => {
33
+ if (!value.trim()) return
34
+ setBusy(true)
35
+ api
36
+ .setEnvVar(trimmedName, value)
37
+ .then((s) => {
38
+ setStatus(s)
39
+ setValue('')
40
+ setError(null)
41
+ })
42
+ .catch((e) => setError((e as Error).message))
43
+ .finally(() => setBusy(false))
44
+ }
45
+
46
+ const clear = () => {
47
+ setBusy(true)
48
+ api
49
+ .clearEnvVar(trimmedName)
50
+ .then(setStatus)
51
+ .catch((e) => setError((e as Error).message))
52
+ .finally(() => setBusy(false))
53
+ }
54
+
55
+ return (
56
+ <div style={{ marginBottom: 12 }}>
57
+ <div style={{ fontWeight: 600, marginBottom: 4 }}>Env var: {trimmedName}</div>
58
+ <div style={{ fontSize: 11, color: '#6b7280', marginBottom: 4 }}>
59
+ {status === null
60
+ ? '…'
61
+ : status.is_set
62
+ ? status.source === 'override'
63
+ ? 'Set for this session only -- not saved to disk, gone on restart.'
64
+ : 'Already set from your shell environment or .env file.'
65
+ : 'Not set -- the block will fail to read this until it is.'}
66
+ </div>
67
+ <div style={{ display: 'flex', gap: 6 }}>
68
+ <input
69
+ type="password"
70
+ value={value}
71
+ onChange={(e) => setValue(e.target.value)}
72
+ onKeyDown={(e) => e.key === 'Enter' && save()}
73
+ placeholder="paste value, e.g. postgresql://user:pass@host/db"
74
+ disabled={busy}
75
+ style={{ flex: 1, fontFamily: 'monospace', fontSize: 11, boxSizing: 'border-box' }}
76
+ />
77
+ <button disabled={busy || !value.trim()} onClick={save}>
78
+ Set
79
+ </button>
80
+ {status?.source === 'override' && (
81
+ <button disabled={busy} onClick={clear}>
82
+ Clear
83
+ </button>
84
+ )}
85
+ </div>
86
+ {error && <div style={{ color: '#b91c1c', fontSize: 11 }}>{error}</div>}
87
+ </div>
88
+ )
89
+ }
@@ -2,10 +2,21 @@ import { useEffect, useRef, useState } from 'react'
2
2
  import { api } from './api'
3
3
  import { CodeEditor } from './CodeEditor'
4
4
  import { DataModal } from './DataModal'
5
+ import { EnvVarField } from './EnvVarField'
5
6
  import { FileBrowser } from './FileBrowser'
6
7
  import { PARAM_SPECS, ParamsForm, deriveColumnFieldSpecs } from './ParamsForm'
7
8
  import type { BlockOut, DraftOut, PreviewOut, SchemaColumn } from './types'
8
9
 
10
+ // File-based input blocks that read a single `path` param off disk (see
11
+ // modelmaker/blocks/library.py) -- each gets the same "Browse..." file
12
+ // picker in the inspector, filtered to its own extension.
13
+ const FILE_INPUT_BLOCKS: Record<string, { label: string; ext: string }> = {
14
+ read_csv: { label: 'CSV file', ext: '.csv' },
15
+ read_parquet: { label: 'Parquet file', ext: '.parquet' },
16
+ read_json: { label: 'JSON file', ext: '.json' },
17
+ read_excel: { label: 'Excel file', ext: '.xlsx' },
18
+ }
19
+
9
20
  export function Inspector({
10
21
  block,
11
22
  onChanged,
@@ -405,9 +416,9 @@ export function Inspector({
405
416
  <MetricView key={name} name={name} value={value} />
406
417
  ))}
407
418
 
408
- {block.category === 'read_csv' && (
419
+ {FILE_INPUT_BLOCKS[block.category] && (
409
420
  <div style={{ marginBottom: 12 }}>
410
- <div style={{ fontWeight: 600, marginBottom: 4 }}>CSV file</div>
421
+ <div style={{ fontWeight: 600, marginBottom: 4 }}>{FILE_INPUT_BLOCKS[block.category].label}</div>
411
422
  <div style={{ display: 'flex', gap: 6 }}>
412
423
  <input
413
424
  readOnly
@@ -422,6 +433,8 @@ export function Inspector({
422
433
  </div>
423
434
  )}
424
435
 
436
+ {block.category === 'read_sql' && <EnvVarField name={(block.params.connection_env as string) ?? ''} />}
437
+
425
438
  {block.category !== 'display_table' && (
426
439
  <div style={{ marginBottom: 12 }}>
427
440
  <div style={{ fontWeight: 600, marginBottom: 4 }}>Params</div>
@@ -618,7 +631,9 @@ export function Inspector({
618
631
  />
619
632
  )}
620
633
 
621
- {showBrowser && <FileBrowser ext=".csv" onPick={pickPath} onClose={() => setShowBrowser(false)} />}
634
+ {showBrowser && (
635
+ <FileBrowser ext={FILE_INPUT_BLOCKS[block.category]?.ext ?? '.csv'} onPick={pickPath} onClose={() => setShowBrowser(false)} />
636
+ )}
622
637
  </div>
623
638
  )
624
639
  }
@@ -40,11 +40,13 @@ function InlineAdd({ placeholder, onSubmit }: { placeholder: string; onSubmit: (
40
40
  )
41
41
  }
42
42
 
43
- const GROUP_ORDER = ['input', 'standard', 'modelling', 'tests', 'output']
43
+ const GROUP_ORDER = ['input', 'standard', 'quality', 'modelling', 'stochastic', 'tests', 'output']
44
44
  const GROUP_LABELS: Record<string, string> = {
45
45
  input: 'Input',
46
46
  standard: 'Standard',
47
+ quality: 'Data quality',
47
48
  modelling: 'Modelling',
49
+ stochastic: 'Stochastic',
48
50
  tests: 'Tests',
49
51
  output: 'Output',
50
52
  }
@@ -31,6 +31,21 @@ export const PARAM_SPECS: Record<string, FieldSpec[]> = {
31
31
  { key: 'seed', label: 'Random seed', kind: 'number' },
32
32
  ],
33
33
  write_csv: [{ key: 'filename', label: 'Output filename', kind: 'text', placeholder: 'output.csv' }],
34
+ read_excel: [{ key: 'sheet', label: 'Sheet name (optional -- defaults to the first sheet)', kind: 'text' }],
35
+ read_sql: [
36
+ {
37
+ key: 'connection_env',
38
+ label: 'Connection env var (holds the DB URI, e.g. postgresql://user:pass@host/db)',
39
+ kind: 'text',
40
+ placeholder: 'WAREHOUSE_DB_URL',
41
+ },
42
+ { key: 'query', label: 'SQL query', kind: 'text', placeholder: 'SELECT * FROM loans' },
43
+ {
44
+ key: 'probe_query',
45
+ label: 'Check-for-changes query (optional, e.g. SELECT COUNT(*) FROM loans)',
46
+ kind: 'text',
47
+ },
48
+ ],
34
49
  generate_image: [
35
50
  { key: 'kind', label: 'Chart type', kind: 'select', options: ['hist', 'bar', 'scatter', 'line'] },
36
51
  { key: 'x', label: 'X column', kind: 'column' },
@@ -112,6 +127,103 @@ export const PARAM_SPECS: Record<string, FieldSpec[]> = {
112
127
  { key: 'predicted_col', label: 'Predicted column', kind: 'column', autoRole: 'predicted' },
113
128
  { key: 'bins', label: 'Bins', kind: 'number' },
114
129
  ],
130
+ // Stochastic engine blocks (see /stochastic-engine-proposal.md and
131
+ // modelmaker/blocks/stochastic.py). Boolean params (spliced_tail,
132
+ // keep_paths) and list-of-float params (alpha_levels) are deliberately
133
+ // left out of these specs -- there's no FieldSpec 'boolean' kind, and
134
+ // modelling one as a 'select' of the strings 'true'/'false' would set a
135
+ // truthy *string* value ('false' is still truthy in Python), so both
136
+ // fall back to the JSON textarea where they can be real JSON literals.
137
+ fit_distribution: [{ key: 'column', label: 'Column to fit', kind: 'column' }],
138
+ sample_distribution: [
139
+ { key: 'n', label: 'Number of samples', kind: 'number' },
140
+ { key: 'seed', label: 'Random seed', kind: 'number' },
141
+ ],
142
+ build_dependency: [
143
+ { key: 'columns', label: 'Columns', kind: 'columns' },
144
+ { key: 'copula_type', label: 'Copula', kind: 'select', options: ['gaussian', 't', 'clayton', 'gumbel'] },
145
+ { key: 'dof', label: 'Degrees of freedom (t copula)', kind: 'number' },
146
+ { key: 'theta', label: 'Theta (Clayton / Gumbel)', kind: 'number', step: 0.1 },
147
+ ],
148
+ simulate_op_risk_lda: [
149
+ { key: 'n_paths', label: 'Number of paths', kind: 'number' },
150
+ { key: 'chunk_size', label: 'Chunk size', kind: 'number' },
151
+ { key: 'frequency_family', label: 'Frequency family', kind: 'select', options: ['poisson', 'negbinom'] },
152
+ { key: 'frequency_mean', label: 'Frequency mean', kind: 'number', step: 0.1 },
153
+ { key: 'frequency_dispersion', label: 'Frequency dispersion (negbinom)', kind: 'number', step: 0.1 },
154
+ { key: 'n_bootstrap', label: 'Bootstrap replicates', kind: 'number' },
155
+ { key: 'seed', label: 'Random seed', kind: 'number' },
156
+ ],
157
+ risk_measures: [
158
+ { key: 'column', label: 'Loss column', kind: 'column' },
159
+ { key: 'n_bootstrap', label: 'Bootstrap replicates', kind: 'number' },
160
+ { key: 'seed', label: 'Random seed', kind: 'number' },
161
+ ],
162
+ asrf_economic_capital: [
163
+ { key: 'pd_col', label: 'PD column', kind: 'column' },
164
+ { key: 'lgd_col', label: 'LGD column', kind: 'column' },
165
+ { key: 'ead_col', label: 'EAD column', kind: 'column' },
166
+ { key: 'confidence', label: 'Confidence level', kind: 'number', step: 0.001 },
167
+ // 'correlation' is a float OR the string "basel_corporate" -- a
168
+ // 'select' field can't offer "pick a fixed number, or this preset", so
169
+ // it's left to the JSON textarea (e.g. "basel_corporate" or 0.15).
170
+ ],
171
+ simulate_credit_portfolio: [
172
+ { key: 'pd_col', label: 'PD column', kind: 'column' },
173
+ { key: 'lgd_col', label: 'LGD column', kind: 'column' },
174
+ { key: 'ead_col', label: 'EAD column', kind: 'column' },
175
+ { key: 'sector_col', label: 'Sector column (must match the dependency labels)', kind: 'column' },
176
+ { key: 'name_col', label: 'Segment name column (optional)', kind: 'column' },
177
+ { key: 'n_paths', label: 'Number of paths', kind: 'number' },
178
+ { key: 'chunk_size', label: 'Chunk size', kind: 'number' },
179
+ { key: 'n_bootstrap', label: 'Bootstrap replicates', kind: 'number' },
180
+ { key: 'seed', label: 'Random seed', kind: 'number' },
181
+ // 'correlation' -- see asrf_economic_capital above, same reason it's
182
+ // left to the JSON textarea.
183
+ ],
184
+ aggregate_simulation: [
185
+ { key: 'n_bootstrap', label: 'Bootstrap replicates', kind: 'number' },
186
+ { key: 'seed', label: 'Random seed', kind: 'number' },
187
+ {
188
+ key: 'contributions_method',
189
+ label: 'Contributions',
190
+ kind: 'select',
191
+ options: ['euler', 'shapley'],
192
+ },
193
+ ],
194
+ fit_proxy: [
195
+ { key: 'value_col', label: 'Value column (polynomial)', kind: 'column' },
196
+ { key: 'method', label: 'Method', kind: 'select', options: ['closed_form', 'polynomial'] },
197
+ { key: 'expr', label: 'Expression (closed_form)', kind: 'text', placeholder: 'x + 0.5 * y' },
198
+ { key: 'degree', label: 'Degree (polynomial)', kind: 'number' },
199
+ { key: 'regressor', label: 'Regressor (polynomial)', kind: 'select', options: ['ridge', 'lasso', 'ols'] },
200
+ { key: 'alpha', label: 'Regularization (ridge / lasso)', kind: 'number', step: 0.1 },
201
+ ],
202
+ validate_proxy: [{ key: 'value_col', label: 'Actual value column', kind: 'column' }],
203
+ var_covar_aggregate: [
204
+ { key: 'method', label: 'Method', kind: 'select', options: ['normal', 'cornish_fisher', 'moment_matching', 'delta_gamma_copula'] },
205
+ { key: 'bump_size', label: 'Bump size', kind: 'number', step: 0.001 },
206
+ { key: 'n_mc', label: 'Monte Carlo draws (non-normal methods)', kind: 'number' },
207
+ { key: 'seed', label: 'Random seed', kind: 'number' },
208
+ ],
209
+ // Graph fan-out (see /stochastic-engine-proposal.md S4). There's no
210
+ // FieldSpec kind for "pick another block on the canvas", so `collect`'s
211
+ // `iterate_block` param -- the id of its paired `iterate` block -- stays
212
+ // a plain text field; find the id from the `iterate` block's inspector
213
+ // panel. A visually distinguished fan-out region on the canvas itself is
214
+ // a follow-up (see the proposal's Implementation status section).
215
+ iterate: [
216
+ { key: 'n_iterations', label: 'Iterations', kind: 'number' },
217
+ { key: 'iterator', label: 'Iterator', kind: 'select', options: ['bootstrap_resample', 'scenario_row'] },
218
+ { key: 'seed', label: 'Random seed', kind: 'number' },
219
+ ],
220
+ collect: [
221
+ { key: 'iterate_block', label: "Paired 'iterate' block id", kind: 'text', placeholder: 'b_042' },
222
+ { key: 'reducer', label: 'Reducer', kind: 'select', options: ['concat', 'risk_measures'] },
223
+ { key: 'value_col', label: 'Value column (risk_measures)', kind: 'column' },
224
+ { key: 'n_bootstrap', label: 'Bootstrap replicates (risk_measures)', kind: 'number' },
225
+ { key: 'seed', label: 'Random seed (risk_measures)', kind: 'number' },
226
+ ],
115
227
  }
116
228
 
117
229
  function prettifyColumnParamLabel(key: string): string {
@@ -6,6 +6,7 @@ import type {
6
6
  BlockType,
7
7
  BrowseOut,
8
8
  DraftOut,
9
+ EnvVarStatus,
9
10
  GitStatusOut,
10
11
  GraphOut,
11
12
  InputSchemaOut,
@@ -150,6 +151,11 @@ export const api = {
150
151
  return request<BrowseOut>(`/browse${qs ? `?${qs}` : ''}`)
151
152
  },
152
153
 
154
+ envVar: (name: string) => request<EnvVarStatus>(`/env_vars/${encodeURIComponent(name)}`),
155
+ setEnvVar: (name: string, value: string) =>
156
+ request<EnvVarStatus>(`/env_vars/${encodeURIComponent(name)}`, { method: 'PUT', body: JSON.stringify({ value }) }),
157
+ clearEnvVar: (name: string) => request<EnvVarStatus>(`/env_vars/${encodeURIComponent(name)}`, { method: 'DELETE' }),
158
+
153
159
  llmSettings: () => request<LLMSettingsOut>('/llm/settings'),
154
160
  updateLlmSettings: (body: {
155
161
  active_provider?: string
@@ -1,5 +1,18 @@
1
1
  export type Status = 'grey' | 'green' | 'orange' | 'red' | 'running'
2
- export type PortType = 'dataframe' | 'model' | 'scalar_metric' | 'image' | 'master_scale' | 'any'
2
+ export type PortType =
3
+ | 'dataframe'
4
+ | 'model'
5
+ | 'scalar_metric'
6
+ | 'image'
7
+ | 'master_scale'
8
+ | 'any'
9
+ // Stochastic engine port types (see /stochastic-engine-proposal.md) --
10
+ // each is a plain JSON-shaped dict, rendered by PortDataView's generic
11
+ // JSON fallback view exactly like 'model'/'scalar_metric' already are.
12
+ | 'distribution'
13
+ | 'dependency'
14
+ | 'proxy_function'
15
+ | 'simulation_result'
3
16
  export type BlockType = 'input' | 'standard' | 'output'
4
17
 
5
18
  export interface PortSpec {
@@ -213,6 +226,16 @@ export interface LLMSettingsOut {
213
226
  settings: Record<string, LLMProviderSettings>
214
227
  }
215
228
 
229
+ export interface EnvVarStatus {
230
+ name: string
231
+ // Whether the var is currently set -- the value itself is never sent to
232
+ // the client (see api.EnvVarUpdate). 'override' means it was set via
233
+ // PUT /api/env_vars/{name} for this server process; 'env' means it was
234
+ // already present (shell env or .env) before that.
235
+ is_set: boolean
236
+ source: 'override' | 'env' | null
237
+ }
238
+
216
239
  export interface GitChange {
217
240
  status: string
218
241
  path: string
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
  import functools
4
4
  import inspect
5
5
  import os
6
+ import re
6
7
  import threading
7
8
  from dataclasses import asdict
8
9
  from pathlib import Path
@@ -16,10 +17,12 @@ from pydantic import BaseModel
16
17
 
17
18
  from . import blocks as _blocks_pkg # noqa: F401 -- populates BLOCK_REGISTRY
18
19
  from . import gitops, project
20
+ from .blocks import data_quality as _data_quality # noqa: F401
19
21
  from .blocks import feature_analysis as _feature_analysis # noqa: F401
20
22
  from .blocks import library as _library # noqa: F401
21
23
  from .blocks import modelling as _modelling # noqa: F401
22
24
  from .blocks import stat_tests as _stat_tests # noqa: F401
25
+ from .blocks import stochastic as _stochastic # noqa: F401
23
26
  from .blocks.base import BLOCK_REGISTRY
24
27
  from .compiler import CompileError, compile_graph
25
28
  from .llm import ColumnInfo, DraftContext, LLM_PROVIDER_REGISTRY, LLMProvider, get_provider
@@ -56,6 +59,17 @@ app.add_middleware(
56
59
  SESSION = ProjectSession()
57
60
  LLM_SETTINGS = LLMSettingsStore()
58
61
 
62
+ # Names set via PUT /api/env_vars (see below) -- lets the Settings-style
63
+ # "is this set, and from where" distinction (env vs. override) extend to
64
+ # arbitrary env vars too, e.g. a Read SQL block's connection_env. The value
65
+ # itself lives only in os.environ, exactly where a block reading it (live
66
+ # or compiled) already looks, and is never stored or echoed anywhere else.
67
+ # Maps name -> whatever os.environ held right before the first override (or
68
+ # None if it was unset), so DELETE can restore that instead of just wiping
69
+ # a name that happened to already be set from the shell/.env.
70
+ _ENV_VAR_OVERRIDES: dict[str, str | None] = {}
71
+ _ENV_VAR_NAME_RE = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*$")
72
+
59
73
  # Run orchestration: at most one run (a single block, a cascade, or a full
60
74
  # sweep) is active at a time, executed on a background thread so a run that
61
75
  # genuinely takes a while -- above all a heavily-grouped block, the case
@@ -1027,6 +1041,58 @@ def update_llm_settings(req: LLMSettingsUpdate) -> dict[str, Any]:
1027
1041
  return _effective_llm_settings()
1028
1042
 
1029
1043
 
1044
+ class EnvVarUpdate(BaseModel):
1045
+ value: str
1046
+
1047
+
1048
+ def _env_var_status(name: str) -> dict[str, Any]:
1049
+ """Whether-and-where a given env var is set -- never the value itself.
1050
+ Same write-only shape as an LLM provider's api_key_set/api_key_source
1051
+ (see _redacted_provider_settings): 'override' means this endpoint set
1052
+ it for the running server process; 'env' means it was already present
1053
+ (shell env or .env) before that."""
1054
+ if name not in os.environ:
1055
+ return {"name": name, "is_set": False, "source": None}
1056
+ return {"name": name, "is_set": True, "source": "override" if name in _ENV_VAR_OVERRIDES else "env"}
1057
+
1058
+
1059
+ @app.get("/api/env_vars/{name}")
1060
+ def get_env_var(name: str) -> dict[str, Any]:
1061
+ return _env_var_status(name)
1062
+
1063
+
1064
+ @app.put("/api/env_vars/{name}")
1065
+ def set_env_var(name: str, req: EnvVarUpdate) -> dict[str, Any]:
1066
+ """Sets an env var for the rest of this server process's lifetime --
1067
+ e.g. a Read SQL block's connection string. Deliberately writes straight
1068
+ into os.environ (unlike LLM_SETTINGS' own separate override dict):
1069
+ block functions run in a spawned subprocess (see runner.MP_CONTEXT),
1070
+ which inherits the parent's *current* os.environ at spawn time, so this
1071
+ is what actually makes the value visible there. Never written to disk,
1072
+ never persisted in a project file, and never echoed back by any
1073
+ endpoint -- gone on restart, exactly like an LLM API key override."""
1074
+ if not _ENV_VAR_NAME_RE.match(name):
1075
+ raise HTTPException(400, f"not a valid environment variable name: {name!r}")
1076
+ if name not in _ENV_VAR_OVERRIDES:
1077
+ _ENV_VAR_OVERRIDES[name] = os.environ.get(name)
1078
+ os.environ[name] = req.value
1079
+ return _env_var_status(name)
1080
+
1081
+
1082
+ @app.delete("/api/env_vars/{name}")
1083
+ def clear_env_var(name: str) -> dict[str, Any]:
1084
+ # Restores whatever this name held before it was first overridden
1085
+ # (possibly nothing) -- a name that was already present in the
1086
+ # shell/.env before any PUT here is left alone entirely.
1087
+ if name in _ENV_VAR_OVERRIDES:
1088
+ prior = _ENV_VAR_OVERRIDES.pop(name)
1089
+ if prior is None:
1090
+ os.environ.pop(name, None)
1091
+ else:
1092
+ os.environ[name] = prior
1093
+ return _env_var_status(name)
1094
+
1095
+
1030
1096
  @app.get("/api/llm/models")
1031
1097
  def list_llm_models(provider: str, base_url: str | None = None) -> dict[str, list[str]]:
1032
1098
  """Query a provider for the models it currently has available -- used by
@@ -3,7 +3,21 @@ from __future__ import annotations
3
3
  from dataclasses import dataclass
4
4
  from typing import Any, Callable, Literal
5
5
 
6
- PortType = Literal["dataframe", "model", "scalar_metric", "image", "master_scale", "any"]
6
+ PortType = Literal[
7
+ "dataframe",
8
+ "model",
9
+ "scalar_metric",
10
+ "image",
11
+ "master_scale",
12
+ "any",
13
+ # Stochastic engine port types (see /stochastic-engine-proposal.md S2) --
14
+ # each is a plain JSON-shaped dict, same "no special deserializer"
15
+ # convention as "model" above, not a custom packet class.
16
+ "distribution",
17
+ "dependency",
18
+ "proxy_function",
19
+ "simulation_result",
20
+ ]
7
21
  # Pipeline role only -- governs runtime behavior (input blocks need no
8
22
  # upstream and support refresh/probe; output blocks may take an injected
9
23
  # output_dir). Orthogonal to where a block's code comes from: see