implement_ops¶
- guppyft.encode.implement_ops(hugr_pkg: Package, spec: ImplementOpsSpec, *, as_bytes: Literal[False] = False) Package[source]¶
- guppyft.encode.implement_ops(hugr_pkg: Package, spec: ImplementOpsSpec, *, as_bytes: Literal[True]) bytes
Enriches the given package using the given spec by replacing all operations in the program with function calls to the functions in spec.ops.
- Parameters:
hugr_pkg – A package containing a single module.
spec – The specification for the operation implementation.
as_bytes – Whether to return bytes instead of a Package, skipping final deserialization.
- Returns:
The enriched function as an executable HUGR package, or its serialized representation when as_bytes is True.