"""Generates a comment indicating the .pyi file was auto-generated."""

from __future__ import annotations

from pathlib import Path

from .._version import __version__


def epilog(pyx_path: Path | None) -> str:
    """Create an epilog comment for the .pyi file.

    Args:
        pyx_path: Optional source file path to include in the comment.

    Returns:
        A comment line with generation tool info.
    """
    if pyx_path is not None:
        source_desc = f" from {pyx_path}"
    else:
        source_desc = ""

    return f"# This file was generated by stubgen-pyx v{__version__}{source_desc}\n"
