Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
151a201
Add toolbox config types and localStorage-backed store
milanofthe May 3, 2026
d580891
Add Pyodide bridge for runtime toolbox install and introspection
milanofthe May 3, 2026
760e58d
Extend node and event registries with sources and reactive change not…
milanofthe May 3, 2026
548cd4a
Add toolbox wizard, catalog, NodeLibrary integration and bootstrap
milanofthe May 3, 2026
4b7f5f5
Refit toolbox wizard as manager, narrower modal, pill tabs, footer do…
milanofthe May 3, 2026
b50b8b6
Move wizard pills into dialog header, actions back into body, only do…
milanofthe May 3, 2026
9e187ab
Drop trust-step warning icon, unify wizard text colors to text-muted
milanofthe May 3, 2026
b52a98f
Tone down trust step heading to body size and weight
milanofthe May 3, 2026
9c723a8
Heading is just normal text in trust step
milanofthe May 3, 2026
70d6ce5
Remove trust step heading, fold into first paragraph
milanofthe May 3, 2026
cb0e269
Use a plain button for Add toolbox instead of drop-zone style
milanofthe May 3, 2026
1ea5281
Drop catalog description and tags fields
milanofthe May 3, 2026
04eb2c1
Drop unused toolbox exports, helpers and speculative metadata
milanofthe May 3, 2026
25704c9
Rename toolbox wizard to toolbox manager throughout
milanofthe May 3, 2026
8fc3266
Right-align Add toolbox button and unify all manager buttons to defau…
milanofthe May 3, 2026
cef908b
Initialize Pyodide REPL setup before running toolbox install or intro…
milanofthe May 3, 2026
8b7c779
Use pip in Flask backend, micropip in Pyodide, skip when module alrea…
milanofthe May 3, 2026
8b5762e
Render install error as console-style log lines, drop bold red title
milanofthe May 3, 2026
e15cd7c
Unbundle pathsim-chem so it installs as a runtime toolbox via the man…
milanofthe May 3, 2026
fb7fd3a
Refit block selection: custom checkboxes, header toggle, inline overr…
milanofthe May 3, 2026
7d9f275
Move checkbox styling to global app.css and use native input[type=che…
milanofthe May 3, 2026
1db6b5e
Soften checkbox checked state to tinted accent fill with masked accen…
milanofthe May 3, 2026
3641535
Drop light background on row override panel
milanofthe May 3, 2026
d7aaa75
Drop shape override (category determines shape) and remove override r…
milanofthe May 3, 2026
b28aa8a
Bring back shape override sourced from shape registry, add toolbox-wi…
milanofthe May 3, 2026
f36f315
Add syncPorts override toggle for parallel-path blocks
milanofthe May 3, 2026
c373424
Move override row separator: keep below override panel, drop above
milanofthe May 3, 2026
3185da3
Show shape names instead of preview icons in override picker
milanofthe May 3, 2026
ee61256
Hardcode shape options to pill/rect/mixed (the actually used ones)
milanofthe May 3, 2026
5e88958
Truncate long block names with ellipsis instead of overflowing into n…
milanofthe May 3, 2026
a18d50c
Move category from table column into expansion panel, beef up table h…
milanofthe May 3, 2026
e4f8477
Use plain div for shape segmented control so clicks dont reset to def…
milanofthe May 3, 2026
3ab9872
Match runtime introspection to build-time: first-line description, RS…
milanofthe May 3, 2026
ce1c5d6
Unify build-time and runtime introspection in scripts/pathview_intros…
milanofthe May 3, 2026
bbadd4d
Surface runtime-toolbox docstrings in BlockProperties dialog and inst…
milanofthe May 3, 2026
a71d376
Save toolbox dependencies in pvm files; prompt to install missing one…
milanofthe May 3, 2026
c16f2de
Render unknown block types as warning-colored placeholders with dashe…
milanofthe May 3, 2026
2951855
Preload pathsim-chem on first launch via catalog seed; uninstall pers…
milanofthe May 3, 2026
4715f1e
Refactor toolbox seed: required blocks/events, single envelope with s…
milanofthe May 3, 2026
8d2d33b
Drop dead toolbox code: built-in tile, 'done' install state, 'curated…
milanofthe May 3, 2026
07a672b
Validate persisted toolbox configs and shape overrides; fix event par…
milanofthe May 3, 2026
a2f3160
Reconcile saved selections against current discovery on bootstrap, pr…
milanofthe May 3, 2026
1dba4c2
Wire eventRegistryVersion into EventsPanel so runtime events appear w…
milanofthe May 3, 2026
24835d4
Rename last wizard reference in catalog comment
milanofthe May 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 0 additions & 142 deletions pathview/data/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -579,148 +579,6 @@
"blockClass": "Interface",
"importPath": "pathsim.blocks",
"params": []
},
"Process": {
"blockClass": "Process",
"importPath": "pathsim_chem",
"params": [
"tau",
"initial_value",
"source_term"
]
},
"ResidenceTime": {
"blockClass": "ResidenceTime",
"importPath": "pathsim_chem",
"params": [
"tau",
"betas",
"gammas",
"initial_value",
"source_term"
]
},
"Splitter": {
"blockClass": "Splitter",
"importPath": "pathsim_chem",
"params": [
"fractions"
]
},
"Bubbler4": {
"blockClass": "Bubbler4",
"importPath": "pathsim_chem",
"params": [
"conversion_efficiency",
"vial_efficiency",
"replacement_times"
]
},
"GLC": {
"blockClass": "GLC",
"importPath": "pathsim_chem",
"params": [
"P_in",
"L",
"D",
"T",
"BCs",
"g",
"initial_nb_of_elements"
]
},
"CSTR": {
"blockClass": "CSTR",
"importPath": "pathsim_chem",
"params": [
"V",
"F",
"k0",
"Ea",
"n",
"dH_rxn",
"rho",
"Cp",
"UA",
"C_A0",
"T0"
]
},
"PFR": {
"blockClass": "PFR",
"importPath": "pathsim_chem",
"params": [
"N_cells",
"V",
"F",
"k0",
"Ea",
"n",
"dH_rxn",
"rho",
"Cp",
"C0",
"T0"
]
},
"HeatExchanger": {
"blockClass": "HeatExchanger",
"importPath": "pathsim_chem",
"params": [
"N_cells",
"F_h",
"F_c",
"V_h",
"V_c",
"UA",
"rho_h",
"Cp_h",
"rho_c",
"Cp_c",
"T_h0",
"T_c0"
]
},
"FlashDrum": {
"blockClass": "FlashDrum",
"importPath": "pathsim_chem",
"params": [
"holdup",
"antoine_A",
"antoine_B",
"antoine_C",
"N0"
]
},
"Mixer": {
"blockClass": "Mixer",
"importPath": "pathsim_chem",
"params": []
},
"Valve": {
"blockClass": "Valve",
"importPath": "pathsim_chem",
"params": [
"Cv"
]
},
"Heater": {
"blockClass": "Heater",
"importPath": "pathsim_chem",
"params": [
"rho",
"Cp"
]
},
"PointKinetics": {
"blockClass": "PointKinetics",
"importPath": "pathsim_chem",
"params": [
"n0",
"Lambda",
"beta",
"lam"
]
}
},
"events": {
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ dependencies = [
"flask-cors>=4.0",
"numpy",
"waitress>=3.0",
"pathsim",
"pathsim-chem>=0.2.0",
"pathsim==0.20.0",
]

[project.optional-dependencies]
Expand Down
23 changes: 0 additions & 23 deletions scripts/config/pathsim-chem/blocks.json

This file was deleted.

1 change: 0 additions & 1 deletion scripts/config/requirements-pyodide.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
# For Pyodide runtime: "# optional" means installation failure won't block app

pathsim
pathsim-chem>=0.2.0 # optional
125 changes: 14 additions & 111 deletions scripts/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,117 +24,20 @@
from pathlib import Path
from typing import Any


# Optional docutils for RST to HTML conversion
try:
from docutils.core import publish_parts
HAS_DOCUTILS = True
except ImportError:
HAS_DOCUTILS = False
print("Warning: docutils not installed, docstrings will not be converted to HTML")


# =============================================================================
# Shared Utilities
# =============================================================================

def rst_to_html(rst_text: str) -> str:
"""Convert RST docstring to HTML, preserving LaTeX math for KaTeX rendering."""
if not rst_text or not HAS_DOCUTILS:
return ""

# Clean the docstring - removes common leading whitespace from indented docstrings
cleaned = inspect.cleandoc(rst_text)

try:
parts = publish_parts(
cleaned,
writer_name="html",
settings_overrides={
"report_level": 5,
"halt_level": 5,
"initial_header_level": 3,
"math_output": "MathJax",
}
)
return parts["body"]
except Exception as e:
print(f"Warning: Failed to convert docstring to HTML: {e}")
return ""


def extract_first_line(docstring: str) -> str:
"""Extract first line/sentence from docstring as description."""
if not docstring:
return ""

lines = docstring.strip().split("\n")
first_line = ""
for line in lines:
stripped = line.strip()
if stripped:
first_line = stripped
break

if ". " in first_line:
first_line = first_line.split(". ")[0] + "."

return first_line


def extract_param_description(docstring: str, param_name: str) -> str:
"""Extract parameter description from docstring (RST format)."""
if not docstring:
return ""

pattern = rf"{param_name}\s*:\s*[^\n]*\n\s+(.+?)(?=\n\s*\w+\s*:|\n\n|$)"
match = re.search(pattern, docstring, re.DOTALL)
if match:
desc = match.group(1).strip()
desc = re.sub(r"\s+", " ", desc)
return desc

return ""


def infer_param_type(value: Any, param_name: str = "") -> str:
"""Infer parameter type from default value."""
if param_name.startswith('func_') or param_name.startswith('func'):
return "callable"
if callable(value) and not isinstance(value, type):
return "callable"
if isinstance(value, bool):
return "boolean"
if isinstance(value, int):
return "integer"
if isinstance(value, float):
return "number"
if isinstance(value, str):
return "string"
if isinstance(value, (list, tuple)):
return "array"
if value is None:
return "any"
return "any"


def format_default(value: Any) -> str | None:
"""Format default value for TypeScript."""
if value is None:
return None
if callable(value) and not isinstance(value, type):
return None
if isinstance(value, bool):
return "true" if value else "false"
if isinstance(value, (int, float)):
return repr(value)
if isinstance(value, str):
return f'"{value}"'
if isinstance(value, (list, tuple)):
return json.dumps(list(value))
if isinstance(value, type):
return f'"{value.__name__}"'
return repr(value)
# Single source of truth for block/event introspection — also inlined into
# the runtime toolbox installer in src/lib/toolbox/python.ts via Vite ?raw.
sys.path.insert(0, str(Path(__file__).resolve().parent))
from pathview_introspect import ( # noqa: E402
rst_to_html,
first_line as extract_first_line,
param_desc as extract_param_description,
infer_type as infer_param_type,
format_default,
process_port_labels,
extract_block,
extract_event,
extract_params_from_signature,
)


def format_default_py(value: Any) -> str | None:
Expand Down
Loading
Loading