@@ -19,6 +19,8 @@ TypeScript wrapper for Python libraries with full type safety.
1919
2020- ** Full Type Safety** - TypeScript definitions generated from Python source
2121 analysis
22+ - ** Development Hot Reload** - Real Node watch sessions regenerate wrappers and
23+ swap the active bridge without re-importing generated modules
2224- ** Generic-Aware Declarations** - Preserves simple ` TypeVar ` and callable
2325 ` ParamSpec ` generics in generated ` .ts ` and ` .d.ts ` output
2426- ** Multi-Runtime** - Node.js (subprocess) and browsers (Pyodide)
@@ -62,6 +64,10 @@ For CI (or to verify a dependency upgrade didn’t change the generated surface)
6264npx tywrap generate --check
6365```
6466
67+ For local Node development, ` tywrap/dev ` gives you real hot reload: watch local
68+ Python package trees, regenerate wrappers, and swap the active bridge while
69+ keeping the last known good state if regeneration fails.
70+
6571``` typescript
6672import { NodeBridge } from ' tywrap/node' ;
6773import { setRuntimeBridge } from ' tywrap/runtime' ;
@@ -105,6 +111,31 @@ need the full environment. Large JSONL responses are capped by `maxLineLength`
105111You can cap payload sizes with ` TYWRAP_CODEC_MAX_BYTES ` (responses) and
106112` TYWRAP_REQUEST_MAX_BYTES ` (requests) to keep JSONL traffic bounded.
107113
114+ ## Development Hot Reload
115+
116+ ``` typescript
117+ import { startNodeWatchSession } from ' tywrap/dev' ;
118+ import { NodeBridge } from ' tywrap/node' ;
119+
120+ const session = await startNodeWatchSession ({
121+ configFile: ' ./tywrap.config.ts' ,
122+ createBridge : async config =>
123+ new NodeBridge ({
124+ pythonPath: config .runtime .node ?.pythonPath ?? ' python3' ,
125+ timeoutMs: config .runtime .node ?.timeout ?? 30000 ,
126+ }),
127+ });
128+ ```
129+
130+ - ** Node** : full watch + wrapper regeneration + bridge swap
131+ - ** Pyodide** : use ` createBridgeReloader(...) ` from ` tywrap/dev ` for manual
132+ bridge replacement
133+ - ** HTTP** : restart or redeploy the remote server outside tywrap
134+
135+ The Node watch session manages local package trees, refreshes nested directory
136+ watchers when package layouts change, and keeps the last known good generated
137+ output and bridge active if regeneration returns structured failures.
138+
108139### Browser (Pyodide)
109140
110141``` typescript
0 commit comments