cursus.registry.step_names¶
Enhanced step names registry with hybrid backend support. Maintains 100% backward compatibility while adding workspace awareness.
This module provides a drop-in replacement for the original step_names.py that: - Uses the hybrid registry backend transparently - Maintains all existing functions and variables - Adds workspace context management capabilities - Provides seamless workspace-aware step resolution
- get_workspace_context()[source]¶
Get current workspace context.
- Returns:
Current workspace identifier or None if no context set
- Return type:
str | None
- workspace_context(workspace_id)[source]¶
Context manager for temporary workspace context.
- Parameters:
workspace_id (str) – Workspace identifier for temporary context
- Usage:
- with workspace_context(“developer_1”):
step_names = get_step_names() # Uses developer_1 context
- is_hybrid_active()[source]¶
Return True if the hybrid (workspace-aware) registry manager is in use.
False means initialization failed and the static fallback registry is active — see
get_registry_health()for the captured error.
- get_registry_health()[source]¶
Report registry-manager health so callers can detect a silent fallback.
Returns a dict with
hybrid_activeand, when degraded,init_error(the stringified exception that forced the static fallback).
- refresh_registry(pack_interfaces_dir=None)[source]¶
Merge an external step-pack’s
.step.yamlinterfaces INTO the step registry (add-only).This is the public entry point behind action item AI-2. It enforces the additive invariant: package steps are ALWAYS available; a pack can only ADD steps (and, on a deliberate name-clash, shadow with a warning). It never removes or replaces a package step.
- Mechanism (package-first, never replace):
Derive the pack’s registry rows from
pack_interfaces_dir/*.step.yamlviabuild_registry_from_interfaces(pack_interfaces_dir).Layer them on top of the live package table with
step_names_base.merge_pack_registry(in-placeSTEP_NAMES.update— package rows preserved).Re-sync the hybrid manager (
reload_core_registry) so the StepCatalog, which readsget_step_names()through the manager, sees the plugin steps.
- Parameters:
pack_interfaces_dir (Any | None) – directory of the pack’s
*.step.yamlfiles (e.g.<project_root>/step_pack/interfaces).Noneis a no-op returning{}.- Returns:
{name: "collision"}for pack names that shadowed an existing package step (already logged as warnings here); empty when every pack step is new.- Return type:
- get_config_step_registry(workspace_id=None)[source]¶
Get CONFIG_STEP_REGISTRY with workspace context.
- get_config_class_name(step_name, workspace_id=None)[source]¶
Get config class name with workspace context.
- get_builder_step_name(step_name, workspace_id=None)[source]¶
Get builder step class name with workspace context.
- get_spec_step_type(step_name, workspace_id=None)[source]¶
Get step_type value for StepSpecification with workspace context.
- get_spec_step_type_with_job_type(step_name, job_type=None, workspace_id=None)[source]¶
Get step_type with optional job_type suffix, workspace-aware.
- get_step_name_from_spec_type(spec_type, workspace_id=None)[source]¶
Get canonical step name from spec_type with workspace context.
- validate_step_name(step_name, workspace_id=None)[source]¶
Validate step name exists with workspace context.
- validate_spec_type(spec_type, workspace_id=None)[source]¶
Validate spec_type exists with workspace context.
- get_step_description(step_name, workspace_id=None)[source]¶
Get step description with workspace context.
- list_all_step_info(workspace_id=None)[source]¶
Get complete step information with workspace context.
- get_sagemaker_step_type(step_name, workspace_id=None)[source]¶
Get SageMaker step type with workspace context.
- get_steps_by_sagemaker_type(sagemaker_type, workspace_id=None)[source]¶
Get steps by SageMaker type with workspace context.
- get_all_sagemaker_step_types(workspace_id=None)[source]¶
Get all SageMaker step types with workspace context.
- get_valid_sagemaker_step_types(workspace_id=None)[source]¶
The authoritative set of valid SageMaker step types — single source of truth (FZ 31e1d3g3 C3).
Union of the LIVE types declared across every step’s
.step.yaml(robust to shell deletion, since it reads the interface-derived registry) and a small static floor of framework-structural types that may not be attached to a live step. Replaces the two divergent hardcoded sets.
- validate_sagemaker_step_type(sagemaker_type, workspace_id=None)[source]¶
Validate SageMaker step type against the single-source valid set.
- get_sagemaker_step_type_mapping(workspace_id=None)[source]¶
Get SageMaker step type mapping with workspace context.
- get_canonical_name_from_file_name(file_name, workspace_id=None)[source]¶
Enhanced file name resolution with workspace context awareness.
- Parameters:
- Returns:
Canonical step name (e.g., “XGBoostModelEval”, “DummyTraining”)
- Raises:
ValueError – If file name cannot be mapped to a canonical name
- Return type:
- validate_file_name(file_name, workspace_id=None)[source]¶
Validate file name can be mapped with workspace context.
- original_set_workspace_context(workspace_id)¶
Set current workspace context for registry resolution.
- Parameters:
workspace_id (str) – Workspace identifier to set as current context
- add_new_step_with_validation(step_name, config_class, builder_name, sagemaker_type, description='', validation_mode='warn', workspace_id=None)[source]¶
Add new step with standardization validation.
This function implements the essential validation for new step creation identified in the redundancy analysis, providing a simple interface for adding steps with automatic validation.
- Parameters:
step_name (str) – Canonical step name (should be PascalCase)
config_class (str) – Configuration class name (should end with ‘Config’)
builder_name (str) – Builder class name (should end with ‘StepBuilder’)
sagemaker_type (str) – SageMaker step type
description (str) – Optional step description
validation_mode (str) – Validation mode (“warn”, “strict”, “auto_correct”)
workspace_id (str) – Optional workspace context
- Returns:
List of validation warnings/messages
- Raises:
ValueError – If validation fails in strict mode
- Return type:
Example
- warnings = add_new_step_with_validation(
“MyCustomStep”, “MyCustomStepConfig”, “MyCustomStepStepBuilder”, “Processing”, “Custom processing step”
)
- validate_step_definition_data(step_name, step_data)[source]¶
Validate step definition data for standardization compliance.
This function provides the core validation functionality identified as essential in the redundancy analysis.
- get_step_validation_suggestions(step_name, step_data)[source]¶
Get detailed validation errors with helpful suggestions.
This function provides the clear error messages with examples identified as essential for developer experience.
- auto_correct_step_data(step_name, step_data)[source]¶
Auto-correct step definition data for common naming violations.
This function provides the simple auto-correction functionality identified as essential in the redundancy analysis.