Skip to content

Conversation

@wassimbensalem
Copy link
Contributor

Description

This PR enhances the Katib Python SDK to support multiple pip index URLs, allowing users to install packages from both public (e.g., PyPI) and private repositories within the same experiment. This addresses a common use case in enterprise environments where teams rely on both open-source and internal proprietary packages.

The implementation replaces the pip_index_url (string) parameter in the tune method with pip_index_urls (a list of strings). The first URL in the list is used as the primary --index-url, and all subsequent URLs are added as --extra-index-url flags for the pip install command.

To ensure backward compatibility, the pip_index_urls parameter defaults to ["https://pypi.org/simple"] if not provided.

Changes Included

  • sdk/python/v1beta1/kubeflow/katib/api/katib_client.py:
    • Updated the tune method to accept pip_index_urls: List[str] instead of pip_index_url: str.
  • sdk/python/v1beta1/kubeflow/katib/utils/utils.py:
    • Added a new format_pip_index_urls utility function to correctly format the list of URLs into a pip-compatible command string.
    • Updated get_script_for_python_packages to use the new formatting function.
  • Testing:
    • Added a new test file sdk/python/v1beta1/kubeflow/katib/utils/utils_test.py to unit-test the format_pip_index_urls function.
    • Added a new test case to sdk/python/v1beta1/kubeflow/katib/api/katib_client_test.py to verify that the tune method correctly generates the container arguments when pip_index_urls is used.

Example Usage

Before:

# Can only use one index URL
client.tune(
    name="experiment",
    pip_index_url="https://my-private-repo.com/simple/"
)

After:

# Can specify multiple index URLs
client.tune(
    name="experiment",
    pip_packages=["scikit-learn", "my-private-lib"],
    pip_index_urls=[
        "https://pypi.org/simple/",
        "https://my-private-repo.com/simple/"
    ]
)

Fixes #2565

@andreyvelich
Copy link
Member

@wassimbensalem Please can you rebase your PR, so we can merge it ?

@andreyvelich andreyvelich force-pushed the feat/2565-extra-index-urls branch from 54a65da to 7ef94a2 Compare October 30, 2025 20:34
@google-oss-prow google-oss-prow bot added size/L and removed size/M labels Oct 30, 2025
@andreyvelich andreyvelich force-pushed the feat/2565-extra-index-urls branch from 7ef94a2 to ae8ee02 Compare October 30, 2025 20:36
Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be good to move this forward.
/lgtm
/approve

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andreyvelich

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: Andrey Velichkevich <[email protected]>
@google-oss-prow google-oss-prow bot removed the lgtm label Oct 30, 2025
@andreyvelich
Copy link
Member

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Oct 30, 2025
@andreyvelich
Copy link
Member

We can merge it, since errors are un-related.

@andreyvelich andreyvelich merged commit 11eeebb into kubeflow:master Oct 30, 2025
77 of 83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change pip_index_url to pip_index_urls list in Katib SDK

2 participants