tempestweb.transpile¶
The Mode C compiler: it reads the typed-Python app layer and emits native JavaScript. TranspileError carries file:line when the code leaves the supported subset — the error you will meet before any other when porting an app to a static bundle.
Guide with examples: Mode C — transpile.
tempestweb.transpile ¶
Mode C transpiler — typed Python app layer → native JavaScript.
Transcribes a tempestweb app module (state dataclasses + view + handlers) into
an ES module that runs on the native JS runtime (client/transpile/runtime.js),
with zero Python at execution time. See docs/modo-c-transpile.md.
TranspileError ¶
Bases: Exception
A Python construct fell outside the transpilable subset.
Carries the source location so the message reads like a compiler diagnostic
(file:line: <what> is not supported), in the spirit of mypy --strict.
Source code in tempestweb/transpile/errors.py
transpile_source ¶
Transpile Python module source into native-JS module source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
The Python source to transpile. |
required |
filename
|
str
|
Source name for diagnostics and the default banner. |
'<source>'
|
banner
|
str | None
|
Optional leading comment line (see :func: |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The generated JavaScript module source. |
Raises:
| Type | Description |
|---|---|
TranspileError
|
If the module uses a construct outside the subset. |
Source code in tempestweb/transpile/__init__.py
transpile_file ¶
Transpile a Python source file into native-JS module source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to the |
required |
banner
|
str | None
|
Optional leading comment line (see :func: |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The generated JavaScript module source. |
Raises:
| Type | Description |
|---|---|
TranspileError
|
If the module uses a construct outside the subset. |