zenml-nightly 0.66.0.dev20240910__py3-none-any.whl → 0.66.0.dev20240913__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.
zenml/VERSION CHANGED
@@ -1 +1 @@
1
- 0.66.0.dev20240910
1
+ 0.66.0.dev20240913
@@ -35,6 +35,7 @@ def _create_api_key(
35
35
  name: str,
36
36
  description: Optional[str],
37
37
  set_key: bool = False,
38
+ output_file: Optional[str] = None,
38
39
  ) -> None:
39
40
  """Create an API key.
40
41
 
@@ -44,6 +45,7 @@ def _create_api_key(
44
45
  name: Name of the API key
45
46
  description: The API key description.
46
47
  set_key: Configure the local client with the generated key.
48
+ output_file: Output file to write the API key to.
47
49
  """
48
50
  client = Client()
49
51
  zen_store = client.zen_store
@@ -74,13 +76,19 @@ def _create_api_key(
74
76
  )
75
77
  return
76
78
 
77
- cli_utils.declare(
78
- f"The API key value is: '{api_key.key}'\nPlease store it safely as "
79
- "it will not be shown again.\nTo configure a ZenML client to use "
80
- "this API key, run:\n\n"
81
- f"zenml connect --url {zen_store.config.url} --api-key \\\n"
82
- f" '{api_key.key}'\n"
83
- )
79
+ if output_file and api_key.key:
80
+ with open(output_file, "w") as f:
81
+ f.write(api_key.key)
82
+
83
+ cli_utils.declare(f"Wrote API key value to {output_file}")
84
+ else:
85
+ cli_utils.declare(
86
+ f"The API key value is: '{api_key.key}'\nPlease store it safely as "
87
+ "it will not be shown again.\nTo configure a ZenML client to use "
88
+ "this API key, run:\n\n"
89
+ f"zenml connect --url {zen_store.config.url} --api-key \\\n"
90
+ f" '{api_key.key}'\n"
91
+ )
84
92
 
85
93
 
86
94
  @cli.group(cls=TagGroup, tag=CliCategories.IDENTITY_AND_SECURITY)
@@ -111,11 +119,18 @@ def service_account() -> None:
111
119
  help=("Configure the local client to use the generated API key."),
112
120
  is_flag=True,
113
121
  )
122
+ @click.option(
123
+ "--output-file",
124
+ type=str,
125
+ required=False,
126
+ help="File to write the API key to.",
127
+ )
114
128
  def create_service_account(
115
129
  service_account_name: str,
116
130
  description: str = "",
117
131
  create_api_key: bool = True,
118
132
  set_api_key: bool = False,
133
+ output_file: Optional[str] = None,
119
134
  ) -> None:
120
135
  """Create a new service account.
121
136
 
@@ -124,6 +139,7 @@ def create_service_account(
124
139
  description: The API key description.
125
140
  create_api_key: Create an API key for the service account.
126
141
  set_api_key: Configure the local client to use the generated API key.
142
+ output_file: Output file to write the API key to.
127
143
  """
128
144
  client = Client()
129
145
  try:
@@ -142,6 +158,7 @@ def create_service_account(
142
158
  name="default",
143
159
  description="Default API key.",
144
160
  set_key=set_api_key,
161
+ output_file=output_file,
145
162
  )
146
163
 
147
164
 
@@ -302,12 +319,19 @@ def api_key(
302
319
  is_flag=True,
303
320
  help="Configure the local client with the generated key.",
304
321
  )
322
+ @click.option(
323
+ "--output-file",
324
+ type=str,
325
+ required=False,
326
+ help="File to write the API key to.",
327
+ )
305
328
  @click.pass_obj
306
329
  def create_api_key(
307
330
  service_account_name_or_id: str,
308
331
  name: str,
309
332
  description: Optional[str],
310
333
  set_key: bool = False,
334
+ output_file: Optional[str] = None,
311
335
  ) -> None:
312
336
  """Create an API key.
313
337
 
@@ -317,12 +341,14 @@ def create_api_key(
317
341
  name: Name of the API key
318
342
  description: The API key description.
319
343
  set_key: Configure the local client with the generated key.
344
+ output_file: Output file to write the API key to.
320
345
  """
