zenml-nightly 0.75.0.dev20250312__py3-none-any.whl → 0.75.0.dev20250313__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.
Files changed (160) hide show
  1. zenml/VERSION +1 -1
  2. zenml/__init__.py +2 -0
  3. zenml/analytics/context.py +7 -0
  4. zenml/artifacts/utils.py +0 -2
  5. zenml/cli/login.py +6 -0
  6. zenml/cli/model.py +7 -15
  7. zenml/cli/secret.py +47 -44
  8. zenml/cli/service_connectors.py +0 -1
  9. zenml/cli/stack.py +0 -1
  10. zenml/cli/tag.py +3 -5
  11. zenml/cli/utils.py +25 -23
  12. zenml/cli/workspace.py +79 -5
  13. zenml/client.py +615 -348
  14. zenml/config/global_config.py +16 -3
  15. zenml/config/pipeline_configurations.py +3 -2
  16. zenml/config/pipeline_run_configuration.py +2 -1
  17. zenml/config/secret_reference_mixin.py +1 -1
  18. zenml/constants.py +1 -3
  19. zenml/enums.py +0 -7
  20. zenml/event_hub/event_hub.py +3 -1
  21. zenml/exceptions.py +0 -24
  22. zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py +5 -3
  23. zenml/integrations/bitbucket/plugins/event_sources/bitbucket_webhook_event_source.py +1 -4
  24. zenml/integrations/github/plugins/event_sources/github_webhook_event_source.py +1 -4
  25. zenml/integrations/mlflow/steps/mlflow_registry.py +1 -1
  26. zenml/integrations/seldon/model_deployers/seldon_model_deployer.py +1 -1
  27. zenml/integrations/wandb/flavors/wandb_experiment_tracker_flavor.py +3 -3
  28. zenml/model/model.py +8 -8
  29. zenml/models/__init__.py +18 -1
  30. zenml/models/v2/base/base.py +0 -5
  31. zenml/models/v2/base/filter.py +1 -1
  32. zenml/models/v2/base/scoped.py +104 -121
  33. zenml/models/v2/core/api_key.py +1 -1
  34. zenml/models/v2/core/artifact.py +31 -18
  35. zenml/models/v2/core/artifact_version.py +42 -25
  36. zenml/models/v2/core/component.py +22 -33
  37. zenml/models/v2/core/device.py +3 -2
  38. zenml/models/v2/core/event_source.py +2 -2
  39. zenml/models/v2/core/flavor.py +19 -47
  40. zenml/models/v2/core/logs.py +1 -2
  41. zenml/models/v2/core/model.py +7 -4
  42. zenml/models/v2/core/model_version.py +36 -27
  43. zenml/models/v2/core/pipeline.py +1 -1
  44. zenml/models/v2/core/pipeline_run.py +5 -13
  45. zenml/models/v2/core/run_template.py +1 -2
  46. zenml/models/v2/core/schedule.py +0 -9
  47. zenml/models/v2/core/secret.py +93 -127
  48. zenml/models/v2/core/server_settings.py +2 -2
  49. zenml/models/v2/core/service.py +43 -12
  50. zenml/models/v2/core/service_connector.py +14 -16
  51. zenml/models/v2/core/stack.py +24 -26
  52. zenml/models/v2/core/step_run.py +3 -15
  53. zenml/models/v2/core/tag.py +41 -15
  54. zenml/models/v2/core/user.py +19 -2
  55. zenml/models/v2/misc/statistics.py +45 -0
  56. zenml/models/v2/misc/tag.py +27 -0
  57. zenml/orchestrators/cache_utils.py +1 -1
  58. zenml/orchestrators/input_utils.py +1 -0
  59. zenml/orchestrators/step_launcher.py +0 -1
  60. zenml/orchestrators/step_run_utils.py +0 -2
  61. zenml/orchestrators/step_runner.py +10 -1
  62. zenml/pipelines/build_utils.py +0 -2
  63. zenml/pipelines/pipeline_decorator.py +3 -2
  64. zenml/pipelines/pipeline_definition.py +4 -5
  65. zenml/pipelines/run_utils.py +3 -3
  66. zenml/service_connectors/service_connector.py +0 -7
  67. zenml/service_connectors/service_connector_utils.py +0 -1
  68. zenml/stack/authentication_mixin.py +1 -1
  69. zenml/stack/flavor.py +3 -14
  70. zenml/stack/stack_component.py +1 -5
  71. zenml/steps/step_context.py +19 -0
  72. zenml/utils/string_utils.py +1 -1
  73. zenml/utils/tag_utils.py +642 -0
  74. zenml/zen_server/cloud_utils.py +21 -0
  75. zenml/zen_server/exceptions.py +0 -6
  76. zenml/zen_server/rbac/endpoint_utils.py +134 -46
  77. zenml/zen_server/rbac/models.py +65 -3
  78. zenml/zen_server/rbac/rbac_interface.py +9 -0
  79. zenml/zen_server/rbac/rbac_sql_zen_store.py +15 -7
  80. zenml/zen_server/rbac/utils.py +156 -29
  81. zenml/zen_server/rbac/zenml_cloud_rbac.py +43 -11
  82. zenml/zen_server/routers/actions_endpoints.py +3 -5
  83. zenml/zen_server/routers/artifact_endpoint.py +0 -5
  84. zenml/zen_server/routers/artifact_version_endpoints.py +15 -9
  85. zenml/zen_server/routers/auth_endpoints.py +22 -7
  86. zenml/zen_server/routers/code_repositories_endpoints.py +56 -3
  87. zenml/zen_server/routers/devices_endpoints.py +0 -4
  88. zenml/zen_server/routers/event_source_endpoints.py +0 -5
  89. zenml/zen_server/routers/flavors_endpoints.py +0 -5
  90. zenml/zen_server/routers/logs_endpoints.py +0 -1
  91. zenml/zen_server/routers/model_versions_endpoints.py +102 -23
  92. zenml/zen_server/routers/models_endpoints.py +51 -68
  93. zenml/zen_server/routers/pipeline_builds_endpoints.py +58 -4
  94. zenml/zen_server/routers/pipeline_deployments_endpoints.py +58 -4
  95. zenml/zen_server/routers/pipelines_endpoints.py +73 -4
  96. zenml/zen_server/routers/plugin_endpoints.py +0 -1
  97. zenml/zen_server/routers/run_metadata_endpoints.py +99 -0
  98. zenml/zen_server/routers/run_templates_endpoints.py +66 -3
  99. zenml/zen_server/routers/runs_endpoints.py +60 -8
  100. zenml/zen_server/routers/schedule_endpoints.py +69 -6
  101. zenml/zen_server/routers/secrets_endpoints.py +40 -4
  102. zenml/zen_server/routers/server_endpoints.py +53 -1
  103. zenml/zen_server/routers/service_accounts_endpoints.py +14 -15
  104. zenml/zen_server/routers/service_connectors_endpoints.py +96 -14
  105. zenml/zen_server/routers/service_endpoints.py +20 -7
  106. zenml/zen_server/routers/stack_components_endpoints.py +68 -7
  107. zenml/zen_server/routers/stacks_endpoints.py +98 -7
  108. zenml/zen_server/routers/steps_endpoints.py +17 -11
  109. zenml/zen_server/routers/tag_resource_endpoints.py +115 -0
  110. zenml/zen_server/routers/tags_endpoints.py +6 -17
  111. zenml/zen_server/routers/triggers_endpoints.py +5 -8
  112. zenml/zen_server/routers/users_endpoints.py +47 -12
  113. zenml/zen_server/routers/workspaces_endpoints.py +56 -1285
  114. zenml/zen_server/template_execution/utils.py +5 -4
  115. zenml/zen_server/utils.py +21 -0
  116. zenml/zen_server/zen_server_api.py +4 -0
  117. zenml/zen_stores/base_zen_store.py +29 -44
  118. zenml/zen_stores/migrations/versions/1cb6477f72d6_move_artifact_save_type.py +20 -10
  119. zenml/zen_stores/migrations/versions/1f9d1cd00b90_add_unique_name_constraints.py +231 -0
  120. zenml/zen_stores/migrations/versions/288f4fb6e112_make_tags_user_scoped.py +74 -0
  121. zenml/zen_stores/migrations/versions/2e695a26fe7a_add_user_default_workspace.py +45 -0
  122. zenml/zen_stores/migrations/versions/3b1776345020_remove_workspace_from_globals.py +81 -0
  123. zenml/zen_stores/migrations/versions/41b28cae31ce_make_artifacts_workspace_scoped.py +136 -0
  124. zenml/zen_stores/migrations/versions/9e7bf0970266_adding_exclusive_attribute_to_tags.py +47 -0
  125. zenml/zen_stores/migrations/versions/b557b2871693_update_step_run_input_types.py +8 -4
  126. zenml/zen_stores/migrations/versions/cc269488e5a9_separate_run_metadata.py +12 -6
  127. zenml/zen_stores/migrations/versions/f1d723fd723b_add_secret_private_attr.py +61 -0
  128. zenml/zen_stores/migrations/versions/f76a368a25a5_add_stack_description.py +35 -0
  129. zenml/zen_stores/rest_zen_store.py +172 -171
  130. zenml/zen_stores/schemas/action_schemas.py +8 -1
  131. zenml/zen_stores/schemas/api_key_schemas.py +8 -1
  132. zenml/zen_stores/schemas/artifact_schemas.py +28 -1
  133. zenml/zen_stores/schemas/code_repository_schemas.py +8 -1
  134. zenml/zen_stores/schemas/component_schemas.py +9 -14
  135. zenml/zen_stores/schemas/event_source_schemas.py +8 -1
  136. zenml/zen_stores/schemas/flavor_schemas.py +14 -20
  137. zenml/zen_stores/schemas/model_schemas.py +3 -0
  138. zenml/zen_stores/schemas/pipeline_deployment_schemas.py +3 -1
  139. zenml/zen_stores/schemas/pipeline_run_schemas.py +0 -3
  140. zenml/zen_stores/schemas/run_template_schemas.py +8 -4
  141. zenml/zen_stores/schemas/schedule_schema.py +9 -14
  142. zenml/zen_stores/schemas/secret_schemas.py +15 -25
  143. zenml/zen_stores/schemas/service_connector_schemas.py +8 -17
  144. zenml/zen_stores/schemas/service_schemas.py +0 -1
  145. zenml/zen_stores/schemas/stack_schemas.py +12 -15
  146. zenml/zen_stores/schemas/step_run_schemas.py +7 -8
  147. zenml/zen_stores/schemas/tag_schemas.py +30 -2
  148. zenml/zen_stores/schemas/trigger_schemas.py +8 -1
  149. zenml/zen_stores/schemas/user_schemas.py +24 -2
  150. zenml/zen_stores/schemas/utils.py +16 -0
  151. zenml/zen_stores/schemas/workspace_schemas.py +7 -25
  152. zenml/zen_stores/secrets_stores/service_connector_secrets_store.py +0 -3
  153. zenml/zen_stores/sql_zen_store.py +2905 -2280
  154. zenml/zen_stores/template_utils.py +1 -1
  155. zenml/zen_stores/zen_store_interface.py +82 -58
  156. {zenml_nightly-0.75.0.dev20250312.dist-info → zenml_nightly-0.75.0.dev20250313.dist-info}/METADATA +1 -1
  157. {zenml_nightly-0.75.0.dev20250312.dist-info → zenml_nightly-0.75.0.dev20250313.dist-info}/RECORD +160 -147
  158. {zenml_nightly-0.75.0.dev20250312.dist-info → zenml_nightly-0.75.0.dev20250313.dist-info}/LICENSE +0 -0
  159. {zenml_nightly-0.75.0.dev20250312.dist-info → zenml_nightly-0.75.0.dev20250313.dist-info}/WHEEL +0 -0
  160. {zenml_nightly-0.75.0.dev20250312.dist-info → zenml_nightly-0.75.0.dev20250313.dist-info}/entry_points.txt +0 -0
