truefoundry 0.11.0__py3-none-any.whl → 0.11.1rc1__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.

Potentially problematic release.


This version of truefoundry might be problematic. Click here for more details.

@@ -46,7 +46,6 @@ from truefoundry.ml._autogen.client.exceptions import (
46
46
  ApiException,
47
47
  NotFoundException,
48
48
  )
49
- from truefoundry.ml.clients.servicefoundry_client import ServiceFoundryServiceClient
50
49
  from truefoundry.ml.enums import ModelFramework, ViewType
51
50
  from truefoundry.ml.exceptions import MlFoundryException
52
51
  from truefoundry.ml.internal_namespace import NAMESPACE
@@ -139,7 +138,8 @@ class MlFoundry:
139
138
  except (IndexError, NotFoundError):
140
139
  err_msg = (
141
140
  f"ML Repo Does Not Exist for name: {ml_repo}. You may either "
142
- "create it from the dashboard or using client.create_ml_repo('<ml_repo_name>')"
141
+ f"create it from the dashboard or using "
142
+ f"`client.create_ml_repo(ml_repo='{ml_repo}', storage_integration_fqn='<storage_integration_fqn>')`"
143
143
  )
144
144
  raise MlFoundryException(err_msg) from None
145
145
  except ApiError as e:
@@ -191,7 +191,12 @@ class MlFoundry:
191
191
 
192
192
  client = get_client()
193
193
 
