Repository: apache/airflow
File: dev/breeze/src/airflow_breeze/prepare_providers/provider_distributions.py (Python)

Code before:
        if distribution_format == "wheel":
            distribution_format = "both"
            remove_sdist = True
        if distribution_format != "both":
            command.extend(["--format", distribution_format])
        try:
            run_command(
                command,
                check=True,
                cwd=target_provider_root_sources_path,
                env={
                    "SOURCE_DATE_EPOCH": str(get_provider_details(provider_id).source_date_epoch),
                },
            )
        except subprocess.CalledProcessError as ex:
            get_console().print(f"[error]The command returned an error {ex}")
            raise PrepareReleasePackageErrorBuildingPackageException()
        if remove_sdist:
            get_console().print("[warning]Removing sdist file to workaround flit bug on wheel-only packages")
            # Remove the sdist file if it was created
            package_prefix = "apache_airflow_providers_" + provider_id.replace(".", "_")
            for file in (target_provider_root_sources_path / "dist").glob(f"{package_prefix}*.tar.gz"):
                get_console().print(f"[info]Removing {file} to workaround flit bug on wheel-only packages")
                file.unlink(missing_ok=True)
    elif build_backend == "hatchling":
        command = ["hatch", "build", "-c", "-t", "custom"]
        if distribution_format == "sdist" or distribution_format == "both":
            command += ["-t", "sdist"]
        if distribution_format == "wheel" or distribution_format == "both":
            command += ["-t", "wheel"]
        env_copy = os.environ.copy()
        env_copy["SOURCE_DATE_EPOCH"] = str(get_provider_details(provider_id).source_date_epoch)
        run_command(
            cmd=command,
            cwd=target_provider_root_sources_path,
            env=env_copy,
            check=True,
        )
        shutil.copytree(target_provider_root_sources_path / "dist", AIRFLOW_DIST_PATH, dirs_exist_ok=True)
    else:
        get_console().print(f"[error]Unknown/unsupported build backend {build_backend}")
        raise PrepareReleasePackageErrorBuildingPackageException()
    get_console().print(
        f"\n[info]Prepared provider package {provider_id} in format {distribution_format}[/]\n"
    )


def move_built_distributions_and_cleanup(
    target_provider_root_sources_path: Path,
    dist_folder: Path,
    skip_cleanup: bool,

Review comment (suggestion):
```suggestion
        command = [sys.executable, "-m", "hatch", "build", "-c", "-t", "custom"]
```
I think `python -m hatch` could solve the issue, maybe the reason it may not find the CLI in the path for that reason. Hatch is installed over uv env, and rather maybe Python can reach it for us

Code after:
            distribution_format = "both"
            remove_sdist = True
        if distribution_format != "both":
            command.extend(["--format", distribution_format])
        try:
            run_command(
                command,
                check=True,
                cwd=target_provider_root_sources_path,
                env={
                    "SOURCE_DATE_EPOCH": str(get_provider_details(provider_id).source_date_epoch),
                },
            )
        except subprocess.CalledProcessError as ex:
            get_console().print(f"[error]The command returned an error {ex}")
            raise PrepareReleasePackageErrorBuildingPackageException()
        if remove_sdist:
            get_console().print("[warning]Removing sdist file to workaround flit bug on wheel-only packages")
            # Remove the sdist file if it was created
            package_prefix = "apache_airflow_providers_" + provider_id.replace(".", "_")
            for file in (target_provider_root_sources_path / "dist").glob(f"{package_prefix}*.tar.gz"):
                get_console().print(f"[info]Removing {file} to workaround flit bug on wheel-only packages")
                file.unlink(missing_ok=True)
    elif build_backend == "hatchling":
        command = [sys.executable, "-m", "hatch", "build", "-c", "-t", "custom"]
        if distribution_format == "sdist" or distribution_format == "both":
            command += ["-t", "sdist"]
        if distribution_format == "wheel" or distribution_format == "both":
            command += ["-t", "wheel"]
        try:
            run_command(
                cmd=command,
                cwd=target_provider_root_sources_path,
                env={
                    "SOURCE_DATE_EPOCH": str(get_provider_details(provider_id).source_date_epoch),
                },
                check=True,
            )
        except subprocess.CalledProcessError as ex:
            get_console().print(f"[error]The command returned an error {ex}")
            raise PrepareReleasePackageErrorBuildingPackageException()
        shutil.copytree(target_provider_root_sources_path / "dist", AIRFLOW_DIST_PATH, dirs_exist_ok=True)
    else:
        get_console().print(f"[error]Unknown/unsupported build backend {build_backend}")
        raise PrepareReleasePackageErrorBuildingPackageException()
    get_console().print(
        f"\n[info]Prepared provider package {provider_id} in format {distribution_format}[/]\n"
    )


def move_built_distributions_and_cleanup(