@@ -63,7 +63,7 @@ def validate_deployment_is_templatable(
63
63
  "associated stack has no flavor."
64
64
  )
65
65
 
66
- if component.flavor_schema.workspace_id:
66
+ if component.flavor_schema.is_custom:
67
67
  raise ValueError(
68
68
  "Unable to create run template as a component of the "
69
69
  "associated stack has a custom flavor."
@@ -132,6 +132,8 @@ from zenml.models import (
132
132
  StepRunUpdate,
133
133
  TagFilter,
134
134
  TagRequest,
135
+ TagResourceRequest,
136
+ TagResourceResponse,
135
137
  TagResponse,
136
138
  TagUpdate,
137
139
  TriggerExecutionFilter,
@@ -744,11 +746,14 @@ class ZenStoreInterface(ABC):
744
746
  @abstractmethod
745
747
  def prune_artifact_versions(
746
748
  self,
749
+ workspace_name_or_id: Union[str, UUID],
747
750
  only_versions: bool = True,
748
751
  ) -> None:
749
752
  """Prunes unused artifact versions and their artifacts.
750
753
 
751
754
  Args:
755
+ workspace_name_or_id: The workspace name or ID to prune artifact
756
+ versions for.
752
757
  only_versions: Only delete artifact versions, keeping artifacts
753
758
  """
754
759
 
@@ -889,7 +894,7 @@ class ZenStoreInterface(ABC):
889
894
  The created stack component.
890
895
 
891
896
  Raises:
892
- StackComponentExistsError: If a stack component with the same name
897
+ EntityExistsError: If a stack component with the same name
893
898
  and type is already owned by this user in this workspace.
894
899
  """
895
900
 
@@ -1531,30 +1536,30 @@ class ZenStoreInterface(ABC):
1531
1536
  # -------------------- Pipeline runs --------------------
1532
1537
 
1533
1538
  @abstractmethod
1534
- def create_run(
1539
+ def get_or_create_run(
1535
1540
  self, pipeline_run: PipelineRunRequest
1536
- ) -> PipelineRunResponse:
1537
- """Creates a pipeline run.
1541
+ ) -> Tuple[PipelineRunResponse, bool]:
1542
+ """Gets or creates a pipeline run.
1543
+
1544
+ If a run with the same ID or name already exists, it is returned.
1545
+ Otherwise, a new run is created.
1538
1546
 
1539
1547
  Args:
1540
- pipeline_run: The pipeline run to create.
1548
+ pipeline_run: The pipeline run to get or create.
1541
1549
 
1542
1550
  Returns:
1543
- The created pipeline run.
1544
-
1545
- Raises:
1546
- EntityExistsError: If an identical pipeline run already exists.
1547
- KeyError: If the pipeline does not exist.
1551
+ The pipeline run, and a boolean indicating whether the run was
1552
+ created or not.
1548
1553
  """
1549
1554
 
1550
1555
  @abstractmethod
1551
1556
  def get_run(
1552
- self, run_name_or_id: Union[str, UUID], hydrate: bool = True
1557
+ self, run_id: UUID, hydrate: bool = True
1553
1558
  ) -> PipelineRunResponse:
1554
1559
  """Gets a pipeline run.
1555
1560
 
1556
1561
  Args:
1557
- run_name_or_id: The name or ID of the pipeline run to get.
1562
+ run_id: The ID of the pipeline run to get.
1558
1563
  hydrate: Flag deciding whether to hydrate the output model(s)
1559
1564
  by including metadata fields in the response.
1560
1565
 
@@ -1611,23 +1616,6 @@ class ZenStoreInterface(ABC):
1611
1616
  KeyError: if the pipeline run doesn't exist.
1612
1617
  """
1613
1618
 
1614
- @abstractmethod
1615
- def get_or_create_run(
1616
- self, pipeline_run: PipelineRunRequest
1617
- ) -> Tuple[PipelineRunResponse, bool]:
1618
- """Gets or creates a pipeline run.
1619
-
1620
- If a run with the same ID or name already exists, it is returned.
1621
- Otherwise, a new run is created.
1622
-
1623
- Args:
1624
- pipeline_run: The pipeline run to get or create.
1625
-
1626
- Returns:
1627
- The pipeline run, and a boolean indicating whether the run was
1628
- created or not.
1629
- """
1630
-
1631
1619
  # -------------------- Run metadata --------------------
1632
1620
 
1633
1621
  @abstractmethod
@@ -2147,18 +2135,13 @@ class ZenStoreInterface(ABC):
2147
2135
  @abstractmethod
2148
2136
  def list_service_connector_resources(
2149
2137
  self,
2150
- workspace_name_or_id: Union[str, UUID],
2151
- connector_type: Optional[str] = None,
2152
- resource_type: Optional[str] = None,
2153
- resource_id: Optional[str] = None,
2138
+ filter_model: ServiceConnectorFilter,
2154
2139
  ) -> List[ServiceConnectorResourcesModel]:
2155
2140
  """List resources that can be accessed by service connectors.
2156
2141
 
2157
2142
  Args:
2158
- workspace_name_or_id: The name or ID of the workspace to scope to.
2159
- connector_type: The type of service connector to scope to.
2160
- resource_type: The type of resource to scope to.
2161
- resource_id: The ID of the resource to scope to.
2143
+ filter_model: The filter model to use when fetching service
2144
+ connectors.
2162
2145
 
2163
2146
  Returns:
2164
2147
  The matching list of resources that available service
@@ -2213,11 +2196,8 @@ class ZenStoreInterface(ABC):
2213
2196
  The created stack.
2214
2197
 
2215
2198
  Raises:
2216
- EntityExistsError: If a service connector with the same name
2217
- already exists.
2218
- StackComponentExistsError: If a stack component with the same name
2219
- already exists.
2220
- StackExistsError: If a stack with the same name already exists.
2199
+ EntityExistsError: If a stack, stack component or service connector
2200
+ with the same name already exists.
2221
2201
  """
2222
2202
 
2223
2203
  @abstractmethod
@@ -2499,7 +2479,7 @@ class ZenStoreInterface(ABC):
2499
2479
  trigger_execution_id: UUID,
2500
2480
  hydrate: bool = True,
2501
2481
  ) -> TriggerExecutionResponse:
