def METHOD_NAME(
    sdist_directory: str,
    config_settings: Optional[Dict[str, Any]] = None,
) -> str:
    """Build a source distribution"""
    logger = logging.getLogger("xgboost.packager.build_sdist")
    if config_settings:
        raise NotImplementedError(
            "XGBoost's custom build backend doesn't support config_settings option "
            f"when building sdist. {config_settings=}"
        )
    cpp_src_dir = TOPLEVEL_DIR.parent
    if not cpp_src_dir.joinpath("CMakeLists.txt").exists():
        raise RuntimeError(f"Did not find CMakeLists.txt from {cpp_src_dir}")
    # Create tempdir with Python package + C++ sources
    with tempfile.TemporaryDirectory() as td:
        td_path = pathlib.Path(td)
        workspace = td_path / "sdist_workspace"
        workspace.mkdir()
        logger.info("Copying project files to temporary directory %s", str(workspace))
        copy_with_logging(TOPLEVEL_DIR / "pyproject.toml", workspace, logger=logger)
        copy_with_logging(TOPLEVEL_DIR / "hatch_build.py", workspace, logger=logger)
        copy_with_logging(TOPLEVEL_DIR / "README.rst", workspace, logger=logger)
        copytree_with_logging(
            TOPLEVEL_DIR / "xgboost", workspace / "xgboost", logger=logger
        )
        copytree_with_logging(
            TOPLEVEL_DIR / "packager", workspace / "packager", logger=logger
        )
        temp_cpp_src_dir = workspace / "cpp_src"
        copy_cpp_src_tree(cpp_src_dir, target_dir=temp_cpp_src_dir, logger=logger)
        with cd(workspace):
            sdist_name = hatchling.build.METHOD_NAME(sdist_directory, config_settings)
    return sdist_name