Skip to content

Public Python API - get_project_snapshot() and integration tests #5432

@ravi-kumar-pilla

Description

@ravi-kumar-pilla

Description

Expose the public-facing Python API: get_project_snapshot() in kedro/inspection/__init__.py with __all__ exports and optional pipeline_id filtering. Validate the full end-to-end flow with integration tests against the starter project.

Context

This ticket delivers the API surface that plugin authors and platform teams call directly.

Scope

kedro/inspection/__init__.py:

def get_project_snapshot(
    project_path: str | Path,
    env: str | None = None,
    pipeline_id: str | None = None,
) -> ProjectSnapshot:
    """Primary entry point. Returns a full ProjectSnapshot of the project.
    If pipeline_id is set, returns a snapshot scoped to that pipeline only.
    """

def _filter_pipeline(snapshot: ProjectSnapshot, pipeline_id: str) -> ProjectSnapshot:
    """Return a new snapshot containing only the requested pipeline and its datasets."""

__all__ = [
    "get_project_snapshot",
    "ProjectSnapshot",
    "PipelineSnapshot",
    "NodeSnapshot",
    "DatasetSnapshot",
    "ProjectMetadataSnapshot",
]

tests/inspection/test_integration.py (against spaceflights-pandas starter):

  • get_project_snapshot() returns a ProjectSnapshot
  • snapshot.metadata.project_name and package_name are correct
  • At least one pipeline is present with nodes
  • snapshot.datasets contains expected catalog entries with correct type and filepath
  • snapshot.parameter_keys contains expected keys without values
  • pipeline_id filtering returns only the requested pipeline
  • Datasets in the filtered snapshot only include those referenced by the requested pipeline's nodes
  • json.dumps(dataclasses.asdict(snapshot)) produces valid JSON

Deliverable

  • kedro/inspection/__init__.py (final public API)
  • tests/inspection/test_integration.py

Metadata

Metadata

Labels

Issue: Feature RequestNew feature or improvement to existing feature

Type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions