tempestweb.transpile¶
O compilador do Modo C: lê a camada de app em Python tipado e emite JavaScript nativo. TranspileError traz file:line quando o código sai do subconjunto suportado — é o erro que você vai encontrar antes de qualquer outro ao portar um app para bundle estático.
Guia com exemplos: Modo 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. |