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) -> Path

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

NameTypeDescription
cwdPathRoot directory of the extension project (must contain ``manifest.toml``).
release = TrueboolWhen ``True`` (default), build with optimizations enabled.
Returns
PathPath to the ``.wasm`` file placed next to ``manifest.toml``.
Raises
  • BuildError — When language detection or the underlying toolchain invocation fails.
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.