321
346
  _create_api_key(
322
347
  service_account_name_or_id=service_account_name_or_id,
323
348
  name=name,
324
349
  description=description,
325
350
  set_key=set_key,
351
+ output_file=output_file,
326
352
  )
327
353
 
328
354
 
@@ -450,12 +476,19 @@ def update_api_key(
450
476
  is_flag=True,
451
477
  help="Configure the local client with the generated key.",
452
478
  )
479
+ @click.option(
480
+ "--output-file",
481
+ type=str,
482
+ required=False,
483
+ help="File to write the API key to.",
484
+ )
453
485
  @click.pass_obj
454
486
  def rotate_api_key(
455
487
  service_account_name_or_id: str,
456
488
  name_or_id: str,
457
489
  retain: int = 0,
458
490
  set_key: bool = False,
491
+ output_file: Optional[str] = None,
459
492
  ) -> None:
460
493
  """Rotate an API key.
461
494
 
@@ -466,6 +499,7 @@ def rotate_api_key(
466
499
  retain: Number of minutes for which the previous key is still valid
467
500
  after it has been rotated.
468
501
  set_key: Configure the local client with the newly generated key.
502
+ output_file: Output file to write the API key to.
469
503
  """
470
504
  client = Client()
471
505
  zen_store = client.zen_store
@@ -499,13 +533,19 @@ def rotate_api_key(
499
533
  )
500
534
  return
501
535
 
502
- cli_utils.declare(
503
- f"The new API key value is: '{api_key.key}'\nPlease store it "
504
- "safely as it will not be shown again.\nTo configure a ZenML "
505
- "client to use this API key, run:\n\n"
506
- f"zenml connect --url {zen_store.config.url} --api-key \\\n"
507
- f" '{api_key.key}'\n"
508
- )
536
+ if output_file and api_key.key:
537
+ with open(output_file, "w") as f:
538
+ f.write(api_key.key)
539
+
540
+ cli_utils.declare(f"Wrote API key value to {output_file}")
541
+ else:
542
+ cli_utils.declare(
543
+ f"The new API key value is: '{api_key.key}'\nPlease store it "
544
+ "safely as it will not be shown again.\nTo configure a ZenML "
545
+ "client to use this API key, run:\n\n"
546
+ f"zenml connect --url {zen_store.config.url} --api-key \\\n"
547
+ f" '{api_key.key}'\n"
548
+ )
509
549
 
510
550
 
511
551
  @api_key.command("delete")
@@ -421,23 +421,56 @@ class StackComponent:
421
421
  else:
422
422
  user_id = None
423
423
 
424
- return flavor.implementation_class(
425
- user=user_id,
426
- workspace=component_model.workspace.id,
427
- name=component_model.name,
428
- id=component_model.id,
429
- config=configuration,
430
- labels=component_model.labels,
431
- flavor=component_model.flavor,
432
- type=component_model.type,
433
- created=component_model.created,
434
- updated=component_model.updated,
435
- connector_requirements=flavor.service_connector_requirements,
436
- connector=component_model.connector.id
437
- if component_model.connector
438
- else None,
439
- connector_resource_id=component_model.connector_resource_id,
440
- )
424
+ try:
425
+ return flavor.implementation_class(
426
+ user=user_id,
427
+ workspace=component_model.workspace.id,
428
+ name=component_model.name,
429
+ id=component_model.id,
430
+ config=configuration,
431
+ labels=component_model.labels,
432
+ flavor=component_model.flavor,
433
+ type=component_model.type,
434
+ created=component_model.created,
435
+ updated=component_model.updated,
436
+ connector_requirements=flavor.service_connector_requirements,
437
+ connector=component_model.connector.id
438
+ if component_model.connector
439
+ else None,
440
+ connector_resource_id=component_model.connector_resource_id,
441
+ )
442
+ except ImportError as e:
443
+ from zenml.integrations.registry import integration_registry
444
+
445
+ integration_requirements = " ".join(
446
+ integration_registry.select_integration_requirements(
447
+ flavor_model.integration
448
+ )
449
+ )
450
+
451
+ if integration_registry.is_installed(flavor_model.integration):
452
+ raise ImportError(
453
+ f"{e}\n\n"
454
+ f"Something went wrong while trying to import from the "
455
+ f"`{flavor_model.integration}` integration. Please make "
456
+ "sure that all its requirements are installed properly by "
457
+ "reinstalling the integration either through our CLI: "
458
+ f"`zenml integration install {flavor_model.integration} "
459
+ "-y` or by manually installing its requirements: "
460
+ f"`pip install {integration_requirements}`. If the error"
461
+ "persists, please contact the ZenML team."
462
+ ) from e
463
+ else:
464
+ raise ImportError(
465
+ f"{e}\n\n"
466
+ f"The `{flavor_model.integration}` integration that you "
467
+ "are trying to use is not installed in your current "
468
+ "environment. Please make sure that it is installed by "
469
+ "either using our CLI: `zenml integration install "
470
+ f"{flavor_model.integration}` or by manually installing "
471
+ f"its requirements: `pip install "
472
+ f"{integration_requirements}`"
473
+ ) from e
441
474
 