194
- client.create_ml_repo(ml_repo="my-repo")
194
+ client.create_ml_repo(
195
+ ml_repo="my-repo",
196
+ # This controls which bucket is used.
197
+ # You can get this from Platform > Integrations > Copy FQN of any Blob Storage type integration.
198
+ storage_integration_fqn="..."
199
+ )
195
200
  ```
196
201
  """
197
202
  _validate_ml_repo_name(ml_repo_name=name)
@@ -235,28 +240,11 @@ class MlFoundry:
235
240
  raise MlFoundryException(err_msg) from e
236
241
  return
237
242
 
238
- servicefoundry_client = ServiceFoundryServiceClient(
239
- tfy_host=self._api_client.tfy_host,
240
- token=self._api_client.access_token,
241
- )
242
-
243
- assert existing_ml_repo.storage_integration_id is not None
244
- try:
245
- existing_storage_integration = (
246
- servicefoundry_client.get_integration_from_id(
247
- existing_ml_repo.storage_integration_id
248
- )
249
- )
250
- except Exception as e:
251
- raise MlFoundryException(
252
- "Error in getting storage integration for ML Repo"
253
- ) from e
254
-
255
- if existing_storage_integration["fqn"] != storage_integration_fqn:
243
+ if existing_ml_repo.manifest.storage_integration_fqn != storage_integration_fqn:
256
244
  raise MlFoundryException(
257
245
  f"ML Repo with same name already exists with storage integration:"
258
- f"{existing_storage_integration['fqn']}. Cannot update the storage integration to: "
259
- f"{storage_integration_fqn}"
246
+ f"{existing_ml_repo.manifest.storage_integration_fqn!r}. "
247
+ f"Cannot update the storage integration to: {storage_integration_fqn!r}"
260
248
  )
261
249
 
262
250
  def create_run(
@@ -562,7 +550,8 @@ class MlFoundry:
562
550
  except (IndexError, NotFoundError):
563
551
  raise MlFoundryException(
564
552
  f"ML Repo with name {ml_repo} does not exist. "
565
- "You may either create it from the dashboard or using client.create_ml_repo('<ml_repo_name>')"
553
+ f"You may either create it from the dashboard or using "
554
+ f"`client.create_ml_repo(ml_repo='{ml_repo}', storage_integration_fqn='<storage_integration_fqn>')`"
566
555
  ) from None
567
556
  except ApiError as e:
568
557
  raise MlFoundryException(
@@ -1202,7 +1191,12 @@ class MlFoundry:
1202
1191
  client = get_client()
1203
1192
  ml_repo = "sample-repo"
1204
1193
 
1205
- client.create_ml_repo(ml_repo=ml_repo)
1194
+ client.create_ml_repo(
1195
+ ml_repo=ml_repo,
1196
+ # This controls which bucket is used.
1197
+ # You can get this from Platform > Integrations > Copy FQN of any Blob Storage type integration.
1198
+ storage_integration_fqn="..."
1199
+ )
1206
1200
  client.log_artifact(
1207
1201
  ml_repo=ml_repo,
1208
1202
  name="hello-world-file",
@@ -1301,8 +1295,8 @@ class MlFoundry:
1301
1295
  client.create_ml_repo( # This is only required once
1302
1296
  ml_repo="my-classification-project",
1303
1297
  # This controls which bucket is used.
1304
- # You can get this from Integrations > Blob Storage. `None` picks the default
1305
- storage_integration_fqn=None
1298
+ # You can get this from Platform > Integrations > Copy FQN of any Blob Storage type integration.
1299
+ storage_integration_fqn="..."
1306
1300
  )
1307
1301
  model_version = client.log_model(
1308
1302
  ml_repo="my-classification-project",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: truefoundry
3
- Version: 0.11.0
3
+ Version: 0.11.1rc1
4
4
  Summary: TrueFoundry CLI
5
5
  Author-email: TrueFoundry Team <abhishek@truefoundry.com>
6
6
  Requires-Python: <3.14,>=3.8.1
@@ -30,7 +30,7 @@ Requires-Dist: requirements-parser<0.12.0,>=0.11.0
30
30
  Requires-Dist: rich-click<2.0.0,>=1.2.1
31
31
  Requires-Dist: rich<14.0.0,>=13.7.1
32
32
  Requires-Dist: tqdm<5.0.0,>=4.0.0
33
- Requires-Dist: truefoundry-sdk<0.2.0,>=0.1.5
33
+ Requires-Dist: truefoundry-sdk<0.2.0,>=0.1.7
34
34
  Requires-Dist: typing-extensions>=4.0
35
35
  Requires-Dist: urllib3<3,>=1.26.18
36
36
  Requires-Dist: yq<4.0.0,>=3.1.0
@@ -127,7 +127,7 @@ truefoundry/ml/exceptions.py,sha256=QpDJSWmF7dIsByS0qOQbQZ_jytdNTzkHDDO3BxhTSo0,
127
127
  truefoundry/ml/git_info.py,sha256=jvAVm9ilqivnGq8qJdUvYdd8Siv0PLtqurB-PXsS5ho,2023
128
128
  truefoundry/ml/internal_namespace.py,sha256=QcqMHp6-C2im2H_02hlhi01EIcr1HhNaZprszs13EMU,1790
129
129
  truefoundry/ml/logger.py,sha256=VT-BF3BnBYTWVq87O58F0c8uXMu94gYzsiFlGY3_7Ao,458
130
- truefoundry/ml/mlfoundry_api.py,sha256=hA6XjaONGEUS4beewZd5HEA0mGRew_wMvUJaQW7CThc,60168
130
+ truefoundry/ml/mlfoundry_api.py,sha256=EZvFs-HiUDV2H0tDrgRdeotplWTZm3T5Uw-0Zq3WuHo,60174
131
131
  truefoundry/ml/mlfoundry_run.py,sha256=b0wm08OUAiO1UpzdDNBeJh-Gsm_O5kEdbY86Ugv-26Y,44181
132
132
  truefoundry/ml/model_framework.py,sha256=nVbKTtKDRBdLzt7Wrg5_vJKZ-awHbISGvL73s-V9egU,18975
133
133
  truefoundry/ml/prompt_utils.py,sha256=8FueyElVTXLnLtC3O6hKsW_snocArr_B8KG3Qv6eFIQ,2651
@@ -355,7 +355,6 @@ truefoundry/ml/cli/commands/__init__.py,sha256=diDUiRUX4l6TtNLI4iF-ZblczkELM7FRV
355
355
  truefoundry/ml/cli/commands/download.py,sha256=N9MhsEQ3U24v_OmnMZT8Q4SoAi38Sm7a21unrACOSDw,2573
356
356
  truefoundry/ml/cli/commands/model_init.py,sha256=INyUAU6hiFClI8cZqX5hgnrtNbeKxlZxrjFrjzStU18,2664
357
357
  truefoundry/ml/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
358
- truefoundry/ml/clients/servicefoundry_client.py,sha256=GiB_SmETI2uo8E0Q43cEsOG6qYb80nB6gM7l3rL7zEs,2422
359
358
  truefoundry/ml/log_types/__init__.py,sha256=g4u4D4Jaj0aBK5GtrLV88-qThKZR9pSZ17vFEkN-LmM,125
360
359
  truefoundry/ml/log_types/plot.py,sha256=LDh4uy6z2P_a2oPM2lc85c0lt8utVvunohzeMawFjZw,7572
361
360
  truefoundry/ml/log_types/pydantic_base.py,sha256=eBlw_AEyAz4iJKDP4zgJOCFWcldwQqpf7FADW1jzIQY,272
@@ -381,7 +380,7 @@ truefoundry/workflow/remote_filesystem/__init__.py,sha256=LQ95ViEjJ7Ts4JcCGOxMPs
381
380
  truefoundry/workflow/remote_filesystem/logger.py,sha256=em2l7D6sw7xTLDP0kQSLpgfRRCLpN14Qw85TN7ujQcE,1022
382
381
  truefoundry/workflow/remote_filesystem/tfy_signed_url_client.py,sha256=xcT0wQmQlgzcj0nP3tJopyFSVWT1uv3nhiTIuwfXYeg,12342
383
382
  truefoundry/workflow/remote_filesystem/tfy_signed_url_fs.py,sha256=nSGPZu0Gyd_jz0KsEE-7w_BmnTD8CVF1S8cUJoxaCbc,13305
384
- truefoundry-0.11.0.dist-info/METADATA,sha256=nxfBh-eMI7_N9k5Baa3I_H3UwKMNOUH2jWPuE5-l4TE,2505
385
- truefoundry-0.11.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
386
- truefoundry-0.11.0.dist-info/entry_points.txt,sha256=xVjn7RMN-MW2-9f7YU-bBdlZSvvrwzhpX1zmmRmsNPU,98
387
- truefoundry-0.11.0.dist-info/RECORD,,
383
+ truefoundry-0.11.1rc1.dist-info/METADATA,sha256=jIzJR7W9qc5D4a-WuEne8Y8BUotdhjnc_CEcz-Bdp78,2508
384
+ truefoundry-0.11.1rc1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
385
+ truefoundry-0.11.1rc1.dist-info/entry_points.txt,sha256=xVjn7RMN-MW2-9f7YU-bBdlZSvvrwzhpX1zmmRmsNPU,98
386
+ truefoundry-0.11.1rc1.dist-info/RECORD,,
@@ -1,65 +0,0 @@
1
- import functools
2
-
3
- from truefoundry.common.constants import (
4
- SERVICEFOUNDRY_CLIENT_MAX_RETRIES,
5
- VERSION_PREFIX,
6
- )
7
- from truefoundry.common.exceptions import HttpRequestException
8
- from truefoundry.common.request_utils import (
9
- http_request,
10
- request_handling,
11
- requests_retry_session,
12
- )
13
- from truefoundry.common.servicefoundry_client import (
14
- ServiceFoundryServiceClient as BaseServiceFoundryServiceClient,
15
- )
16
- from truefoundry.common.utils import get_user_agent
17
- from truefoundry.ml.exceptions import MlFoundryException
18
-
19
-
20
- class ServiceFoundryServiceClient(BaseServiceFoundryServiceClient):
21
- def __init__(self, tfy_host: str, token: str):
22
- super().__init__(tfy_host=tfy_host)
23
- self._token = token
24
-
25
- @functools.cached_property
26
- def _min_cli_version_required(self) -> str:
27
- # TODO (chiragjn): read the mlfoundry min cli version from the config?
28
- return self.python_sdk_config.truefoundry_cli_min_version
29
-
30
- def get_integration_from_id(self, integration_id: str):
31
- integration_id = integration_id or ""
32
- session = requests_retry_session(retries=SERVICEFOUNDRY_CLIENT_MAX_RETRIES)
33
- response = http_request(
34
- method="get",
35
- url=f"{self._api_server_url}/{VERSION_PREFIX}/provider-accounts/provider-integrations",
36
- token=self._token,
37
- timeout=3,
38
- params={"id": integration_id, "type": "blob-storage"},
39
- session=session,
40
- headers={
41
- "User-Agent": get_user_agent(),
42
- },
43
- )
44
-
45
- try:
46
- result = request_handling(response)
47
- assert isinstance(result, dict)
48
- except HttpRequestException as he:
49
- raise MlFoundryException(
50
- f"Failed to get storage integration from id: {integration_id}. Error: {he.message}",
51
- status_code=he.status_code,
52
- ) from None
53
- except Exception as e:
54
- raise MlFoundryException(
55
- f"Failed to get storage integration from id: {integration_id}. Error: {str(e)}"
56
- ) from None
57
-
58
- data = result.get("data", result.get("providerAccounts"))
59
- # TODO (chiragjn): Parse this using Pydantic
60
- if data and len(data) > 0 and data[0]:
61
- return data[0]
62
- else:
63
- raise MlFoundryException(
64
- f"Invalid storage integration id: {integration_id}"
65
- )