lightning-sdk 2025.9.11__py3-none-any.whl → 2025.9.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
lightning_sdk/__init__.py CHANGED
@@ -10,7 +10,7 @@ from lightning_sdk.organization import Organization
10
10
  from lightning_sdk.plugin import JobsPlugin, MultiMachineTrainingPlugin, Plugin, SlurmJobsPlugin
11
11
  from lightning_sdk.status import Status
12
12
  from lightning_sdk.studio import Studio
13
- from lightning_sdk.teamspace import Teamspace
13
+ from lightning_sdk.teamspace import FolderLocation, Teamspace
14
14
  from lightning_sdk.user import User
15
15
 
16
16
  __all__ = [
@@ -29,9 +29,10 @@ __all__ = [
29
29
  "Status",
30
30
  "Studio",
31
31
  "Teamspace",
32
+ "FolderLocation",
32
33
  "User",
33
34
  ]
34
35
 
35
- __version__ = "2025.09.11"
36
+ __version__ = "2025.09.16"
36
37
  _check_version_and_prompt_upgrade(__version__)
37
38
  _set_tqdm_envvars_noninteractive()
@@ -1,5 +1,6 @@
1
1
  from lightning_sdk.api.agents_api import AgentApi
2
2
  from lightning_sdk.api.ai_hub_api import AIHubApi
3
+ from lightning_sdk.api.cloud_account_api import CloudAccountApi
3
4
  from lightning_sdk.api.org_api import OrgApi
4
5
  from lightning_sdk.api.studio_api import StudioApi
5
6
  from lightning_sdk.api.teamspace_api import TeamspaceApi
@@ -12,4 +13,5 @@ __all__ = [
12
13
  "UserApi",
13
14
  "AgentApi",
14
15
  "AIHubApi",
16
+ "CloudAccountApi",
15
17
  ]
@@ -131,13 +131,20 @@ class CloudAccountApi:
131
131
  )
132
132
  return list(filtered_cloud_accounts)
133
133
 
134
- def get_cloud_account_provider_mapping(self, teamspace_id: str) -> Dict["CloudProvider", str]:
134
+ def get_cloud_account_provider_mapping(self, teamspace_id: str) -> Dict["CloudProvider", V1ExternalCluster]:
135
135
  """Gets the cloud account <-> provider mapping."""
136
136
  res = self.list_global_cloud_accounts(teamspace_id=teamspace_id)
137
- return {self._get_cloud_account_provider(cloud_account): cloud_account.id for cloud_account in res}
137
+ cloud_accounts = {cloud_account.id: cloud_account for cloud_account in res}
138
+ providers = {cloud_account.id: self._get_cloud_account_provider(cloud_account) for cloud_account in res}
139
+
140
+ mapping = {}
141
+ for cloud_account_id, provider in providers.items():
142
+ if provider is not None:
143
+ mapping[provider] = cloud_accounts[cloud_account_id]
144
+ return mapping
138
145
 
139
146
  @staticmethod
140
- def _get_cloud_account_provider(cloud_account: Optional[V1ExternalCluster]) -> "CloudProvider":
147
+ def _get_cloud_account_provider(cloud_account: Optional[V1ExternalCluster]) -> Optional["CloudProvider"]:
141
148
  """Determines the cloud provider based on the cloud_account configuration.
142
149
 
143
150
  Args:
@@ -172,7 +179,7 @@ class CloudAccountApi:
172
179
  if cloud_account.spec.nebius_v1:
173
180
  return CloudProvider.NEBIUS
174
181
 
175
- return CloudProvider.AWS
182
+ return None
176
183
 
177
184
  def resolve_cloud_account(
178
185
  self,
@@ -201,7 +208,7 @@ class CloudAccountApi:
201
208
  if cloud_provider:
202
209
  cloud_account_mapping = self.get_cloud_account_provider_mapping(teamspace_id=teamspace_id)
203
210
  if cloud_provider and cloud_provider in cloud_account_mapping:
204
- return cloud_account_mapping[cloud_provider]
211
+ return cloud_account_mapping[cloud_provider].id
205
212
 
206
213
  if default_cloud_account:
207
214
  return default_cloud_account
@@ -17,6 +17,7 @@ from lightning_sdk.api.utils import (
17
17
  )
18
18
  from lightning_sdk.lightning_cloud.login import Auth
19
19
  from lightning_sdk.lightning_cloud.openapi import (
20
+ Create,
20
21
  Externalv1LightningappInstance,
21
22
  ModelIdVersionsBody,
22
23
  ModelsStoreApi,
@@ -28,6 +29,8 @@ from lightning_sdk.lightning_cloud.openapi import (
28
29
  V1CloudSpace,
29
30
  V1ClusterAccelerator,
30
31
  V1Endpoint,
32
+ V1ExternalCluster,
33
+ V1GCSFolderDataConnection,
31
34
  V1Job,
32
35
  V1LoginRequest,
33
36
  V1Model,
@@ -36,6 +39,8 @@ from lightning_sdk.lightning_cloud.openapi import (
36
39
  V1Project,
37
40
  V1ProjectClusterBinding,
38
41
  V1PromptSuggestion,
42
+ V1R2DataConnection,
43
+ V1S3FolderDataConnection,
39
44
  V1Secret,
40
45
  V1SecretType,
41
46
  V1UpstreamOpenAI,
@@ -489,3 +494,24 @@ class TeamspaceApi:
489
494
  """
