Definitions

class guppylang.defs.GuppyDefinition(wrapped: Definition)[source]

A general Guppy definition.

compile() Package[source]

Compile a Guppy definition to HUGR.

check() None[source]

Type-check a Guppy definition.

class guppylang.defs.GuppyFunctionDefinition(wrapped: Definition)[source]

Bases: GuppyDefinition, Generic[P, Out]

A Guppy function definition.

__call__(*args: ~typing.~P, **kwargs: ~typing.~P) Out[source]

Call self as a function.

compile() Package

Compile a Guppy definition to HUGR.

check() None

Type-check a Guppy definition.

emulator(n_qubits: int, builder: EmulatorBuilder | None = None) EmulatorInstance[source]

Compile this function for emulation with the selene-sim emulator.

Calls compile() to get the HUGR package and then builds it using the provided EmulatorBuilder configuration or a default one.

See guppylang.emulator for more details on the emulator.

Args:

n_qubits: The number of qubits to allocate for the function. builder: An optional EmulatorBuilder to use for building the emulator instance. If not provided, the default EmulatorBuilder will be used.

Returns:

An EmulatorInstance that can be used to run the function in an emulator.

class guppylang.defs.GuppyTypeVarDefinition(wrapped: Definition, _ty_var: TypeVar)[source]

Bases: GuppyDefinition

Definition of a Guppy type variable.

compile() Package

Compile a Guppy definition to HUGR.

check() None

Type-check a Guppy definition.

__eq__(other: object) bool[source]

Return self==value.

__getattr__(name: str) Any[source]