def METHOD_NAME(
    cfg: Config,
    pkg_path_: str,
    root_class: str,
    value_files_: Iterable[str],
    tmp_dir: Optional[str] = "",
    keep_dir: bool = False,
):
    temp_dir, keep_dir = resolve_and_create_work_dir(cfg, tmp_dir, keep_dir)
    cfg.work_dir = temp_dir
    # Clean working tree before compiling package, some of our symlinking logic expects
    # that `inventory/` is cleaned before symlinks are created.
    if not cfg.local:
        clean_working_tree(cfg)
    pkg_path = Path(pkg_path_).resolve()
    value_files = [Path(f).resolve() for f in value_files_]
    # NOTE(sg): The assumption here is that package repo names generally reflect the
    # package name (possibly with a prefix `package-`). As long as a package only uses
    # relative includes internally, the package name shouldn't matter for compilation.
    pkg_name = pkg_path.stem.replace("package-", "")
    # Handle package directory naming scheme for packages which are part of a cluster
    # catalog separately.
    if pkg_path.name.startswith("pkg."):
        pkg_name = pkg_path.name.replace("pkg.", "")
    root_class_name = root_class.replace(".yml", "").replace("/", ".")
    # Convert root class file to class name
    root_class_path = pkg_path / root_class
    if not root_class_path.is_file():
        raise click.ClickException(f"Test class '{root_class_name}' doesn't exist.")
    _setup_inventory(cfg.inventory, pkg_name, root_class_name, value_files)
    # Symlink package to inventory
    relsymlink(pkg_path, cfg.inventory.package_dir(pkg_name).parent, pkg_name)
    # setup bootstrap target
    update_target(cfg, cfg.inventory.bootstrap_target)
    if not cfg.local:
        fetch_components(cfg)
    else:
        register_components(cfg)
    update_target(cfg, cfg.inventory.bootstrap_target)
    aliases = cfg.get_component_aliases()
    for alias, c in aliases.items():
        update_target(cfg, alias, c)
    inventory, targets = setup_compile_environment(cfg)
    kapitan_compile(cfg, targets, search_paths=[cfg.vendor_dir])
    postprocess_components(cfg, inventory, cfg.get_components())
    shutil.copytree(
        cfg.work_dir / "compiled", pkg_path / "compiled", dirs_exist_ok=True
    )
    if not keep_dir:
        shutil.rmtree(temp_dir)
    elif not tmp_dir:
        click.echo(
            f"Compilation working directory: {temp_dir}. Specify `--tmp-dir={temp_dir}`"
            + ", if you want to use local mode for subsequent compilations."
        )