Builder

class BlueprintBuilder(blueprint: Blueprint, debug: bool | None = None, log_dir=None)

Bases: object

The Blueprint Builder is responsible for turning a Blueprint into a fully realized rig. The only prerequisite is the Blueprint itself.

action_iterator() Iterable[Tuple[BuildStep, BuildAction, int]]

Return a generator that yields all BuildActions in the Blueprint.

Returns:

A generator that yields a tuple of (BuildStep, BuildAction, <variant or sym index>) for every action in the Blueprint.

apply_rig_metadata()

Apply the pending rig metadata. This is only called after the build as an optimization, but the pending metadata can be accessed at anytime from this builder.

build_generator() Iterable[dict]

This is the main iterator for performing all build operations. It runs all BuildSteps and BuildActions in order.

clear_validate_results()

Clear the results of any previous validation or build.

finish()

Finish the build by calling the appropriate finish methods

get_error_summary() str

Return a string representing the number of warnings or errors.

Returns:

“no errors” if no warnings or errors occurred. “{count} warnings” if only warnings occurred. “{count} errors” if any errors occurred.

next()

Perform the next step of the build.

notify_log(record: LogRecord)

Called when logging from this builders logger. Track warnings and errors and parse extra information to be able to present it in the build results.

on_cancel()

Called when the build is cancelled.

on_finish()

Called when the build has completely finished.

on_start()

Called right before the build starts

pause()

Pause the current build if it is running.

classmethod pre_build_validate(blueprint: Blueprint) bool

Perform a quick pre-build validation on a Blueprint to ensure that building can at least be started.

run()

Continue the current build

The builder must be started by calling start first before this can be called

setup_file_logger(log_dir: str)

Create a file handler for the logger of this builder.

should_interrupt()

Return True if the running build should be interrupted. Checks for cancellation using the progress window when show_progress_ui is enabled.

start(run=True) bool

Start the build for the current blueprint

Parameters:

run – A bool, whether to automatically run the build once it is started or wait for run to be called manually

Returns:

True if the build was started.

class BlueprintGlobalValidateStep(blueprint: Blueprint, all_actions: List[Tuple[BuildStep, BuildAction, int]], logger: Logger)

Bases: object

Base class for a global validation step.

Build actions can define their own global validate steps if they want to be able to validate the entire Blueprint holistically, e.g. to determine if there is a conflict between multiple actions or other high-level issues.

validate()

Validate the blueprint, using self.logger to log any errors that were encountered.

class BlueprintValidator(blueprint: Blueprint, debug: bool | None = None, log_dir=None)

Bases: BlueprintBuilder

Runs validate for all BuildActions in a Blueprint.

setup_file_logger(log_dir: str)

Create a file handler for the logger of this builder.