zenml-nightly 0.66.0.dev20240911__py3-none-any.whl → 0.66.0.dev20240914__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.dev20240911
1
+ 0.66.0.dev20240914
@@ -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")
zenml/steps/base_step.py CHANGED
@@ -592,16 +592,34 @@ class BaseStep(metaclass=BaseStepMeta):
592
592
  from zenml.new.pipelines.pipeline import Pipeline
593
593
 
594
594
  if not Pipeline.ACTIVE_PIPELINE:
595
- # The step is being called outside the context of a pipeline, either
596
- # run the step function or run it as a single step pipeline on the
597
- # active stack
595
+ from zenml import constants, get_step_context
596
+
597
+ # If the environment variable was set to explicitly not run on the
598
+ # stack, we do that.
598
599
  run_without_stack = handle_bool_env_var(
599
600
  ENV_ZENML_RUN_SINGLE_STEPS_WITHOUT_STACK, default=False
600
601
  )
601
602
  if run_without_stack:
602
603
  return self.call_entrypoint(*args, **kwargs)
604
+
605
+ try:
606
+ get_step_context()
607
+ except RuntimeError:
608
+ pass
603
609
  else:
604
- return run_as_single_step_pipeline(self, *args, **kwargs)
610
+ # We're currently inside the execution of a different step
611
+ # -> We don't want to launch another single step pipeline here,
612
+ # but instead just call the step function
613
+ return self.call_entrypoint(*args, **kwargs)
614
+
615
+ if constants.SHOULD_PREVENT_PIPELINE_EXECUTION:
616
+ logger.info(
617
+ "Preventing execution of step '%s'.",
618
+ self.name,
619
+ )
620
+ return
621
+
622
+ return run_as_single_step_pipeline(self, *args, **kwargs)
605
623
 
606
624
  (
607
625
  input_artifacts,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zenml-nightly
3
- Version: 0.66.0.dev20240911
3
+ Version: 0.66.0.dev20240914
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=z587lueMfLtk_cl6JsTB3mS4HLQXyMCR82stHJFvprU,19
9
+ zenml/VERSION,sha256=UpeMLZWAYhpkLA7pj4EGlixlGYWN-fPOYNaVrpD7CrI,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
@@ -731,7 +731,7 @@ zenml/step_operators/base_step_operator.py,sha256=ZRnY6lcEHY8xZskrKKdPhgKg2BlEoh
731
731
  zenml/step_operators/step_operator_entrypoint_configuration.py,sha256=vG0Z9D2C72PYOZ_P3eXYTmm2TvL-dS_kHhSMq-coAKE,3690
732
732
  zenml/steps/__init__.py,sha256=IvxepI3tYp6LiVHFJnet9xZ7yFlH6NHCAI69SvQsfaI,1682
733
733
  zenml/steps/base_parameters.py,sha256=rKnALd0lMv0jOX8E9TwHJkeP3H-ijEFXY0T5dMCu9EQ,756
734
- zenml/steps/base_step.py,sha256=RsSIETBgBYk3phwTzN407iJy-Lp8Mtdzni8zNP4g7Sg,51852
734
+ zenml/steps/base_step.py,sha256=sQbGnPt_1-upcYAGPqqKW0xrULNZZc9NR_7fu2y5qQk,52434
735
735
  zenml/steps/entrypoint_function_utils.py,sha256=25LxlZ8E-3YoWEdAUFK4UZ04hbp4GNMqpKwD2O-Rp_0,12484
736
736
  zenml/steps/external_artifact.py,sha256=63ngwlSJvR8GoM93ttz1Mp6BuAg7xH-QZAsBvW3M80Q,1109
737
737
  zenml/steps/step_decorator.py,sha256=_rV5MGMziqNiOoxupZUy055o-a0b8Y4RtLuB6nLyYyg,8188
@@ -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.dev20240911.dist-info/LICENSE,sha256=wbnfEnXnafPbqwANHkV6LUsPKOtdpsd-SNw37rogLtc,11359
1403
- zenml_nightly-0.66.0.dev20240911.dist-info/METADATA,sha256=HAq5cQQeGuNKMEtBHcs08RrVLjQ7cRiGLxqX0UC0e38,20961
1404
- zenml_nightly-0.66.0.dev20240911.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1405
- zenml_nightly-0.66.0.dev20240911.dist-info/entry_points.txt,sha256=QK3ETQE0YswAM2mWypNMOv8TLtr7EjnqAFq1br_jEFE,43
1406
- zenml_nightly-0.66.0.dev20240911.dist-info/RECORD,,
1402
+ zenml_nightly-0.66.0.dev20240914.dist-info/LICENSE,sha256=wbnfEnXnafPbqwANHkV6LUsPKOtdpsd-SNw37rogLtc,11359
1403
+ zenml_nightly-0.66.0.dev20240914.dist-info/METADATA,sha256=BY28zlC6T5ke23Yrq8nL4xXdxBc98kE3ouTXpTxao-w,20961
1404
+ zenml_nightly-0.66.0.dev20240914.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1405
+ zenml_nightly-0.66.0.dev20240914.dist-info/entry_points.txt,sha256=QK3ETQE0YswAM2mWypNMOv8TLtr7EjnqAFq1br_jEFE,43
1406
+ zenml_nightly-0.66.0.dev20240914.dist-info/RECORD,,