PTWM
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.

pymodule

ptwm.ext_tooling.build

python/ptwm/ext_tooling/build.py:1
module ptwm.ext_tooling.build

ptwm ext build — detect language, run the right toolchain, place the .wasm.

pyfunction

ptwm.ext_tooling.build.build_extension

python/ptwm/ext_tooling/build.py:45
def build_extension(cwd: Path, release: bool = True, flavor: str = 'wasm') -> Path

Build the extension in *cwd* and return the path to the produced binary.

NameTypeDescription
cwdPathRoot directory of the extension project (must contain ``manifest.toml``).
release = TrueboolWhen ``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
PathPath 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.
pyclass

ptwm.ext_tooling.build.BuildError

python/ptwm/ext_tooling/build.py:11
class BuildError(RuntimeError):

Raised when an `ext build` invocation fails.

pyfunction

ptwm.ext_tooling.build.detect_language

python/ptwm/ext_tooling/build.py:15
def detect_language(cwd: Path) -> str

Detect the build language of an extension project.

NameTypeDescription
cwdPathRoot directory of the extension project.
Returns
strOne of ``"rust"``, ``"c"``, ``"zig"``, or ``"assemblyscript"``.
Raises
  • BuildError — When no recognised project layout is found.