490
495
  pattern = r"^[A-Za-z_][A-Za-z0-9_]*$"
491
496
  return re.match(pattern, name) is not None
497
+
498
+ def new_folder(self, teamspace_id: str, name: str, cluster: Optional[V1ExternalCluster]) -> None:
499
+ create_request = Create(
500
+ name=name,
501
+ create_resources=True,
502
+ force=True,
503
+ writable=True,
504
+ )
505
+
506
+ if cluster is None:
507
+ create_request.r2 = V1R2DataConnection(name=name)
508
+ else:
509
+ create_request.cluster_id = cluster.id
510
+ create_request.access_cluster_ids = [cluster.id]
511
+
512
+ if cluster.spec.aws_v1:
513
+ create_request.s3_folder = V1S3FolderDataConnection()
514
+ elif cluster.spec.google_cloud_v1:
515
+ create_request.gcs_folder = V1GCSFolderDataConnection()
516
+
517
+ self._client.data_connection_service_create_data_connection(create_request, teamspace_id)
lightning_sdk/llm/llm.py CHANGED
@@ -368,7 +368,7 @@ class LLM:
368
368
  metadata: Optional[Dict[str, str]] = None,
369
369
  stream: bool = False,
370
370
  full_response: bool = False,
371
- reasoning_effort: Optional[Literal["low", "medium", "highc"]] = None,
371
+ reasoning_effort: Optional[Literal["none", "low", "medium", "high"]] = None,
372
372
  **kwargs: Any,
373
373
  ) -> Union[str, AsyncGenerator[str, None]]:
374
374
  conversation_id = self._conversations.get(conversation) if conversation else None
@@ -404,13 +404,13 @@ class LLM:
404
404
  stream: bool = False,
405
405
  full_response: bool = False,
406
406
  tools: Optional[List[Dict[str, Any]]] = None,
407
- reasoning_effort: Optional[Literal["low", "medium", "high"]] = None,
407
+ reasoning_effort: Optional[Literal["none", "low", "medium", "high"]] = None,
408
408
  **kwargs: Any,
409
409
  ) -> Union[
410
410
  V1ConversationResponseChunk, Generator[V1ConversationResponseChunk, None, None], str, Generator[str, None, None]
411
411
  ]:
412
- if reasoning_effort is not None and reasoning_effort not in ["low", "medium", "high"]:
413
- raise ValueError("reasoning_effort must be 'low', 'medium', 'high', or None")
412
+ if reasoning_effort is not None and reasoning_effort not in ["none", "low", "medium", "high"]:
413
+ raise ValueError("reasoning_effort must be 'none', 'low', 'medium', 'high', or None")
414
414
 
415
415
  if conversation and conversation not in self._conversations:
416
416
  self._get_conversations()
@@ -1,6 +1,7 @@
1
1
  import glob
2
2
  import os
3
3
  import warnings
4
+ from enum import Enum
4
5
  from pathlib import Path
5
6
  from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
6
7
 
@@ -8,9 +9,9 @@ from tqdm.auto import tqdm
8
9
 
9
10
  import lightning_sdk
10
11
  from lightning_sdk.agents import Agent
11
- from lightning_sdk.api import TeamspaceApi
12
- from lightning_sdk.lightning_cloud.openapi import V1Model, V1ModelVersionArchive, V1ProjectClusterBinding
13
- from lightning_sdk.machine import Machine
12
+ from lightning_sdk.api import CloudAccountApi, TeamspaceApi
13
+ from lightning_sdk.lightning_cloud.openapi import V1ClusterType, V1Model, V1ModelVersionArchive, V1ProjectClusterBinding
14
+ from lightning_sdk.machine import CloudProvider, Machine
14
15
  from lightning_sdk.models import UploadedModelInfo
15
16
  from lightning_sdk.organization import Organization
