Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
6 changes: 4 additions & 2 deletions kubeflow/hub/api/model_registry_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from collections.abc import Iterator, Mapping
from typing import TYPE_CHECKING
from urllib.parse import urlsplit

from kubeflow.hub.types.types import StorageConfig

Expand Down Expand Up @@ -83,12 +84,13 @@ def __init__(
"model-registry is not installed. Install it with:\n\n" # fmt: skip
" pip install 'kubeflow[hub]'\n"
) from e
parsed_url = urlsplit(base_url if "://" in base_url else f"https://{base_url}")
is_http = parsed_url.scheme == "http"

is_http = base_url.startswith("http://")
if is_secure is None:
is_secure = not is_http
if port is None:
port = 8080 if is_http else 443
port = parsed_url.port or (8080 if is_http else 443)

self._registry = ModelRegistry(
server_address=base_url,
Expand Down
4 changes: 2 additions & 2 deletions kubeflow/hub/api/model_registry_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def mock_import(name, *args, **kwargs):
},
expected_output={
"server_address": "https://example.org:456",
"port": 443,
"port": 456,
"author": "test",
"is_secure": True,
"user_token": None,
Expand All @@ -163,7 +163,7 @@ def mock_import(name, *args, **kwargs):
},
expected_output={
"server_address": "http://example.org:456",
"port": 8080,
"port": 456,
"author": "test",
"is_secure": False,
"user_token": None,
Expand Down
Loading