442
475
  @property
443
476
  def config(self) -> StackComponentConfig:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zenml-nightly
3
- Version: 0.66.0.dev20240910
3
+ Version: 0.66.0.dev20240913
4
4
  Summary: ZenML: Write production-ready ML code.
5
5
  Home-page: https://zenml.io
6
6
  License: Apache-2.0
@@ -6,7 +6,7 @@ RELEASE_NOTES.md,sha256=GjuHlUd-5AcepXC8ETMkIRMxKVQtBekiuY_CW0oP4XQ,365106
6
6
  ROADMAP.md,sha256=hiLSmr16BH8Dfx7SaQM4JcXCGCVl6mFZPFAwJeDTrJU,407
7
7
  SECURITY.md,sha256=9DepA8y03yvCZLHEfcXLTDH4lUyKHquAdukBsccNN7c,682
8
8
  zenml/README.md,sha256=827dekbOWAs1BpW7VF1a4d7EbwPbjwccX-2zdXBENZo,1777
9
- zenml/VERSION,sha256=IIehTiT1H_PJFlSTpiWfIJ2bnVYUB7OQ3S6LYuDUvKI,19
9
+ zenml/VERSION,sha256=ROKzFghy4O4DnUbwD7E-q2OY0RGQuY1sP2kCiGOOyrI,19
10
10
  zenml/__init__.py,sha256=X_JnjAYTBG2ZYgcM2_FDPssygdj7z7VTAmU9HEi17p0,2306
11
11
  zenml/actions/__init__.py,sha256=mrt6wPo73iKRxK754_NqsGyJ3buW7RnVeIGXr1xEw8Y,681
12
12
  zenml/actions/base_action.py,sha256=UcaHev6BTuLDwuswnyaPjdA8AgUqB5xPZ-lRtuvf2FU,25553
@@ -51,7 +51,7 @@ zenml/cli/pipeline.py,sha256=8UO3ZjKZbaU3tiRLBsN-N3kK_i_bD-8Qbq_YpR8mstw,17442
51
51
  zenml/cli/secret.py,sha256=2WxDYg6iodnAVSbVJQvQEYWEgcy0oytcSBVnnyN0JOw,20135
52
52
  zenml/cli/served_model.py,sha256=lIPd6kOS9kfWFOsd3DSILtiYomINpmXrdpyP5vtQlj8,14604
53
53
  zenml/cli/server.py,sha256=N2cvu9C_z8CzwGu3a7P6fE2X8Se_rHEx30iq9nYMy9o,28682
54
- zenml/cli/service_accounts.py,sha256=MO8pVVjppdvIULFxpvQKlhfEDmRqvlH8aIbPTdNSHXU,16489
54
+ zenml/cli/service_accounts.py,sha256=V6Oeomcs0tg-MIOUbYABqTcO4PsGCdM2WXJH576iqKM,17723
55
55
  zenml/cli/service_connectors.py,sha256=v6o-FpTEnDXYcQXczBELwfWPCcYBi9z7b1GC90Fvp30,74397
