Skip to content

find_kedro_project

kedro_dagster.utils.find_kedro_project(current_dir)

Locate the Kedro project root starting from current_dir.

This wraps Kedro's _find_kedro_project with a version-compatible import that works across Kedro releases where the function moved modules.

Parameters

Name Type Description Default
current_dir Path

Directory to start searching from.

required

Returns

Type Description
Path or None

Project root path if found, else None.

See Also

kedro_dagster.translator.KedroProjectTranslator : Uses this to auto-discover the project root.

Source Code

Show/Hide source
def find_kedro_project(current_dir: Path) -> Path | None:
    """Locate the Kedro project root starting from ``current_dir``.

    This wraps Kedro's ``_find_kedro_project`` with a version-compatible
    import that works across Kedro releases where the function moved modules.

    Parameters
    ----------
    current_dir : Path
        Directory to start searching from.

    Returns
    -------
    Path or None
        Project root path if found, else ``None``.

    See Also
    --------
    `kedro_dagster.translator.KedroProjectTranslator` :
        Uses this to auto-discover the project root.
    """
    # Use the module-level constant to avoid repeated imports/parsing.
    from kedro.utils import find_kedro_project as _find_kedro_project

    return _find_kedro_project(current_dir)  # type: ignore[no-any-return]