Skip to content

Compiler

CompilerLink

The sierra.core.compiler module is responsible for taking registered invoker scripts and producing standalone Python scripts along with the corresponding YAML configuration.

Compiling invoker scripts
Python
import pathlib
import sierra

# Initialize your SierraDevelopmentClient
client = sierra.SierraDevelopmentClient(
    environment_path=pathlib.Path("default_env"),
    environment_name="default_env",
    logger=sierra.UniversalLogger(name="Sierra", level=sierra.sierra_internal_logger.LogLevel.DEBUG),
)

# Discover and register all invokers
client.load_invokers_from_scripts()

# Compile into standalone scripts and config.yaml
client.compiler.compile()

sierra.core.compiler Link

ClassesLink

SierraCompiler Link
Python
SierraCompiler(
    client: sierra_client.SierraDevelopmentClient,
)

Bases: sierra_core_base.SierraCoreObject

Compiler for Sierra invoker scripts and YAML configuration.

Generates standalone invoker scripts in the environment's invokers directory and writes a config.yaml file with PATHS and SCRIPTS entries without external dependencies.

PARAMETER DESCRIPTION
client

The client to use for logging and accessing environment information.

TYPE: SierraClient

ATTRIBUTE DESCRIPTION
client

The client instance provided during initialization.

TYPE: SierraClient

METHOD DESCRIPTION
set_invoker_commands

Generate and set the CLI command string for each registered invoker.

build_and_save_scripts

Write each invoker's generated standalone script to the invokers directory.

make_invoker_yaml

Construct a YAML configuration string for all registered invokers without relying on external YAML libraries.

compile

Complete compilation process: 1. Generate CLI command strings for invokers 2. Write standalone Python scripts 3. Write config.yaml in the root of the environment.

Initialize a SierraCoreObject.

PARAMETER DESCRIPTION
client

The Sierra development client.

TYPE: SierraDevelopmentClient

Notes

Logs each initialization step via the client's logger.

AttributesLink
client instance-attribute Link
Python
client = client
FunctionsLink
set_invoker_commands Link
Python
set_invoker_commands() -> None

Generate and set the CLI command string for each registered invoker.

build_and_save_scripts Link
Python
build_and_save_scripts() -> None

Write each invoker's generated standalone script to the invokers directory.

make_invoker_yaml Link
Python
make_invoker_yaml() -> str

Construct a YAML configuration string for all registered invokers without relying on external YAML libraries.

RETURNS DESCRIPTION
str

YAML-formatted configuration.

compile Link
Python
compile() -> None

Complete compilation process: 1. Generate CLI command strings for invokers 2. Write standalone Python scripts 3. Write config.yaml in the root of the environment.