zenml-nightly 0.83.0.dev20250612__py3-none-any.whl → 0.83.0.dev20250615__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.83.0.dev20250612
1
+ 0.83.0.dev20250615
zenml/client.py CHANGED
@@ -3542,7 +3542,9 @@ class Client(metaclass=ClientMetaClass):
3542
3542
  """
3543
3543
  return self._get_entity_by_id_or_name_or_prefix(
3544
3544
  get_method=self.zen_store.get_run_template,
3545
- list_method=self.list_run_templates,
3545
+ list_method=functools.partial(
3546
+ self.list_run_templates, hidden=None
3547
+ ),
3546
3548
  name_id_or_prefix=name_id_or_prefix,
3547
3549
  allow_name_prefix_match=False,
3548
3550
  project=project,
zenml/utils/tag_utils.py CHANGED
@@ -44,7 +44,7 @@ add_tags(tags=[...], run_template=...)
44
44
  # Manual tagging to an artifact
45
45
  add_tags(tags=[...], artifact=...)
46
46
 
47
- # Automatic tagging to an artifact version(within a step)
47
+ # Automatic tagging to an artifact version (within a step)
48
48
  add_tags(tags=[...], infer_artifact=True) # step with single output
49
49
  add_tags(tags=[...], artifact_name=..., infer_artifact=True) # specific output of a step
50
50
 
@@ -148,7 +148,7 @@ def add_tags(
148
148
  *,
149
149
  tags: List[Union[str, Tag]],
150
150
  artifact_name: str,
151
- artifact_version: Optional[str] = None,
151
+ artifact_version: str,
152
152
  ) -> None: ...
153
153
 
154
154
 
@@ -191,7 +191,7 @@ def add_tags(
191
191
  artifact_version_id: Optional[UUID] = None,
192
192
  artifact_name: Optional[str] = None,
193
193
  artifact_version: Optional[str] = None,
194
- infer_artifact: bool = False,
194
+ infer_artifact: Optional[bool] = None,
195
195
  ) -> None:
196
196
  """Add tags to various resource types in a generalized way.
197
197
 