2502
- """Get an trigger execution by ID.
2482
+ """Get a trigger execution by ID.
2503
2483
 
2504
2484
  Args:
2505
2485
  trigger_execution_id: The ID of the trigger execution to get.
@@ -2725,14 +2705,14 @@ class ZenStoreInterface(ABC):
2725
2705
  """
2726
2706
 
2727
2707
  @abstractmethod
2728
- def delete_model(self, model_name_or_id: Union[str, UUID]) -> None:
2708
+ def delete_model(self, model_id: UUID) -> None:
2729
2709
  """Deletes a model.
2730
2710
 
2731
2711
  Args:
2732
- model_name_or_id: name or id of the model to be deleted.
2712
+ model_id: id of the model to be deleted.
2733
2713
 
2734
2714
  Raises:
2735
- KeyError: specified ID or name not found.
2715
+ KeyError: model with specified ID not found.
2736
2716
  """
2737
2717
 
2738
2718
  @abstractmethod
@@ -2752,13 +2732,11 @@ class ZenStoreInterface(ABC):
2752
2732
  """
2753
2733
 
2754
2734
  @abstractmethod
2755
- def get_model(
2756
- self, model_name_or_id: Union[str, UUID], hydrate: bool = True
2757
- ) -> ModelResponse:
2735
+ def get_model(self, model_id: UUID, hydrate: bool = True) -> ModelResponse:
2758
2736
  """Get an existing model.
2759
2737
 
2760
2738
  Args:
2761
- model_name_or_id: name or id of the model to be retrieved.
2739
+ model_id: id of the model to be retrieved.
2762
2740
  hydrate: Flag deciding whether to hydrate the output model(s)
2763
2741
  by including metadata fields in the response.
2764
2742
 
@@ -2766,7 +2744,7 @@ class ZenStoreInterface(ABC):
2766
2744
  The model of interest.
2767
2745
 
2768
2746
  Raises:
2769
- KeyError: specified ID or name not found.
2747
+ KeyError: model with specified ID not found.
2770
2748
  """
