feat(sdk): Support multiple pip index URLs. #2566
Merged
+98
−29
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 thetunemethod 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-urlflags for thepip installcommand.To ensure backward compatibility, the
pip_index_urlsparameter defaults to["https://pypi.org/simple"]if not provided.Changes Included
sdk/python/v1beta1/kubeflow/katib/api/katib_client.py:tunemethod to acceptpip_index_urls: List[str]instead ofpip_index_url: str.sdk/python/v1beta1/kubeflow/katib/utils/utils.py:format_pip_index_urlsutility function to correctly format the list of URLs into a pip-compatible command string.get_script_for_python_packagesto use the new formatting function.sdk/python/v1beta1/kubeflow/katib/utils/utils_test.pyto unit-test theformat_pip_index_urlsfunction.sdk/python/v1beta1/kubeflow/katib/api/katib_client_test.pyto verify that thetunemethod correctly generates the container arguments whenpip_index_urlsis used.Example Usage
Before:
After:
Fixes #2565