16
17
  from lightning_sdk.owner import Owner
@@ -30,6 +31,16 @@ if TYPE_CHECKING:
30
31
  from lightning_sdk.studio import Studio
31
32
 
32
33
 
34
+ class FolderLocation(Enum):
35
+ AWS = "AWS"
36
+ GCP = "GCP"
37
+ CLOUD_AGNOSTIC = "CLOUD_AGNOSTIC"
38
+
39
+ def __str__(self) -> str:
40
+ """Converts the FolderLocation to a str."""
41
+ return self.value
42
+
43
+
33
44
  class Teamspace:
34
45
  """A teamspace is a collection of Studios, Clusters, Members and an associated Budget.
35
46
 
@@ -54,6 +65,7 @@ class Teamspace:
54
65
  user: Optional[Union[str, User]] = None,
55
66
  ) -> None:
56
67
  self._teamspace_api = TeamspaceApi()
68
+ self._cloud_account_api = CloudAccountApi()
57
69
 
58
70
  name = _resolve_teamspace_name(name)
59
71
 
@@ -515,6 +527,53 @@ class Teamspace:
515
527
  cloud_account=self.default_cloud_account,
516
528
  )
517
529
 
530
+ def new_folder(
531
+ self, name: str, location: Optional[FolderLocation] = None, cloud_account: Optional[str] = None
532
+ ) -> None:
533
+ """Create a new folder in this Teamspace.
534
+
535
+ Args:
536
+ name: The name of the folder. Folders will be accesible under `/teamspace/folders/<name>`
537
+ location: The location of the folder. Defaults to cloud agnostic.
538
+ cloud_account: The cloud account to create the folder in. Not used for cloud agnostic folders.
539
+ """
540
+ if cloud_account is None:
541
+ cloud_account = self.default_cloud_account
542
+
543
+ cloud_accounts = self._cloud_account_api.list_cloud_accounts(self.id)
544
+ resolved_cloud_accounts = [
545
+ external_cloud for external_cloud in cloud_accounts if external_cloud.id == cloud_account
546
+ ]
547
+
548
+ if len(resolved_cloud_accounts) == 0:
549
+ raise ValueError(f"Cloud account not found: {cloud_account}")
550
+
551
+ resolved_cloud_account = resolved_cloud_accounts[0]
552
+
553
+ # if the cloud account is global, default to agnostic
554
+ if location is None and resolved_cloud_account.spec.cluster_type == V1ClusterType.GLOBAL:
555
+ location = FolderLocation.CLOUD_AGNOSTIC
556
+
557
+ # if it's global, then default to agnostic, and aws / gcp otherwise if set
558
+ if (
559
+ location is not None
560
+ and location != FolderLocation.CLOUD_AGNOSTIC
561
+ and resolved_cloud_account.spec.cluster_type == V1ClusterType.GLOBAL
562
+ ):
563
+ providers = self._cloud_account_api.get_cloud_account_provider_mapping(self.id)
564
+
565
+ if location == FolderLocation.AWS:
566
+ resolved_cloud_account = providers[CloudProvider.AWS]
567
+ elif location == FolderLocation.GCP:
568
+ resolved_cloud_account = providers[CloudProvider.GCP]
569
+
570
+ if location == FolderLocation.CLOUD_AGNOSTIC:
571
+ self._teamspace_api.new_folder(self.id, name, None)
572
+ else:
573
+ self._teamspace_api.new_folder(self.id, name, resolved_cloud_account)
574
+
575
+ return
576
+
518
577
 
519
578
  def _list_files(path: Union[str, Path]) -> Tuple[List[Path], List[str]]:
520
579
  """List all folders in a directory and return them as a list and relative path."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lightning_sdk
3
- Version: 2025.9.11
3
+ Version: 2025.9.16
4
4
  Summary: SDK to develop using Lightning AI Studios
5
5
  Author-email: Lightning-AI <justus@lightning.ai>
6
6
  License: MIT License
@@ -1,5 +1,5 @@
1
1
  docs/source/conf.py,sha256=r8yX20eC-4mHhMTd0SbQb5TlSWHhO6wnJ0VJ_FBFpag,13249
2
- lightning_sdk/__init__.py,sha256=RTO9pPFR4nJ_S0mZ9BOC-0Wp3hCm4yZ1f8Lvr8RjDwI,1145
2
+ lightning_sdk/__init__.py,sha256=1wyKGyM8HKl1zyLHQ97cOY7_jZefa5V89YaxP3-0s08,1183
3
3
  lightning_sdk/agents.py,sha256=ly6Ma1j0ZgGPFyvPvMN28JWiB9dATIstFa5XM8pMi6I,1577