2771
2749
 
2772
2750
  @abstractmethod
@@ -2845,14 +2823,11 @@ class ZenStoreInterface(ABC):
2845
2823
  def list_model_versions(
2846
2824
  self,
2847
2825
  model_version_filter_model: ModelVersionFilter,
2848
- model_name_or_id: Optional[Union[str, UUID]] = None,
2849
2826
  hydrate: bool = False,
2850
2827
  ) -> Page[ModelVersionResponse]:
2851
2828
  """Get all model versions by filter.
2852
2829
 
2853
2830
  Args:
2854
- model_name_or_id: name or id of the model containing the model
2855
- versions.
2856
2831
  model_version_filter_model: All filter parameters including
2857
2832
  pagination params.
2858
2833
  hydrate: Flag deciding whether to hydrate the output model(s)
@@ -3005,9 +2980,7 @@ class ZenStoreInterface(ABC):
3005
2980
  KeyError: specified ID not found.
3006
2981
  """
3007
2982
 
3008
- #################
3009
- # Tags
3010
- #################
2983
+ # -------------------- Tags --------------------
3011
2984
 
3012
2985
  @abstractmethod
3013
2986
  def create_tag(self, tag: TagRequest) -> TagResponse:
@@ -3039,7 +3012,9 @@ class ZenStoreInterface(ABC):
3039
3012
 
