Repository: apache/airflow
File: dev/breeze/src/airflow_breeze/utils/packages.py (Python)

Code before:
        "https://airflow.staged.apache.org" if version_suffix else "https://airflow.apache.org"
    )
    cross_provider_ids = set(
        get_provider_dependencies()[provider_details.provider_id]["cross-providers-deps"]
    )
    cross_provider_dependencies = []
    # Add cross-provider dependencies to the optional dependencies if they are missing
    for provider_id in sorted(cross_provider_ids):
        cross_provider_dependencies.append(f'    "{get_pip_package_name(provider_id)}",')
        if f'"{provider_id}" = [' not in optional_dependencies and get_pip_package_name(
            provider_id
        ) not in "\n".join(required_dependencies):
            optional_dependencies.append(f'"{provider_id}" = [')
            optional_dependencies.append(f'    "{get_pip_package_name(provider_id)}"')
            optional_dependencies.append("]")
    context["EXTRAS_REQUIREMENTS"] = "\n".join(optional_dependencies)
    formatted_dependency_groups = "\n".join(dependency_groups)
    if formatted_dependency_groups:
        formatted_dependency_groups = "\n" + formatted_dependency_groups
    if cross_provider_dependencies:
        formatted_cross_provider_dependencies = "\n" + "\n".join(cross_provider_dependencies)
    else:  # If there are no cross-provider dependencies, we need to remove the line
        formatted_cross_provider_dependencies = ""
    context["CROSS_PROVIDER_DEPENDENCIES"] = formatted_cross_provider_dependencies
    context["DEPENDENCY_GROUPS"] = formatted_dependency_groups
    context["BUILD_SYSTEM"] = (
        "hatchling" if (provider_details.root_provider_path / "hatch_build.py").exists() else "flit_core"
    )
    if context["BUILD_SYSTEM"] == "hatchling":
        context["HATCH_ARTIFACTS"] = provider_details.hatch_artifacts
        context["HATCH_EXCLUDES"] = provider_details.hatch_excludes

    pyproject_toml_content = render_template(
        template_name="pyproject",
        context=context,
        extension=".toml",
        autoescape=False,
        lstrip_blocks=True,
        trim_blocks=True,
        keep_trailing_newline=True,
    )
    get_pyproject_toml_path.write_text(pyproject_toml_content)
    get_console().print(
        f"[info]Generated {get_pyproject_toml_path} for the {provider_details.provider_id} provider\n"
    )


AIRFLOW_PACKAGE_MATCHER = re.compile(r"(^.*\")(apache-airflow.*>=[\d.]*)((\".*)$|;.*$)")


def modify_dependency_with_suffix(dependency: str, version_suffix: str) -> str:

Review comment (suggestion):
same here -> we could use `provider.yaml`  new `build-system` flag to determine build system.

Code after:
        for dependency in optional_dependencies:
            modified_dependency = modify_dependency_with_suffix(dependency, version_suffix)
            new_optional_dependencies.append(modified_dependency)
        optional_dependencies = new_optional_dependencies
    context["INSTALL_REQUIREMENTS"] = "\n".join(required_dependencies)
    context["AIRFLOW_DOC_URL"] = (
        "https://airflow.staged.apache.org" if version_suffix else "https://airflow.apache.org"
    )
    cross_provider_ids = set(
        get_provider_dependencies()[provider_details.provider_id]["cross-providers-deps"]
    )
    cross_provider_dependencies = []
    # Add cross-provider dependencies to the optional dependencies if they are missing
    for provider_id in sorted(cross_provider_ids):
        cross_provider_dependencies.append(f'    "{get_pip_package_name(provider_id)}",')
        if f'"{provider_id}" = [' not in optional_dependencies and get_pip_package_name(
            provider_id
        ) not in "\n".join(required_dependencies):
            optional_dependencies.append(f'"{provider_id}" = [')
            optional_dependencies.append(f'    "{get_pip_package_name(provider_id)}"')
            optional_dependencies.append("]")
    context["EXTRAS_REQUIREMENTS"] = "\n".join(optional_dependencies)
    formatted_dependency_groups = "\n".join(dependency_groups)
    if formatted_dependency_groups:
        formatted_dependency_groups = "\n" + formatted_dependency_groups
    if cross_provider_dependencies:
        formatted_cross_provider_dependencies = "\n" + "\n".join(cross_provider_dependencies)
    else:  # If there are no cross-provider dependencies, we need to remove the line
        formatted_cross_provider_dependencies = ""
    context["CROSS_PROVIDER_DEPENDENCIES"] = formatted_cross_provider_dependencies
    context["DEPENDENCY_GROUPS"] = formatted_dependency_groups
    context["BUILD_SYSTEM"] = provider_details.build_system
    if context["BUILD_SYSTEM"] == "hatchling":
        context["HATCH_ARTIFACTS"] = provider_details.hatch_artifacts
        context["HATCH_EXCLUDES"] = provider_details.hatch_excludes
        context["HATCH_REQUIRES"] = provider_details.hatch_requires

    pyproject_toml_content = render_template(
        template_name="pyproject",
        context=context,
        extension=".toml",
        autoescape=False,
        lstrip_blocks=True,
        trim_blocks=True,
        keep_trailing_newline=True,
    )
    get_pyproject_toml_path.write_text(pyproject_toml_content)
    get_console().print(
        f"[info]Generated {get_pyproject_toml_path} for the {provider_details.provider_id} provider\n"
    )