56
56
  zenml/cli/stack.py,sha256=vT-7Kac_Cf2g9XoIzwrxdQYgtkpuv_d-BpDvL-p9XUk,82862
57
57
  zenml/cli/stack_components.py,sha256=BxWsqeu5e2DtP5TMjzE98d8Lqfwe5o45TC2awjil5wY,74144
@@ -717,7 +717,7 @@ zenml/stack/authentication_mixin.py,sha256=sg7GkpB-Ao9Gsa7Po0jxMn-_mVYUB42etmspZ
717
717
  zenml/stack/flavor.py,sha256=rut-jFQFB6OGm25RRyMtYlJ3mm_6wrHYVI54Hmf9te4,9726
718
718
  zenml/stack/flavor_registry.py,sha256=IL0fRrxxQJ9YkCYCeADP7nwWEQo4XBElJY4owMjKGbQ,6108
719
719
  zenml/stack/stack.py,sha256=5pgR30_Xgj4Qi09zKYyleuaWwMhe0zvi4k7yF1r8_BM,38021
720
- zenml/stack/stack_component.py,sha256=DpWsgaqvPv9bJhACdMklL-Mjo453TjzQL4JVMzI3PQU,29887
720
+ zenml/stack/stack_component.py,sha256=9sgAu2EGZ2yiEn_D0dq_kmytFmlt8spJ3iG0GlHIFVU,31634
721
721
  zenml/stack/stack_validator.py,sha256=hWbvvGIeWLj6NwSsF4GCc6RAxAWvxHXTcBZL9nJvcak,3111
722
722
  zenml/stack/utils.py,sha256=dcJsbLZf-hJYM9Ut8BfNzrWygmz6shHegqHPRVLoLWE,5840
723
723
  zenml/stack_deployments/__init__.py,sha256=-7593cQ_ZgRn774Ol-8AKXXQquIU4DSiaThVEr6TfWM,644
@@ -1399,8 +1399,8 @@ zenml/zen_stores/secrets_stores/sql_secrets_store.py,sha256=Bq1djrUP9saoD7vECjS7
1399
1399
  zenml/zen_stores/sql_zen_store.py,sha256=4z458K5ItHkAO0bEUAl6rWJDHKh6GS-sRrt2RPridnE,392435
1400
1400
  zenml/zen_stores/template_utils.py,sha256=UB_CBoMIfBequa8g3H7aTI6V_ke1SJr4IW1qwFCL1jc,8932
1401
1401
  zenml/zen_stores/zen_store_interface.py,sha256=kzR_i8vHjULld3MquSaMorcab8lJk1e9RZquw1VXjHY,93510
1402
- zenml_nightly-0.66.0.dev20240910.dist-info/LICENSE,sha256=wbnfEnXnafPbqwANHkV6LUsPKOtdpsd-SNw37rogLtc,11359
1403
- zenml_nightly-0.66.0.dev20240910.dist-info/METADATA,sha256=HXKwlZMRzcjTm7ssSRK6JClUhT80eOXfXTf9BmBvR-s,20961
1404
- zenml_nightly-0.66.0.dev20240910.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1405
- zenml_nightly-0.66.0.dev20240910.dist-info/entry_points.txt,sha256=QK3ETQE0YswAM2mWypNMOv8TLtr7EjnqAFq1br_jEFE,43
1406
- zenml_nightly-0.66.0.dev20240910.dist-info/RECORD,,
1402
+ zenml_nightly-0.66.0.dev20240913.dist-info/LICENSE,sha256=wbnfEnXnafPbqwANHkV6LUsPKOtdpsd-SNw37rogLtc,11359
1403
+ zenml_nightly-0.66.0.dev20240913.dist-info/METADATA,sha256=OInj2XGlAGtuckrQScaRo6jDy68hTD-2ZV4kGNVUBhw,20961
1404
+ zenml_nightly-0.66.0.dev20240913.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1405
+ zenml_nightly-0.66.0.dev20240913.dist-info/entry_points.txt,sha256=QK3ETQE0YswAM2mWypNMOv8TLtr7EjnqAFq1br_jEFE,43
1406
+ zenml_nightly-0.66.0.dev20240913.dist-info/RECORD,,