From a30897dbfdda8ee7520a126ca95f6fcd8e895023 Mon Sep 17 00:00:00 2001 From: Liana Koleva <43767763+lianakoleva@users.noreply.github.com> Date: Tue, 28 Jul 2026 17:24:30 -0700 Subject: [PATCH 1/5] fix: make upload path mandatory --- python/lightning_sdk/cli/legacy/upload.py | 8 ++++---- python/lightning_sdk/cli/model/upload.py | 10 +++++----- python/lightning_sdk/models.py | 4 ++-- python/tests/cli/model/test_upload.py | 2 +- python/tests/core/test_models.py | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/python/lightning_sdk/cli/legacy/upload.py b/python/lightning_sdk/cli/legacy/upload.py index 286469bd..86926e01 100644 --- a/python/lightning_sdk/cli/legacy/upload.py +++ b/python/lightning_sdk/cli/legacy/upload.py @@ -40,11 +40,11 @@ def upload() -> None: @upload.command("model") -@click.argument("name") +@click.argument("name", metavar="ORG-NAME/TEAMSPACE-NAME/MODEL-NAME") @click.option( "--path", - default=".", - help="The path to the file or directory you want to upload. Defaults to the current directory.", + required=True, + help="The path to the file or directory you want to upload.", ) @click.option( "--cloud-account", @@ -52,7 +52,7 @@ def upload() -> None: default=None, help="The name of the cloud account to store the Model in.", ) -def model(name: str, path: str = ".", cloud_account: Optional[str] = None) -> None: +def model(name: str, path: str, cloud_account: Optional[str] = None) -> None: """Upload a model a teamspace. Example: diff --git a/python/lightning_sdk/cli/model/upload.py b/python/lightning_sdk/cli/model/upload.py index 5705148b..8ad4d68e 100644 --- a/python/lightning_sdk/cli/model/upload.py +++ b/python/lightning_sdk/cli/model/upload.py @@ -9,15 +9,15 @@ @click.command("upload", cls=LightningCommand) -@click.argument("name") +@click.argument("name", metavar="ORG-NAME/TEAMSPACE-NAME/MODEL-NAME") @click.option( "--path", - default=".", - help="The path to the file or directory you want to upload. Defaults to the current directory.", + required=True, + help="The path to the file or directory you want to upload.", ) @click.option( "--cloud-account", "--cloud_account", default=None, help="The name of the cloud account to store the Model in." ) -def upload_model(name: str, path: str = ".", cloud_account: Optional[str] = None) -> None: +def upload_model(name: str, path: str, cloud_account: Optional[str] = None) -> None: """Upload a model to a teamspace.""" - _upload_model(name, path, cloud_account=cloud_account) + _upload_model(name, path, cloud_account=cloud_account) \ No newline at end of file diff --git a/python/lightning_sdk/models.py b/python/lightning_sdk/models.py index 978bfeda..080e230d 100644 --- a/python/lightning_sdk/models.py +++ b/python/lightning_sdk/models.py @@ -180,7 +180,7 @@ def download_model( def upload_model( name: str, - path: Union[str, Path, List[Union[str, Path]]] = ".", + path: Union[str, Path, List[Union[str, Path]]], cloud_account: Optional[str] = None, progress_bar: bool = True, metadata: Optional[Dict[str, Any]] = None, @@ -192,7 +192,7 @@ def upload_model( name: Fully-qualified model name in the format ``//`` or ``//:``. - path: Local file or directory to upload. Defaults to the current directory. + path: Local file or directory to upload. cloud_account: Cloud account to store the model files in. Falls back to the teamspace default when not provided. progress_bar: Whether to display an upload progress bar. diff --git a/python/tests/cli/model/test_upload.py b/python/tests/cli/model/test_upload.py index 59915970..0997f0ca 100644 --- a/python/tests/cli/model/test_upload.py +++ b/python/tests/cli/model/test_upload.py @@ -21,5 +21,5 @@ def test_upload_model_legacy_help() -> None: "lightning upload model --help", "Deprecation warning:", "Use `lightning model upload` instead of `lightning upload model`.", - "Usage: lightning upload model [OPTIONS] NAME", + "Usage: lightning upload model [OPTIONS] ORG-NAME/TEAMSPACE-NAME/MODEL-NAME", ) diff --git a/python/tests/core/test_models.py b/python/tests/core/test_models.py index 8b980a9b..ee9f0ac8 100644 --- a/python/tests/core/test_models.py +++ b/python/tests/core/test_models.py @@ -235,7 +235,7 @@ def test_upload_model_in_studio_with_org( mock_ts = mock.MagicMock() mock_get_teamspace.return_value = mock_ts - upload_model("model_name") + upload_model("model_name", path=".") mock_parse_org_teamspace_model_version.assert_called_once_with("org-abc/ts-abc/model_name") mock_ts.upload_model.assert_called_once_with( cloud_account=None, @@ -265,7 +265,7 @@ def test_upload_model_in_studio_with_org_and_experiment( experiment = MyDummyExperiment(id="abc") - upload_model("model_name", experiment=experiment) + upload_model("model_name", path=".", experiment=experiment) mock_parse_org_teamspace_model_version.assert_called_once_with("org-abc/ts-abc/model_name") mock_ts.upload_model.assert_called_once_with( cloud_account=None, @@ -293,7 +293,7 @@ def test_upload_model_in_studio_with_user( mock_ts = mock.MagicMock() mock_get_teamspace.return_value = mock_ts - upload_model("model_name") + upload_model("model_name", path=".") mock_parse_org_teamspace_model_version.assert_called_once_with("user-abc/ts-abc/model_name") mock_ts.upload_model.assert_called_once_with( cloud_account=None, From 1156e94149e3928a7727e7741792f5a96d8af9d5 Mon Sep 17 00:00:00 2001 From: Liana Koleva <43767763+lianakoleva@users.noreply.github.com> Date: Tue, 28 Jul 2026 17:35:31 -0700 Subject: [PATCH 2/5] fix: pre-commit --- python/lightning_sdk/cli/model/upload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/lightning_sdk/cli/model/upload.py b/python/lightning_sdk/cli/model/upload.py index 8ad4d68e..26042374 100644 --- a/python/lightning_sdk/cli/model/upload.py +++ b/python/lightning_sdk/cli/model/upload.py @@ -20,4 +20,4 @@ ) def upload_model(name: str, path: str, cloud_account: Optional[str] = None) -> None: """Upload a model to a teamspace.""" - _upload_model(name, path, cloud_account=cloud_account) \ No newline at end of file + _upload_model(name, path, cloud_account=cloud_account) From e638de457678d5195ddaaa44ba01f5dcf4ad6102 Mon Sep 17 00:00:00 2001 From: Liana Koleva <43767763+lianakoleva@users.noreply.github.com> Date: Thu, 30 Jul 2026 16:24:42 -0700 Subject: [PATCH 3/5] fix: click.option -> click.argument --- python/lightning_sdk/cli/legacy/upload.py | 6 +----- python/lightning_sdk/cli/model/upload.py | 6 +----- python/tests/cli/model/test_upload.py | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/python/lightning_sdk/cli/legacy/upload.py b/python/lightning_sdk/cli/legacy/upload.py index 86926e01..b5dcf25f 100644 --- a/python/lightning_sdk/cli/legacy/upload.py +++ b/python/lightning_sdk/cli/legacy/upload.py @@ -41,11 +41,7 @@ def upload() -> None: @upload.command("model") @click.argument("name", metavar="ORG-NAME/TEAMSPACE-NAME/MODEL-NAME") -@click.option( - "--path", - required=True, - help="The path to the file or directory you want to upload.", -) +@click.argument("path") @click.option( "--cloud-account", "--cloud_account", diff --git a/python/lightning_sdk/cli/model/upload.py b/python/lightning_sdk/cli/model/upload.py index 26042374..6667c0cd 100644 --- a/python/lightning_sdk/cli/model/upload.py +++ b/python/lightning_sdk/cli/model/upload.py @@ -10,11 +10,7 @@ @click.command("upload", cls=LightningCommand) @click.argument("name", metavar="ORG-NAME/TEAMSPACE-NAME/MODEL-NAME") -@click.option( - "--path", - required=True, - help="The path to the file or directory you want to upload.", -) +@click.argument("path") @click.option( "--cloud-account", "--cloud_account", default=None, help="The name of the cloud account to store the Model in." ) diff --git a/python/tests/cli/model/test_upload.py b/python/tests/cli/model/test_upload.py index 0997f0ca..748607c6 100644 --- a/python/tests/cli/model/test_upload.py +++ b/python/tests/cli/model/test_upload.py @@ -21,5 +21,5 @@ def test_upload_model_legacy_help() -> None: "lightning upload model --help", "Deprecation warning:", "Use `lightning model upload` instead of `lightning upload model`.", - "Usage: lightning upload model [OPTIONS] ORG-NAME/TEAMSPACE-NAME/MODEL-NAME", + "Usage: lightning upload model [OPTIONS] ORG-NAME/TEAMSPACE-NAME/MODEL-NAME PATH", ) From c1c7d53d03c257623df5ce349d59637b41405169 Mon Sep 17 00:00:00 2001 From: Liana Koleva <43767763+lianakoleva@users.noreply.github.com> Date: Thu, 30 Jul 2026 16:48:10 -0700 Subject: [PATCH 4/5] fix: update tests --- python/tests/cli/model/test_upload.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/python/tests/cli/model/test_upload.py b/python/tests/cli/model/test_upload.py index 748607c6..28d79404 100644 --- a/python/tests/cli/model/test_upload.py +++ b/python/tests/cli/model/test_upload.py @@ -4,14 +4,22 @@ @mock_command_logging def test_model_upload_help() -> None: assert_help_contains( - "lightning model upload --help", "Usage: lightning model upload", "Upload a model to a teamspace." + "lightning model upload --help", + "Usage: ", + "lightning model upload", + "ORG-NAME/TEAMSPACE-NAME/MODEL-NAME PATH", + "Upload a model to a teamspace.", ) @mock_command_logging def test_models_upload_help() -> None: assert_help_contains( - "lightning models upload --help", "Usage: lightning models upload", "Upload a model to a teamspace." + "lightning models upload --help", + "Usage: ", + "lightning models upload", + "ORG-NAME/TEAMSPACE-NAME/MODEL-NAME PATH", + "Upload a model to a teamspace.", ) From 798eb7132ac9c5cd833d5bed1969d97d2f3b367b Mon Sep 17 00:00:00 2001 From: Liana Koleva <43767763+lianakoleva@users.noreply.github.com> Date: Thu, 30 Jul 2026 16:50:01 -0700 Subject: [PATCH 5/5] fix: pre-commit --- python/tests/cli/model/test_upload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tests/cli/model/test_upload.py b/python/tests/cli/model/test_upload.py index 28d79404..f1790a58 100644 --- a/python/tests/cli/model/test_upload.py +++ b/python/tests/cli/model/test_upload.py @@ -16,7 +16,7 @@ def test_model_upload_help() -> None: def test_models_upload_help() -> None: assert_help_contains( "lightning models upload --help", - "Usage: ", + "Usage: ", "lightning models upload", "ORG-NAME/TEAMSPACE-NAME/MODEL-NAME PATH", "Upload a model to a teamspace.",