feat(sdk): Support multiple pip index URLs. #2566
Open
+58
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thetune
method withpip_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 thepip 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
:tune
method to acceptpip_index_urls: List[str]
instead ofpip_index_url: str
.sdk/python/v1beta1/kubeflow/katib/utils/utils.py
:format_pip_index_urls
utility function to correctly format the list of URLs into a pip-compatible command string.get_script_for_python_packages
to use the new formatting function.sdk/python/v1beta1/kubeflow/katib/utils/utils_test.py
to unit-test theformat_pip_index_urls
function.sdk/python/v1beta1/kubeflow/katib/api/katib_client_test.py
to verify that thetune
method correctly generates the container arguments whenpip_index_urls
is used.Example Usage
Before:
After:
Fixes #2565