@@ -220,19 +220,52 @@ def add_tags(
220
220
  resource_type = None
221
221
 
222
222
  # Tag a pipeline
223
- if pipeline is not None:
223
+ if pipeline is not None and all(
224
+ v is None
225
+ for v in [
226
+ run,
227
+ run_template,
228
+ artifact,
229
+ artifact_version_id,
230
+ artifact_name,
231
+ artifact_version,
232
+ infer_artifact,
233
+ ]
234
+ ):
224
235
  pipeline_model = client.get_pipeline(name_id_or_prefix=pipeline)
225
236
  resource_id = pipeline_model.id
226
237
  resource_type = TaggableResourceTypes.PIPELINE
227
238
 
228
239
  # Tag a run by ID
229
- elif run is not None:
240
+ elif run is not None and all(
241
+ v is None
242
+ for v in [
243
+ pipeline,
244
+ run_template,
245
+ artifact,
246
+ artifact_version_id,
247
+ artifact_name,
248
+ artifact_version,
249
+ infer_artifact,
250
+ ]
251
+ ):
230
252
  run_model = client.get_pipeline_run(name_id_or_prefix=run)
231
253
  resource_id = run_model.id
232
254
  resource_type = TaggableResourceTypes.PIPELINE_RUN
233
255
 
234
256
  # Tag a run template
235
- elif run_template is not None:
257
+ elif run_template is not None and all(
258
+ v is None
259
+ for v in [
260
+ pipeline,
261
+ run,
262
+ artifact,
263
+ artifact_version_id,
264
+ artifact_name,
265
+ artifact_version,
266
+ infer_artifact,
267
+ ]
268
+ ):
236
269
  run_template_model = client.get_run_template(
237
270
  name_id_or_prefix=run_template
238
271
  )
@@ -240,26 +273,68 @@ def add_tags(
240
273
  resource_type = TaggableResourceTypes.RUN_TEMPLATE
241
274
 
242
275
  # Tag an artifact
243
- elif artifact is not None:
276
+ elif artifact is not None and all(
277
+ v is None
278
+ for v in [
279
+ pipeline,
280
+ run,
281
+ run_template,
282
+ artifact_version_id,
283
+ artifact_name,
284
+ artifact_version,
285
+ infer_artifact,
286
+ ]
287
+ ):
244
288
  artifact_model = client.get_artifact(name_id_or_prefix=artifact)
245
289
  resource_id = artifact_model.id
246
290
  resource_type = TaggableResourceTypes.ARTIFACT
247
291
 
292
+ # Tag an artifact version by its ID
293
+ elif artifact_version_id is not None and all(
294
+ v is None
295
+ for v in [
296
+ pipeline,
297
+ run,
298
+ run_template,
299
+ artifact,
300
+ artifact_name,
301
+ artifact_version,
302
+ infer_artifact,
303
+ ]
304
+ ):
305
+ resource_id = artifact_version_id
306
+ resource_type = TaggableResourceTypes.ARTIFACT_VERSION
307
+
248
308
  # Tag an artifact version by its name and version
249
- elif artifact_name is not None and artifact_version is not None:
309
+ elif (artifact_name is not None and artifact_version is not None) and all(
310
+ v is None
311
+ for v in [
312
+ pipeline,
313
+ run,
314
+ run_template,
315
+ artifact,
316
+ artifact_version_id,
317
+ infer_artifact,
318
+ ]
319
+ ):
250
320
  artifact_version_model = client.get_artifact_version(
251
321
  name_id_or_prefix=artifact_name, version=artifact_version
252
322
  )
253
323
  resource_id = artifact_version_model.id
254
324
  resource_type = TaggableResourceTypes.ARTIFACT_VERSION
255
325
 
256
- # Tag an artifact version by its ID
257
- elif artifact_version_id is not None:
258
- resource_id = artifact_version_id
259
- resource_type = TaggableResourceTypes.ARTIFACT_VERSION
260
-
261
326
  # Tag an artifact version through the step context
262
- elif infer_artifact is True:
327
+ elif infer_artifact is True and all(
328
+ v is None
329
+ for v in [
330
+ pipeline,
331
+ run,
332
+ run_template,
333
+ artifact,
334
+ artifact_version_id,
335
+ artifact_version,
336
+ ]
337
+ ):
263
338
  resource_type = TaggableResourceTypes.ARTIFACT_VERSION
264
339
 
265
340
  try:
@@ -308,12 +383,14 @@ def add_tags(
308
383
  elif all(
309
384
  v is None
310
385
  for v in [
386
+ pipeline,
311
387
  run,
388
+ run_template,
389
+ artifact,
312
390
  artifact_version_id,
313
391
  artifact_name,
314
392
  artifact_version,
315
- pipeline,
316
- run_template,
393
+ infer_artifact,
317
394
  ]
318
395
  ):
319
396
  try:
@@ -437,7 +514,7 @@ def remove_tags(
437
514
  *,
438
515
  tags: List[str],
439
516
  artifact_name: str,
440
- artifact_version: Optional[str] = None,
517
+ artifact_version: str,
441
518
  ) -> None: ...
442
519
 
443
520
 
@@ -464,7 +541,7 @@ def remove_tags(
464
541
  artifact_version_id: Optional[UUID] = None,
465
542
  artifact_name: Optional[str] = None,
466
543
  artifact_version: Optional[str] = None,
467
- infer_artifact: bool = False,
544
+ infer_artifact: Optional[bool] = None,
468
545
  ) -> None:
469
546
  """Remove tags from various resource types in a generalized way.
470
547
 
@@ -492,13 +569,35 @@ def remove_tags(
492
569
  resource_type = None
493
570
 
494
571
  # Remove tags from a pipeline
495
- if pipeline is not None:
572
+ if pipeline is not None and all(
573
+ v is None
574
+ for v in [
575
+ run_template,
576
+ run,
577
+ artifact,
578
+ artifact_version_id,
579
+ artifact_name,
580
+ artifact_version,
581
+ infer_artifact,
582
+ ]
583
+ ):
496
584
  pipeline_model = client.get_pipeline(name_id_or_prefix=pipeline)
497
585
  resource_id = pipeline_model.id
498
586
  resource_type = TaggableResourceTypes.PIPELINE
499
587
 
500
588
  # Remove tags from a run template
501
- elif run_template is not None:
589
+ elif run_template is not None and all(
590
+ v is None
591
+ for v in [
592
+ pipeline,
593
+ run,
594
+ artifact,
595
+ artifact_version_id,
596
+ artifact_version,
597
+ artifact_name,
598
+ infer_artifact,
599
+ ]
600
+ ):
502
601
  run_template_model = client.get_run_template(
503
602
  name_id_or_prefix=run_template
504
603
  )
@@ -506,32 +605,85 @@ def remove_tags(
506
605
  resource_type = TaggableResourceTypes.RUN_TEMPLATE
507
606
 
508
607
  # Remove tags from a run
509
- elif run is not None:
608
+ elif run is not None and all(
609
+ v is None
610
+ for v in [
611
+ pipeline,
612
+ run_template,
613
+ artifact,
614
+ artifact_version_id,
615
+ artifact_name,
616
+ artifact_version,
617
+ infer_artifact,
618
+ ]
619
+ ):
510
620
  run_model = client.get_pipeline_run(name_id_or_prefix=run)
511
621
  resource_id = run_model.id
512
622
  resource_type = TaggableResourceTypes.PIPELINE_RUN
513
623
 
514
624
  # Remove tags from an artifact
515
- elif artifact is not None:
625
+ elif artifact is not None and all(
626
+ v is None
627
+ for v in [
628
+ pipeline,
629
+ run_template,
630
+ run,
631
+ artifact_version_id,
632
+ artifact_name,
633
+ artifact_version,
634
+ infer_artifact,
635
+ ]
636
+ ):
516
637
  artifact_model = client.get_artifact(name_id_or_prefix=artifact)
517
638
  resource_id = artifact_model.id
518
639
  resource_type = TaggableResourceTypes.ARTIFACT
519
640
 
641
+ # Remove tags from an artifact version by its ID
642
+ elif artifact_version_id is not None and all(
643
+ v is None
644
+ for v in [
645
+ pipeline,
646
+ run_template,
647
+ run,
648
+ artifact,
649
+ artifact_name,
650
+ artifact_version,
651
+ infer_artifact,
652
+ ]
653
+ ):
654
+ resource_id = artifact_version_id
655
+ resource_type = TaggableResourceTypes.ARTIFACT_VERSION
656
+
520
657
  # Remove tags from an artifact version by its name and version
521
- elif artifact_name is not None and artifact_version is not None:
658
+ elif (artifact_name is not None and artifact_version is not None) and all(
659
+ v is None
660
+ for v in [
661
+ pipeline,
662
+ run_template,
663
+ run,
664
+ artifact,
665
+ artifact_version_id,
666
+ infer_artifact,
667
+ ]
668
+ ):
522
669
  artifact_version_model = client.get_artifact_version(
523
670
  name_id_or_prefix=artifact_name, version=artifact_version
524
671
  )
525
672
  resource_id = artifact_version_model.id
526
673
  resource_type = TaggableResourceTypes.ARTIFACT_VERSION
527
674
 
528
- # Remove tags from an artifact version by its ID
529
- elif artifact_version_id is not None:
530
- resource_id = artifact_version_id
531
- resource_type = TaggableResourceTypes.ARTIFACT_VERSION
532
-
533
675
  # Remove tags from an artifact version through the step context
534
- elif infer_artifact is True:
676
+ elif infer_artifact is True and all(
677
+ v is None
678
+ for v in [
679
+ pipeline,
680
+ run_template,
681
+ run,
682
+ artifact,
683
+ artifact_version_id,
684
+ artifact_version,
685
+ ]
686
+ ):
535
687
  try:
536
688
  from zenml.steps.step_context import get_step_context
537
689
 
@@ -579,12 +731,14 @@ def remove_tags(
579
731
  elif all(
580
732
  v is None
581
733
  for v in [
734
+ pipeline,
582
735
  run,
736
+ run_template,
737
+ artifact,
583
738
  artifact_version_id,
584
739
  artifact_name,
585
740
  artifact_version,
586
- pipeline,
587
- run_template,
741
+ infer_artifact,
588
742
  ]
589
743
  ):
590
744
  try:
@@ -3001,10 +3001,6 @@ class SqlZenStore(BaseZenStore):
3001
3001
  )
3002
3002
  session.add(vis_schema)
3003
3003
 
3004
- # Commit the visualizations so potential future rollbacks don't
3005
- # remove them
3006
- session.commit()
3007
-
3008
3004
  # Save tags of the artifact
3009
3005
  self._attach_tags_to_resources(
3010
3006
  tags=artifact_version.tags,
@@ -5188,9 +5184,19 @@ class SqlZenStore(BaseZenStore):
5188
5184
  # we want to display them as separate nodes in the
5189
5185
  # DAG. We can therefore always create a new node
5190
5186
  # here.
5187
+ is_manual_load = (
5188
+ input.type == StepRunInputArtifactType.MANUAL
5189
+ )
5191
5190
  artifact_node = helper.add_artifact_node(
5192
5191
  node_id=helper.get_artifact_node_id(
5193
- name=input.name,
5192
+ # For manual loads, the name might not be
5193
+ # unique, so we use the artifact ID instead.
5194
+ # We don't need to keep the name consistent
5195
+ # with placeholder nodes as they don't exist
5196
+ # for manual loads.
5197
+ name=str(input.artifact_id)
5198
+ if is_manual_load
5199
+ else input.name,
5194
5200
  step_name=step_name,
5195
5201
  io_type=input.type,
5196
5202
  is_input=True,
@@ -5221,9 +5227,20 @@ class SqlZenStore(BaseZenStore):
5221
5227
  # want to merge these and instead display them
5222
5228
  # separately in the DAG, but if that should ever change
5223
5229
  # this would be the place to merge them.
5230
+ is_manual_save = (
5231
+ output.artifact_version.save_type
5232
+ == ArtifactSaveType.MANUAL
5233
+ )
5224
5234
  artifact_node = helper.add_artifact_node(
5225
5235
  node_id=helper.get_artifact_node_id(
5226
- name=output.name,
5236
+ # For manual saves, the name might not be
5237
+ # unique, so we use the artifact ID instead.
5238
+ # We don't need to keep the name consistent
5239
+ # with placeholder nodes as they don't exist
5240
+ # for manual saves.
5241
+ name=str(output.artifact_id)
5242
+ if is_manual_save
5243
+ else output.name,
5227
5244
  step_name=step_name,
5228
5245
  io_type=output.artifact_version.save_type,
5229
5246
  is_input=False,
@@ -12003,17 +12020,16 @@ class SqlZenStore(BaseZenStore):
12003
12020
  validate_name(tag)
12004
12021
  self._set_request_user_id(request_model=tag, session=session)
12005
12022
 
12006
- with session.begin_nested() as nested_session:
12007
- tag_schema = TagSchema.from_request(tag)
12008
- session.add(tag_schema)
12023
+ tag_schema = TagSchema.from_request(tag)
12024
+ session.add(tag_schema)
12009
12025
 
12010
- try:
12011
- session.commit()
12012
- except IntegrityError:
12013
- nested_session.rollback()
12014
- raise EntityExistsError(
12015
- f"Tag with name `{tag.name}` already exists."
12016
- )
12026
+ try:
12027
+ session.commit()
12028
+ except IntegrityError:
12029
+ session.rollback()
12030
+ raise EntityExistsError(
12031
+ f"Tag with name `{tag.name}` already exists."
12032
+ )
12017
12033
  return tag_schema
12018
12034
 
12019
12035
  @track_decorator(AnalyticsEvent.CREATED_TAG)
@@ -12394,6 +12410,7 @@ class SqlZenStore(BaseZenStore):
12394
12410
  other_runs_with_same_tag = self.list_runs(
12395
12411
  PipelineRunFilter(
12396
12412
  id=f"notequals:{resource.id}",
12413
+ project=resource.project.id,
12397
12414
  pipeline_id=resource.pipeline_id,
12398
12415
  tags=[tag_schema.name],
12399
12416
  )
@@ -12418,6 +12435,7 @@ class SqlZenStore(BaseZenStore):
12418
12435
  self.list_artifact_versions(
12419
12436
  ArtifactVersionFilter(
12420
12437
  id=f"notequals:{resource.id}",
12438
+ project=resource.project.id,
12421
12439
  artifact_id=resource.artifact_id,
12422
12440
  tags=[tag_schema.name],
12423
12441
  )
@@ -12447,6 +12465,7 @@ class SqlZenStore(BaseZenStore):
12447
12465
  older_templates = self.list_run_templates(
12448
12466
  RunTemplateFilter(
12449
12467
  id=f"notequals:{resource.id}",
12468
+ project=resource.project.id,
12450
12469
  pipeline_id=scope_id,
12451
12470
  tags=[tag_schema.name],
12452
12471
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: zenml-nightly
3
- Version: 0.83.0.dev20250612
3
+ Version: 0.83.0.dev20250615
4
4
  Summary: ZenML: Write production-ready ML code.
5
5
  License: Apache-2.0
6
6
  Keywords: machine learning,production,pipeline,mlops,devops
@@ -1,5 +1,5 @@
1
1
  zenml/README.md,sha256=827dekbOWAs1BpW7VF1a4d7EbwPbjwccX-2zdXBENZo,1777
2
- zenml/VERSION,sha256=HXay_lP3loPwJZwUQVwYs5HL4KZ-1gKOR5QVleAsS4Y,19
2
+ zenml/VERSION,sha256=iL-AfrQyG0qJ4IBGzJyCnK7eedAvsn9_EJ6fleBzBag,19
3
3
  zenml/__init__.py,sha256=CKEyepFK-7akXYiMrNVh92Nb01Cjs23w4_YyI6sgdc8,2242
4
4
  zenml/actions/__init__.py,sha256=mrt6wPo73iKRxK754_NqsGyJ3buW7RnVeIGXr1xEw8Y,681
5
5
  zenml/actions/base_action.py,sha256=UcaHev6BTuLDwuswnyaPjdA8AgUqB5xPZ-lRtuvf2FU,25553
@@ -55,7 +55,7 @@ zenml/cli/text_utils.py,sha256=bY1GIjoULt1cW2FyrPlMoAXNS2R7cSOjDFEZQqrpVQ8,3553
55
55
  zenml/cli/user_management.py,sha256=sNnhaUxH-cHecbZBR1L0mEU0TnLNZHzI6ZBCUSQa7OY,13078
56
56
  zenml/cli/utils.py,sha256=vMAb9f6GDfNVGmZWOz9UOyPRpKI3KfnYpRl_w9YUBNE,86501
57
57
  zenml/cli/version.py,sha256=nm1iSU_1V6-MUwpMKeXcwFhLYGUMLswvQL67cEuCpxA,3635
58
- zenml/client.py,sha256=cf4sYrVCx9xbX3ZcQKF2j-jRroCxy-MKUNkEOhZD1yk,293336
58
+ zenml/client.py,sha256=YXGUxFdpxLHcl84Oe4Mc1QoXph8aBsUPUT6wOcjBEWQ,293398
59
59
  zenml/client_lazy_loader.py,sha256=oyxKvBWVB7k2pHMavdhNEOfR2Vk4IS3XUu43SBzDPsI,7152
60
60
  zenml/code_repositories/__init__.py,sha256=W5bDfzAG8OXIKZSV1L-VHuzMcSCYa9qzTdPb3jqfyYw,920
61
61
  zenml/code_repositories/base_code_repository.py,sha256=Id6VjbUu8N3ZpNvBGhOgbahtoMiCAtYXed3G7YQ_iAc,5225
@@ -797,7 +797,7 @@ zenml/utils/singleton.py,sha256=uFRrUlUdS5VyY9lLJyl_n5kqppsqJLKkBhSj4g5VPkY,2757
797
797
  zenml/utils/source_code_utils.py,sha256=8iyNA2MGIORYVEkSdxNTXfS1ZdFKXTAG1dZRkeQtPL0,3751
798
798
  zenml/utils/source_utils.py,sha256=joKLghhDq9dh0fd8B0WRGX-nN-uwnGQdgmsyY_n-8gY,27033
799
799
  zenml/utils/string_utils.py,sha256=xJ8Abm52yFQyOpNrgpoLjDbPCgb6rpJsi8N4-7bb5GU,7254
800
- zenml/utils/tag_utils.py,sha256=2LJ-3XkXuWnffUsyfCwahzL_N2k4lIYIgBs1HVShhA0,19180
800
+ zenml/utils/tag_utils.py,sha256=GjuTyrkZAPhT27nP41bttBAvqGFpzgVZ9WZ_mswLc6o,22543
801
801
  zenml/utils/time_utils.py,sha256=-9Y9zwJ-6Gv7hoZQCoftPyC2LCLo2bYj6OgdyBaE44o,4076
802
802
  zenml/utils/typed_model.py,sha256=00EAo1I1VnOBHG4-ce8dPkyHRPpgi67SRIU-KdewRWs,4757
803
803
  zenml/utils/typing_utils.py,sha256=jP7JKrlLsuMIStXhwKFNWykE6SMOR72tJIJ_qEbQSNc,6555
@@ -1324,11 +1324,11 @@ zenml/zen_stores/secrets_stores/hashicorp_secrets_store.py,sha256=5err1a-TrV3SR5
1324
1324
  zenml/zen_stores/secrets_stores/secrets_store_interface.py,sha256=Q2Jbnt2Pp7NGlR-u1YBfRZV2g8su2Fd0ArBMdksAE-Q,2819
1325
1325
  zenml/zen_stores/secrets_stores/service_connector_secrets_store.py,sha256=S87ne23D08PAwtfRVlVnBn8R0ilTpEh6r8blauNV5WQ,6941
1326
1326
  zenml/zen_stores/secrets_stores/sql_secrets_store.py,sha256=LPFW757WCJLP1S8vrvjsrl2Tf1yo281xUTjSBsos4qk,8788
1327
- zenml/zen_stores/sql_zen_store.py,sha256=zgdaIUTG2JYTr6_sW_yhYar_ZgPQZiKWEO3rmM0ys1Y,466071
1327
+ zenml/zen_stores/sql_zen_store.py,sha256=uYYwCvz-ot-qHPModf7Z6FheVRtZj7TUiWw-tHaBzGI,467346
1328
1328
  zenml/zen_stores/template_utils.py,sha256=GbJ7LgGVYHSCKPEA8RNTxPoVTWqpC77F_lGzjJ4O1Fw,9220
1329
1329
  zenml/zen_stores/zen_store_interface.py,sha256=_ap55L3_mrHgegsLkMRSmmNXVasYC53LwjcEeuS1YT4,92411
1330
- zenml_nightly-0.83.0.dev20250612.dist-info/LICENSE,sha256=wbnfEnXnafPbqwANHkV6LUsPKOtdpsd-SNw37rogLtc,11359
1331
- zenml_nightly-0.83.0.dev20250612.dist-info/METADATA,sha256=FUzuC18FJ-qvtfLPJ0snlCP_3lBm9oeE3ek0V2z4gtw,24317
1332
- zenml_nightly-0.83.0.dev20250612.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
1333
- zenml_nightly-0.83.0.dev20250612.dist-info/entry_points.txt,sha256=QK3ETQE0YswAM2mWypNMOv8TLtr7EjnqAFq1br_jEFE,43
1334
- zenml_nightly-0.83.0.dev20250612.dist-info/RECORD,,
1330
+ zenml_nightly-0.83.0.dev20250615.dist-info/LICENSE,sha256=wbnfEnXnafPbqwANHkV6LUsPKOtdpsd-SNw37rogLtc,11359
1331
+ zenml_nightly-0.83.0.dev20250615.dist-info/METADATA,sha256=BydixAr3tv628ciVpF4oTOi-tFCYyOQHCwBawCrzqjc,24317
1332
+ zenml_nightly-0.83.0.dev20250615.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
1333
+ zenml_nightly-0.83.0.dev20250615.dist-info/entry_points.txt,sha256=QK3ETQE0YswAM2mWypNMOv8TLtr7EjnqAFq1br_jEFE,43
1334
+ zenml_nightly-0.83.0.dev20250615.dist-info/RECORD,,