Skip to content

bootstrap_fabric_env

Public callable

Bootstrap 00_env_config environment readiness for FabricOps notebooks.

This is a one-call bootstrap helper used at the start of a FabricOps run. It validates/loads configuration, resolves required environment targets, gathers runtime and AI availability metadata, and optionally executes smoke checks before quality/governance/lineage workflows continue.

Parameters:

Name Type Description Default
env str

Environment key to bootstrap from path_config.

"Sandbox"
required_targets list[str] | None

Target names that must resolve for the selected environment. Defaults to ["Source", "Unified"].

None
check_ai bool

Whether to include Fabric AI availability checks.

True
smoke_test bool

Whether to execute :func:run_config_smoke_tests.

True
config FrameworkConfig | dict[str, Any] | None

Framework configuration object or compatible mapping.

None
notebook_name str | None

Notebook name used in runtime metadata and naming checks.

None

Returns:

Type Description
ConfigBootstrapResult

Structured bootstrap result containing resolved paths, runtime metadata, AI status, smoke-check results, and overall readiness status.

Raises:

Type Description
ValueError

Raised when config is missing or fails configuration/path validation.

Notes

Side effects are limited to runtime/import checks. The helper does not create Fabric assets or write persistent state.

Examples:

>>> result = bootstrap_fabric_env(config=my_config, env="Sandbox", notebook_name="00_env_config")
>>> result.readiness_status in {"ready", "not_ready"}
True
Source code in src/fabricops_kit/config.py
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
def bootstrap_fabric_env(
    env: str = "Sandbox",
    required_targets: list[str] | None = None,
    check_ai: bool = True,
    smoke_test: bool = True,
    config: FrameworkConfig | dict[str, Any] | None = None,
    notebook_name: str | None = None,
) -> ConfigBootstrapResult:
    """Bootstrap 00_env_config environment readiness for FabricOps notebooks.

    This is a one-call bootstrap helper used at the start of a FabricOps run.
    It validates/loads configuration, resolves required environment targets,
    gathers runtime and AI availability metadata, and optionally executes smoke
    checks before quality/governance/lineage workflows continue.

    Parameters
    ----------
    env : str, default="Sandbox"
        Environment key to bootstrap from ``path_config``.
    required_targets : list[str] | None, optional
        Target names that must resolve for the selected environment. Defaults
        to ``["Source", "Unified"]``.
    check_ai : bool, default=True
        Whether to include Fabric AI availability checks.
    smoke_test : bool, default=True
        Whether to execute :func:`run_config_smoke_tests`.
    config : FrameworkConfig | dict[str, Any] | None, optional
        Framework configuration object or compatible mapping.
    notebook_name : str | None, optional
        Notebook name used in runtime metadata and naming checks.

    Returns
    -------
    ConfigBootstrapResult
        Structured bootstrap result containing resolved paths, runtime metadata,
        AI status, smoke-check results, and overall readiness status.

    Raises
    ------
    ValueError
        Raised when ``config`` is missing or fails configuration/path
        validation.

    Notes
    -----
    Side effects are limited to runtime/import checks. The helper does not
    create Fabric assets or write persistent state.

    Examples
    --------
    >>> result = bootstrap_fabric_env(config=my_config, env="Sandbox", notebook_name="00_env_config")
    >>> result.readiness_status in {"ready", "not_ready"}
    True
    """
    normalized = load_fabric_config(config) if config is not None else None
    if normalized is None:
        raise ValueError("config is required for bootstrap_fabric_env.")
    required_targets = required_targets or ["Source", "Unified"]
    resolved_paths = {target: get_path(env=env, target=target, config=normalized) for target in required_targets}
    ai_result = check_fabric_ai_functions_available() if check_ai else {"available": None, "message": "AI check disabled."}
    runtime_meta = _get_fabric_runtime_metadata(notebook_name=notebook_name)
    smoke = run_config_smoke_tests(
        normalized,
        env=env,
        required_targets=required_targets,
        check_ai=check_ai,
        check_io_import=False,
        notebook_name=notebook_name,
        ai_result=ai_result,
    ) if smoke_test else []
    status = "ready" if all(r.status in {"pass", "skipped", "warn"} for r in smoke) else "not_ready"
    return ConfigBootstrapResult(
        environment=env,
        paths=resolved_paths,
        runtime_metadata=runtime_meta,
        ai_availability=ai_result,
        smoke_test_results=smoke,
        readiness_status=status,
    )