3040
3013
  @abstractmethod
3041
3014
  def get_tag(
3042
- self, tag_name_or_id: Union[str, UUID], hydrate: bool = True
3015
+ self,
3016
+ tag_name_or_id: Union[str, UUID],
3017
+ hydrate: bool = True,
3043
3018
  ) -> TagResponse:
3044
3019
  """Get an existing tag.
3045
3020
 
@@ -3090,3 +3065,52 @@ class ZenStoreInterface(ABC):
3090
3065
  Raises:
3091
3066
  KeyError: If the tag is not found
3092
3067
  """
3068
+
3069
+ # -------------------- Tag Resources --------------------
3070
+
3071
+ @abstractmethod
3072
+ def create_tag_resource(
3073
+ self, tag_resource: TagResourceRequest
3074
+ ) -> TagResourceResponse:
3075
+ """Create a new tag resource relationship.
3076
+
3077
+ Args:
3078
+ tag_resource: The tag resource relationship to be created.
3079
+
3080
+ Returns:
3081
+ The newly created tag resource relationship.
3082
+ """
3083
+
3084
+ @abstractmethod
3085
+ def batch_create_tag_resource(
3086
+ self, tag_resources: List[TagResourceRequest]
3087
+ ) -> List[TagResourceResponse]:
3088
+ """Create a new tag resource relationship.
3089
+
3090
+ Args:
3091
+ tag_resources: The tag resource relationships to be created.
3092
+
3093
+ Returns:
3094
+ The newly created tag resource relationships.
3095
+ """
3096
+
3097
+ @abstractmethod
3098
+ def delete_tag_resource(
3099
+ self,
3100
+ tag_resource: TagResourceRequest,
3101
+ ) -> None:
3102
+ """Delete a tag resource relationship.
3103
+
3104
+ Args:
3105
+ tag_resource: The tag resource relationship to delete.
3106
+ """
3107
+
3108
+ @abstractmethod
3109
+ def batch_delete_tag_resource(
3110
+ self, tag_resources: List[TagResourceRequest]
3111
+ ) -> None:
3112
+ """Delete a batch of tag resource relationships.
3113
+
3114
+ Args:
3115
+ tag_resources: The tag resource relationships to be deleted.
3116
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: zenml-nightly
3
- Version: 0.75.0.dev20250312
3
+ Version: 0.75.0.dev20250313
4
4
  Summary: ZenML: Write production-ready ML code.
5
5
  License: Apache-2.0
6
6
  Keywords: machine learning,production,pipeline,mlops,devops