from typing import Union
from pathlib import Path
from typing import List
import json


def get_extension_name(json_file: Union[str, Path]) -> List[str]:
    """Retrieve extension name from `json_file`"""
    if not isinstance(json_file, Path):
        json_file = Path(json_file).resolve()
    if not json_file.exists():
        raise RuntimeError(f"Could not find requested extension file at {json_file!r}")

    with open(json_file, "r") as handle:
        extension_file: dict = json.load(handle)

    return [_ for _ in extension_file.get("load_extensions", {})]