ext_tooling
ptwm.ext_tooling.build
ptwm ext build — detect language, run the right toolchain, place the .wasm.
ptwm.ext_tooling.build
ptwm ext build — detect language, run the right toolchain, place the .wasm.
ptwm.ext_tooling.build
python/ptwm/ext_tooling/build.py:1module ptwm.ext_tooling.buildptwm ext build — detect language, run the right toolchain, place the .wasm.
ptwm.ext_tooling.build.build_extension
python/ptwm/ext_tooling/build.py:45def build_extension(cwd: Path, release: bool = True, flavor: str = 'wasm') -> PathBuild the extension in *cwd* and return the path to the produced binary.
| Name | Type | Description |
|---|---|---|
| cwd | Path | Root directory of the extension project (must contain ``manifest.toml``). |
| release = True | bool | When ``True`` (default), build with optimizations enabled. |
| flavor = 'wasm' | str | ``"wasm"`` (default) builds a `wasm32-wasip1` module. ``"native"`` builds a plain cdylib (`.so` / `.dylib`) instead — rust-only. |
Returns
Path — Path to the built binary, placed next to ``manifest.toml``. Raises
BuildError— When language detection or the underlying toolchain invocation fails, or when ``flavor="native"`` is requested for a language that only supports wasm.
ptwm.ext_tooling.build.BuildError
python/ptwm/ext_tooling/build.py:11class BuildError(RuntimeError):Raised when an `ext build` invocation fails.
ptwm.ext_tooling.build.detect_language
python/ptwm/ext_tooling/build.py:15def detect_language(cwd: Path) -> strDetect the build language of an extension project.
| Name | Type | Description |
|---|---|---|
| cwd | Path | Root directory of the extension project. |
Returns
str — One of ``"rust"``, ``"c"``, ``"zig"``, or ``"assemblyscript"``. Raises
BuildError— When no recognised project layout is found.