kubeflow / kubeflow/pipelines-components

[BUG] CI does not manage component test dependencies

Open
#126 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
12
Forks
56
Avg merge
1d 11h
Merged PRs (30d)
3

Description

## Problem

Components that declare runtime dependencies via `packages_to_install` in their `@dsl.component` decorator (e.g., `sdg-hub`, `pandas`, `datasets`) have those packages installed **inside the container at execution time**. However, the component's **unit tests** need those same packages to be importable in the test environment -- either to mock them (`@mock.patch("sdg_hub.core.flow.base.Flow.from_yaml")`) or to call `component.python_func()` directly in local runner tests.

Currently, there is no mechanism for CI to automatically install component-specific test dependencies before running a component's test suite. The test runner (`scripts/tests/run_component_tests.py`) discovers and executes tests, but only the project-wide `test` extra from `pyproject.toml` is installed. Components with additional runtime dependencies have their tests fail due to missing imports.

## Current workaround

Add component specific dependencies to the general test dependencies.

## Impact

- Component tests that depend on external packages cannot run in CI without adding those packages to the global `[project.optional-dependencies] test` list in `pyproject.toml`.
- Adding every component's runtime dependencies to the global `test` extra does not scale as the catalog grows -- it increases install time for all contributors and risks dependency conflicts between unrelated components.

## Desired outcome

A convention and supporting automation that allows components to declare their own test-time dependencies in a way that CI can discover and install them dynamically, without hardcoding component-specific logic in workflows or polluting the global dependency list.

---

Impacted by this bug? Give it a 👍.

Contributor guide

Open the contributing guide

Research direction

Start by reading scripts/tests/run_component_tests.py and the test extra in pyproject.toml to understand how component tests are discovered and dependencies are installed. Trace how packages_to_install is declared in @dsl.component decorators, then define a component-level test dependency convention and CI automation that discovers and installs it. Done means affected component tests run without adding their dependencies to the global test extra.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.