4
4
  lightning_sdk/ai_hub.py,sha256=iI1vNhgcz_Ff1c3rN1ogN7dK-r-HXRj6NMtS2cA14UA,6925
5
5
  lightning_sdk/base_studio.py,sha256=_Pwwl37R9GRd7t-f2kO5aQXiLNrP4sUtUNht2ZkP8LE,3678
@@ -15,13 +15,13 @@ lightning_sdk/sandbox.py,sha256=_NvnWotEXW2rBiVFZZ4krKXxVjuAqfNh04qELSM0-Pg,5786
15
15
  lightning_sdk/serve.py,sha256=uW7zLhQ3X90ifetpxzTb8FNxifv5vIs7qZlgfEjVKzk,11794
16
16
  lightning_sdk/status.py,sha256=lLGAuSvXBoXQFEEsEYwdCi0RcSNatUn5OPjJVjDtoM0,386
17
17
  lightning_sdk/studio.py,sha256=3BE44Ya-2HXmDkF58lVQmd7KVzzzPktqX1SV7K3nkfo,31438
18
- lightning_sdk/teamspace.py,sha256=qYpIYgg3eyWj9vcqdfhQN-YCpS47tOc_xB3de07p4Y8,21630
18
+ lightning_sdk/teamspace.py,sha256=fjsbMw_fmAHLldAGT03R8Byp1znR6ZYAh9PXUAzzP8w,24016
19
19
  lightning_sdk/user.py,sha256=TSYh38rxoi7qKOfrK2JYh_Nknya2Kbz2ngDIY85fFOY,1778
20
- lightning_sdk/api/__init__.py,sha256=Qn2VVRvir_gO7w4yxGLkZY-R3T7kdiTPKgQ57BhIA9k,413
20
+ lightning_sdk/api/__init__.py,sha256=xrp_RNECJGQtL5rZHF69WOzEuEIbWSLtjWAJAz4R5K4,500
21
21
  lightning_sdk/api/agents_api.py,sha256=G47TbFo9kYqnBMqdw2RW-lfS1VAUBSXDmzs6fpIEMUs,4059
22
22
  lightning_sdk/api/ai_hub_api.py,sha256=azqDZ-PzasVAcoQHno7k7OO_xFOHQ4NDozxF8jEh83Y,7864
23
23
  lightning_sdk/api/base_studio_api.py,sha256=3R8tucZX2e9yKHBcY2rWFRP4dxqLrC6H75vdBDkH0ck,3617
24
- lightning_sdk/api/cloud_account_api.py,sha256=b_Egg5yhDh5G39g1cqA3ZxBDmU9iuDs2PlBMmW0HVnA,8417
24
+ lightning_sdk/api/cloud_account_api.py,sha256=pPeNUcl_7qE0BsrLfmvG0dH0rCJfHiSFexBs4UxWXBM,8732
25
25
  lightning_sdk/api/deployment_api.py,sha256=v2AfoTDkQ-1CBh75FOjFkRpf6yc3U_edDy43uYSn19I,24852
26
26
  lightning_sdk/api/job_api.py,sha256=7spFPyotlSQ0Krx6WymslnpSQaaeOmFkydvhtg6p0Ic,16410
27
27
  lightning_sdk/api/license_api.py,sha256=XV3RhefyPQDYjwY9AaBZe4rByZTEAnsvLDxcdm9q0Wo,2438
@@ -31,7 +31,7 @@ lightning_sdk/api/mmt_api.py,sha256=hIBsGiJ2qn5UjcHDxP5WUyKGT_AIFfpSHrQVwg0afBw,
31
31
  lightning_sdk/api/org_api.py,sha256=Ze3z_ATVrukobujV5YdC42DKj45Vuwl7X52q_Vr-o3U,803
32
32
  lightning_sdk/api/pipeline_api.py,sha256=rJYp_FN7uUjC5xbc6K67l2eRSmVuOkijd5i8Nm5BF7I,4621
33
33
  lightning_sdk/api/studio_api.py,sha256=Aji8lke2jGeef-1lh6wV7EQ15iuiw1Cn_IuBNnEb8SA,39492
34
- lightning_sdk/api/teamspace_api.py,sha256=ygQAGG5W4EqcXv2PO2cYPdAN5fGj75R-1IZkNq7Z9gU,18416
34
+ lightning_sdk/api/teamspace_api.py,sha256=XPyUtpL5iyt9BpXw5WM-_hT2R3OzuC1GcumnI2ktVhQ,19333
35
35
  lightning_sdk/api/user_api.py,sha256=FQFgdZOopEvtFJcJT1mRRuStqKKYmg4iuVUYDSQfDVM,4514
