ml_switcheroo.config ==================== .. py:module:: ml_switcheroo.config .. autoapi-nested-parse:: Runtime Configuration Store. Updated to support Framework Flavours (Hierarchical Selection). Attributes ---------- .. autoapisummary:: ml_switcheroo.config.tomllib ml_switcheroo.config.T Classes ------- .. autoapisummary:: ml_switcheroo.config.RuntimeConfig Functions --------- .. autoapisummary:: ml_switcheroo.config.get_framework_priority_order ml_switcheroo.config.parse_cli_key_values Module Contents --------------- .. py:data:: tomllib :value: None .. py:data:: T .. py:function:: get_framework_priority_order() -> List[str] Returns a list of framework keys sorted by UI Priority. The sort order is determined by the `ui_priority` attribute of the registered FrameworkAdapter. Lower numbers appear first. :returns: Sorted list of framework identifiers (e.g. ['torch', 'jax']). :rtype: List[str] .. py:class:: RuntimeConfig(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Global configuration container for the translation engine. .. py:attribute:: source_framework :type: str :value: None .. py:attribute:: target_framework :type: str :value: None .. py:attribute:: source_flavour :type: Optional[str] :value: None .. py:attribute:: target_flavour :type: Optional[str] :value: None .. py:attribute:: strict_mode :type: bool :value: None .. py:attribute:: plugin_settings :type: Dict[str, Any] :value: None .. py:attribute:: plugin_paths :type: List[pathlib.Path] :value: None .. py:attribute:: validation_report :type: Optional[pathlib.Path] :value: None .. py:method:: validate_framework(v: str) -> str :classmethod: Ensures the framework is registered in the system. :param v: The framework key to validate. :type v: str :returns: The normalized (lowercase) framework key. :rtype: str :raises ValueError: If the framework is not found in the registry. .. py:property:: effective_source :type: str Resolves the specific framework key to use for source logic. If a flavour (e.g. 'flax_nnx') is provided, it overrides the general framework ('jax'). :returns: The active source framework key. :rtype: str .. py:property:: effective_target :type: str Resolves the specific framework key to use for target logic. :returns: The active target framework key. :rtype: str .. py:method:: parse_plugin_settings(schema: Type[T]) -> T Validates the raw plugin settings dictionary against a specific Pydantic model. :param schema: The Pydantic model class defining expected settings. :type schema: Type[T] :returns: An instance of the schema model populated with runtime values. :rtype: T .. py:method:: load(source: Optional[str] = None, target: Optional[str] = None, source_flavour: Optional[str] = None, target_flavour: Optional[str] = None, strict_mode: Optional[bool] = None, plugin_settings: Optional[Dict[str, Any]] = None, validation_report: Optional[pathlib.Path] = None, search_path: Optional[pathlib.Path] = None) -> RuntimeConfig :classmethod: Loads configuration from pyproject.toml and overrides with CLI arguments. :param source: Override for source framework. :type source: Optional[str] :param target: Override for target framework. :type target: Optional[str] :param source_flavour: Override for source flavour. :type source_flavour: Optional[str] :param target_flavour: Override for target flavour. :type target_flavour: Optional[str] :param strict_mode: Override for strict mode setting. :type strict_mode: Optional[bool] :param plugin_settings: Additional CLI plugin settings. :type plugin_settings: Optional[Dict] :param validation_report: Override for validation report path. :type validation_report: Optional[Path] :param search_path: Directory to start searching for TOML config. :type search_path: Optional[Path] :returns: The fully resolved configuration object. :rtype: RuntimeConfig .. py:function:: parse_cli_key_values(items: Optional[List[str]]) -> Dict[str, Any] Parses a list of 'key=value' strings into a dictionary. Types are inferred (int, float, bool, or string). :param items: List of raw CLI strings directly from argparse. :type items: Optional[List[str]] :returns: Parsed dictionary. :rtype: Dict[str, Any]