cursus.core.config_fields.inheritance_aware_field_generator

Inheritance-Aware Field Generator

This module provides centralized inheritance-aware field generation functionality, consolidating logic previously scattered across UI modules.

Key Features: - 4-tier field system with inheritance awareness (essential, system, inherited, derived) - Integration with unified_config_manager for tier-aware categorization - Step catalog integration for enhanced field processing - Workspace and framework-aware field mappings - Performance-optimized field enhancement algorithms

Consolidates: - config_ui’s get_inheritance_aware_form_fields method (~80 lines) - Manual inheritance logic from UI modules - Field tier enhancement scattered across modules

class InheritanceAwareFieldGenerator(workspace_dirs=None, project_id=None)[source]

Bases: object

Centralized inheritance-aware field generation.

Provides systematic inheritance-aware field enhancement using the existing unified_config_manager infrastructure instead of manual inheritance logic.

get_inheritance_aware_form_fields(config_class_name, config_class=None, inheritance_analysis=None)[source]

Generate form fields with Smart Default Value Inheritance awareness.

CONSOLIDATED: This method replaces manual inheritance logic from config_ui with systematic tier-aware field enhancement using unified_config_manager.

Creates the enhanced 4-tier field system: - Tier 1 (essential): Required fields with no defaults (NEW to this config) - Tier 2 (system): Optional fields with defaults (NEW to this config) - Tier 3 (inherited): Fields inherited from parent configs (NEW TIER) - Tier 4 (derived): Computed fields (hidden from UI)

Parameters:
  • config_class_name (str) – Name of the configuration class

  • config_class (Type[BaseModel] | None) – Optional config class (will be discovered if not provided)

  • inheritance_analysis (Dict[str, Any] | None) – Optional inheritance analysis from StepCatalog

Returns:

List of enhanced field definitions with inheritance information

Return type:

List[Dict[str, Any]]

get_enhanced_field_categorization(config_list, processing_step_config_base_class=None)[source]

Get enhanced field categorization using step catalog aware categorizer.

Parameters:
  • config_list (List[BaseModel]) – List of configuration objects to categorize

  • processing_step_config_base_class (Type | None) – Optional base class for processing steps

Returns:

Enhanced categorization with inheritance and workspace awareness

Return type:

Dict[str, Any]

get_inheritance_aware_field_generator(workspace_dirs=None, project_id=None)[source]

Get an inheritance-aware field generator, cached per (workspace_dirs, project_id).

Parameters:
  • workspace_dirs (List[str] | None) – Optional workspace directories for step catalog integration

  • project_id (str | None) – Optional project ID for workspace-specific processing

Returns:

InheritanceAwareFieldGenerator instance (one per distinct context key)

Return type:

InheritanceAwareFieldGenerator

reset_inheritance_aware_field_generator_cache()[source]

Clear the per-context generator cache (mainly for tests / hot-reload).

get_inheritance_aware_form_fields(config_class_name, config_class=None, inheritance_analysis=None, workspace_dirs=None, project_id=None)[source]

Convenience function to get inheritance-aware form fields.

CONSOLIDATED: This function replaces the manual inheritance logic from config_ui with systematic tier-aware field enhancement using unified_config_manager.

Parameters:
  • config_class_name (str) – Name of the configuration class

  • config_class (Type[BaseModel] | None) – Optional config class (will be discovered if not provided)

  • inheritance_analysis (Dict[str, Any] | None) – Optional inheritance analysis from StepCatalog

  • workspace_dirs (List[str] | None) – Optional workspace directories for step catalog integration

  • project_id (str | None) – Optional project ID for workspace-specific processing

Returns:

List of enhanced field definitions with inheritance information

Return type:

List[Dict[str, Any]]