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
sierra.core.compiler
Link
ClassesLink
SierraCompiler
Link
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:
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
client |
The client instance provided during initialization.
TYPE:
|
| 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:
|
Notes
Logs each initialization step via the client's logger.
AttributesLink
FunctionsLink
to_double_quoted_string
classmethod
LinkReturn the given string wrapped in double quotes.
This function ensures the output string is always enclosed with a
starting and ending double-quote character ("), even if the input
string already includes quotes.
| PARAMETER | DESCRIPTION |
|---|---|
text
|
The input string to be quoted.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The input string wrapped with double quotes. Any existing surrounding quotes are ignored, and only one set of double quotes will be present at the start and end. |
Examples:
set_invoker_commands
LinkGenerate and set the CLI command string for each registered invoker.
build_and_save_scripts
LinkWrite each invoker's generated standalone script to the invokers directory.
make_invoker_yaml
Linkmake_invoker_yaml() -> str
Construct a YAML configuration string for all registered invokers without relying on external YAML libraries.
| RETURNS | DESCRIPTION |
|---|---|
str
|
YAML-formatted configuration. |
merge_deduplicate_sorted_latest
LinkMerge multiple lists of strings, remove duplicates, and retain only the highest version of versioned entries like 'package==x.y.z'. The final result is sorted alphabetically.
| PARAMETER | DESCRIPTION |
|---|---|
*lists
|
Multiple input lists containing string elements.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list of str
|
Combined, deduplicated, and sorted list retaining highest package versions. |
compile
LinkComplete compilation process: 1. Generate CLI command strings for invokers 2. Write standalone Python scripts 3. Write config.yaml in the root of the environment.