36
36
  lightning_sdk/api/utils.py,sha256=1NJgW4HCfzMqgnAqbMA7RRr2v3iM3KTuPIUQK5klDeQ,27127
37
37
  lightning_sdk/cli/__init__.py,sha256=lksw08t_ZIuHOH47LCIqSVHeZ8cUXI2aJWHYhyujYHM,32
@@ -1152,7 +1152,7 @@ lightning_sdk/lightning_cloud/utils/dataset.py,sha256=4nUspe8iAaRPgSYpXA2uAQCgyd
1152
1152
  lightning_sdk/lightning_cloud/utils/name_generator.py,sha256=MkciuA10332V0mcE2PxLIiwWomWE0Fm_gNGK01vwRr4,58046
1153
1153
  lightning_sdk/lightning_cloud/utils/network.py,sha256=axPgl8rhyPcPjxiztDxyksfxax3VNg2OXL5F5Uc81b4,406
1154
1154
  lightning_sdk/llm/__init__.py,sha256=ErZva0HqN2iPtK_6hI6GN7A_HPGNrHo3wYh7vyFdO3Q,57
1155
- lightning_sdk/llm/llm.py,sha256=M2gKP77SDz05flUpvnqh6vLXLdNwNzPn2jzXTIls7S0,20805
1155
+ lightning_sdk/llm/llm.py,sha256=pjBs8fbGZjs0tQRKHx-WdfTmeECKAwI_T1ShVBgdyO4,20836
1156
1156
  lightning_sdk/llm/public_assistants.py,sha256=k0yc41AyrKImnRa8Fv-ow9javnlrRQeP63507p2VybA,1579
1157
1157
  lightning_sdk/mmt/__init__.py,sha256=ExMu90-96bGBnyp5h0CErQszUGB1-PcjC4-R8_NYbeY,117
1158
1158
  lightning_sdk/mmt/base.py,sha256=iqVudKDxazomuezj6l7pa-m9I1EQnM82OKs4ZQbo4Ck,16434
@@ -1177,9 +1177,9 @@ lightning_sdk/utils/enum.py,sha256=h2JRzqoBcSlUdanFHmkj_j5DleBHAu1esQYUsdNI-hU,4
1177
1177
  lightning_sdk/utils/names.py,sha256=1EuXbIh7wldkDp1FG10oz9vIOyWrpGWeFFVy-DQBgzA,18162
1178
1178
  lightning_sdk/utils/progress.py,sha256=IXfEcUF-rL5jIw0Hir6eSxN7VBZfR--1O2LaEhGAU70,12698
1179
1179
  lightning_sdk/utils/resolve.py,sha256=4TyEnIgIrvkSvYk5i5PmcIogD_5Y9pBhiphRLfLMttc,10477
1180
- lightning_sdk-2025.9.11.dist-info/LICENSE,sha256=uFIuZwj5z-4TeF2UuacPZ1o17HkvKObT8fY50qN84sg,1064
1181
- lightning_sdk-2025.9.11.dist-info/METADATA,sha256=qmaN-yNF1oQ04YxqFC1BOQJ8sdFTT8EjzzwqRihys3Q,4130
1182
- lightning_sdk-2025.9.11.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1183
- lightning_sdk-2025.9.11.dist-info/entry_points.txt,sha256=OoZa4Fc8NMs6GSN0cdA1J8e6couzAcL82CbM1yo4f_M,122
1184
- lightning_sdk-2025.9.11.dist-info/top_level.txt,sha256=ps8doKILFXmN7F1mHncShmnQoTxKBRPIcchC8TpoBw4,19
1185
- lightning_sdk-2025.9.11.dist-info/RECORD,,
1180
+ lightning_sdk-2025.9.16.dist-info/LICENSE,sha256=uFIuZwj5z-4TeF2UuacPZ1o17HkvKObT8fY50qN84sg,1064
1181
+ lightning_sdk-2025.9.16.dist-info/METADATA,sha256=GR7YQsSApMYI943xTmY0qASB5yv4cUrFub3xlY0gwnI,4130
1182
+ lightning_sdk-2025.9.16.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1183
+ lightning_sdk-2025.9.16.dist-info/entry_points.txt,sha256=OoZa4Fc8NMs6GSN0cdA1J8e6couzAcL82CbM1yo4f_M,122
1184
+ lightning_sdk-2025.9.16.dist-info/top_level.txt,sha256=ps8doKILFXmN7F1mHncShmnQoTxKBRPIcchC8TpoBw4,19
1185
+ lightning_sdk-2025.9.16.dist-info/RECORD,,