zenml-nightly 0.75.0.dev20250313__py3-none-any.whl → 0.75.0.dev20250314__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 (123) hide show
  1. zenml/VERSION +1 -1
  2. zenml/analytics/context.py +4 -4
  3. zenml/analytics/enums.py +2 -2
  4. zenml/artifacts/utils.py +2 -2
  5. zenml/cli/__init__.py +8 -9
  6. zenml/cli/base.py +2 -2
  7. zenml/cli/code_repository.py +1 -1
  8. zenml/cli/pipeline.py +3 -3
  9. zenml/cli/project.py +172 -0
  10. zenml/cli/service_accounts.py +0 -1
  11. zenml/cli/service_connectors.py +15 -16
  12. zenml/cli/stack.py +0 -2
  13. zenml/cli/stack_components.py +2 -2
  14. zenml/cli/utils.py +3 -3
  15. zenml/client.py +347 -340
  16. zenml/config/global_config.py +41 -43
  17. zenml/constants.py +5 -3
  18. zenml/event_hub/event_hub.py +1 -1
  19. zenml/integrations/gcp/service_connectors/gcp_service_connector.py +7 -6
  20. zenml/integrations/mlflow/steps/mlflow_registry.py +3 -3
  21. zenml/integrations/wandb/__init__.py +1 -1
  22. zenml/integrations/wandb/experiment_trackers/wandb_experiment_tracker.py +29 -9
  23. zenml/integrations/wandb/flavors/wandb_experiment_tracker_flavor.py +2 -0
  24. zenml/model/model.py +2 -2
  25. zenml/model_registries/base_model_registry.py +1 -1
  26. zenml/models/__init__.py +29 -29
  27. zenml/models/v2/base/filter.py +1 -1
  28. zenml/models/v2/base/scoped.py +49 -53
  29. zenml/models/v2/core/action.py +12 -12
  30. zenml/models/v2/core/artifact.py +15 -15
  31. zenml/models/v2/core/artifact_version.py +15 -15
  32. zenml/models/v2/core/code_repository.py +12 -12
  33. zenml/models/v2/core/event_source.py +12 -12
  34. zenml/models/v2/core/model.py +17 -17
  35. zenml/models/v2/core/model_version.py +15 -15
  36. zenml/models/v2/core/pipeline.py +15 -15
  37. zenml/models/v2/core/pipeline_build.py +14 -14
  38. zenml/models/v2/core/pipeline_deployment.py +12 -14
  39. zenml/models/v2/core/pipeline_run.py +16 -16
  40. zenml/models/v2/core/project.py +203 -0
  41. zenml/models/v2/core/run_metadata.py +2 -2
  42. zenml/models/v2/core/run_template.py +15 -15
  43. zenml/models/v2/core/schedule.py +12 -12
  44. zenml/models/v2/core/secret.py +1 -1
  45. zenml/models/v2/core/service.py +14 -14
  46. zenml/models/v2/core/step_run.py +13 -13
  47. zenml/models/v2/core/trigger.py +13 -13
  48. zenml/models/v2/core/trigger_execution.py +2 -2
  49. zenml/models/v2/core/user.py +0 -17
  50. zenml/models/v2/misc/statistics.py +4 -4
  51. zenml/orchestrators/cache_utils.py +7 -7
  52. zenml/orchestrators/input_utils.py +1 -1
  53. zenml/orchestrators/step_launcher.py +1 -1
  54. zenml/orchestrators/step_run_utils.py +2 -2
  55. zenml/orchestrators/utils.py +4 -4
  56. zenml/pipelines/build_utils.py +2 -2
  57. zenml/pipelines/pipeline_definition.py +5 -5
  58. zenml/pipelines/run_utils.py +1 -1
  59. zenml/service_connectors/service_connector.py +0 -3
  60. zenml/service_connectors/service_connector_utils.py +0 -1
  61. zenml/stack/stack.py +0 -1
  62. zenml/steps/base_step.py +10 -2
  63. zenml/zen_server/rbac/endpoint_utils.py +17 -17
  64. zenml/zen_server/rbac/models.py +20 -20
  65. zenml/zen_server/rbac/rbac_sql_zen_store.py +3 -3
  66. zenml/zen_server/rbac/utils.py +23 -25
  67. zenml/zen_server/rbac/zenml_cloud_rbac.py +12 -16
  68. zenml/zen_server/routers/artifact_version_endpoints.py +10 -10
  69. zenml/zen_server/routers/auth_endpoints.py +6 -6
  70. zenml/zen_server/routers/code_repositories_endpoints.py +12 -14
  71. zenml/zen_server/routers/model_versions_endpoints.py +13 -15
  72. zenml/zen_server/routers/models_endpoints.py +7 -9
  73. zenml/zen_server/routers/pipeline_builds_endpoints.py +14 -16
  74. zenml/zen_server/routers/pipeline_deployments_endpoints.py +13 -15
  75. zenml/zen_server/routers/pipelines_endpoints.py +16 -18
  76. zenml/zen_server/routers/{workspaces_endpoints.py → projects_endpoints.py} +111 -68
  77. zenml/zen_server/routers/run_metadata_endpoints.py +7 -9
  78. zenml/zen_server/routers/run_templates_endpoints.py +15 -17
  79. zenml/zen_server/routers/runs_endpoints.py +12 -14
  80. zenml/zen_server/routers/schedule_endpoints.py +12 -14
  81. zenml/zen_server/routers/secrets_endpoints.py +1 -3
  82. zenml/zen_server/routers/server_endpoints.py +5 -5
  83. zenml/zen_server/routers/service_connectors_endpoints.py +11 -13
  84. zenml/zen_server/routers/service_endpoints.py +7 -9
  85. zenml/zen_server/routers/stack_components_endpoints.py +9 -11
  86. zenml/zen_server/routers/stacks_endpoints.py +9 -11
  87. zenml/zen_server/routers/steps_endpoints.py +6 -6
  88. zenml/zen_server/routers/users_endpoints.py +5 -43
  89. zenml/zen_server/template_execution/utils.py +4 -4
  90. zenml/zen_server/utils.py +10 -10
  91. zenml/zen_server/zen_server_api.py +3 -2
  92. zenml/zen_stores/base_zen_store.py +35 -39
  93. zenml/zen_stores/migrations/versions/12eff0206201_rename_workspace_to_project.py +768 -0
  94. zenml/zen_stores/migrations/versions/41b28cae31ce_make_artifacts_workspace_scoped.py +3 -3
  95. zenml/zen_stores/migrations/versions/cbc6acd71f92_add_workspace_display_name.py +58 -0
  96. zenml/zen_stores/rest_zen_store.py +54 -62
  97. zenml/zen_stores/schemas/__init__.py +2 -2
  98. zenml/zen_stores/schemas/action_schemas.py +9 -9
  99. zenml/zen_stores/schemas/artifact_schemas.py +15 -17
  100. zenml/zen_stores/schemas/code_repository_schemas.py +16 -18
  101. zenml/zen_stores/schemas/event_source_schemas.py +9 -9
  102. zenml/zen_stores/schemas/model_schemas.py +15 -17
  103. zenml/zen_stores/schemas/pipeline_build_schemas.py +7 -7
  104. zenml/zen_stores/schemas/pipeline_deployment_schemas.py +7 -7
  105. zenml/zen_stores/schemas/pipeline_run_schemas.py +9 -9
  106. zenml/zen_stores/schemas/pipeline_schemas.py +9 -9
  107. zenml/zen_stores/schemas/{workspace_schemas.py → project_schemas.py} +47 -41
  108. zenml/zen_stores/schemas/run_metadata_schemas.py +5 -5
  109. zenml/zen_stores/schemas/run_template_schemas.py +9 -9
  110. zenml/zen_stores/schemas/schedule_schema.py +9 -9
  111. zenml/zen_stores/schemas/service_schemas.py +7 -7
  112. zenml/zen_stores/schemas/step_run_schemas.py +7 -7
  113. zenml/zen_stores/schemas/trigger_schemas.py +9 -9
  114. zenml/zen_stores/schemas/user_schemas.py +0 -12
  115. zenml/zen_stores/sql_zen_store.py +258 -268
  116. zenml/zen_stores/zen_store_interface.py +56 -70
  117. {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250314.dist-info}/METADATA +1 -1
  118. {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250314.dist-info}/RECORD +121 -119
  119. zenml/cli/workspace.py +0 -160
  120. zenml/models/v2/core/workspace.py +0 -131
  121. {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250314.dist-info}/LICENSE +0 -0
  122. {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250314.dist-info}/WHEEL +0 -0
  123. {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250314.dist-info}/entry_points.txt +0 -0
zenml/cli/workspace.py DELETED
@@ -1,160 +0,0 @@
1
- # Copyright (c) ZenML GmbH 2022. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at:
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12
- # or implied. See the License for the specific language governing
13
- # permissions and limitations under the License.
14
- """Functionality to administer workspaces of the ZenML CLI and server."""
15
-
16
- from typing import Any, Optional
17
-
18
- import click
19
-
20
- from zenml.cli import utils as cli_utils
21
- from zenml.cli.cli import TagGroup, cli
22
- from zenml.cli.utils import (
23
- check_zenml_pro_workspace_availability,
24
- is_sorted_or_filtered,
25
- list_options,
26
- )
27
- from zenml.client import Client
28
- from zenml.console import console
29
- from zenml.enums import CliCategories
30
- from zenml.models import WorkspaceFilter
31
-
32
-
33
- @cli.group(cls=TagGroup, tag=CliCategories.MANAGEMENT_TOOLS)
34
- def workspace() -> None:
35
- """Commands for workspace management."""
36
-
37
-
38
- @workspace.command("list")
39
- @list_options(WorkspaceFilter)
40
- @click.pass_context
41
- def list_workspaces(ctx: click.Context, **kwargs: Any) -> None:
42
- """List all workspaces.
43
-
44
- Args:
45
- ctx: The click context object
46
- **kwargs: Keyword arguments to filter the list of workspaces.
47
- """
48
- check_zenml_pro_workspace_availability()
49
- client = Client()
50
- with console.status("Listing workspaces...\n"):
51
- workspaces = client.list_workspaces(**kwargs)
52
- if workspaces:
53
- cli_utils.print_pydantic_models(
54
- workspaces,
55
- exclude_columns=["id", "created", "updated"],
56
- active_models=[Client().active_workspace],
57
- show_active=not is_sorted_or_filtered(ctx),
58
- )
59
- else:
60
- cli_utils.declare("No workspaces found for the given filter.")
61
-
62
-
63
- @workspace.command("register")
64
- @click.option(
65
- "--set",
66
- "set_workspace",
67
- is_flag=True,
68
- help="Immediately set this workspace as active.",
69
- type=click.BOOL,
70
- )
71
- @click.argument("workspace_name", type=str, required=True)
72
- def register_workspace(
73
- workspace_name: str, set_workspace: bool = False
74
- ) -> None:
75
- """Register a new workspace.
76
-
77
- Args:
78
- workspace_name: The name of the workspace to register.
79
- set_workspace: Whether to set the workspace as active.
80
- """
81
- check_zenml_pro_workspace_availability()
82
- client = Client()
83
- with console.status("Creating workspace...\n"):
84
- try:
85
- client.create_workspace(workspace_name, description="")
86
- cli_utils.declare("Workspace created successfully.")
87
- except Exception as e:
88
- cli_utils.error(str(e))
89
-
90
- if set_workspace:
91
- client.set_active_workspace(workspace_name)
92
- cli_utils.declare(
93
- f"The active workspace has been set to {workspace_name}"
94
- )
95
-
96
-
97
- @workspace.command("set")
98
- @click.argument("workspace_name_or_id", type=str, required=True)
99
- def set_workspace(workspace_name_or_id: str) -> None:
100
- """Set the active workspace.
101
-
102
- Args:
103
- workspace_name_or_id: The name or ID of the workspace to set as active.
104
- """
105
- check_zenml_pro_workspace_availability()
106
- client = Client()
107
- with console.status("Setting workspace...\n"):
108
- try:
109
- client.set_active_workspace(workspace_name_or_id)
110
- cli_utils.declare(
111
- f"The active workspace has been set to {workspace_name_or_id}"
112
- )
113
- except Exception as e:
114
- cli_utils.error(str(e))
115
-
116
-
117
- @workspace.command("describe")
118
- @click.argument("workspace_name_or_id", type=str, required=False)
119
- def describe_workspace(workspace_name_or_id: Optional[str] = None) -> None:
120
- """Get the workspace.
121
-
122
- Args:
123
- workspace_name_or_id: The name or ID of the workspace to set as active.
124
- """
125
- check_zenml_pro_workspace_availability()
126
- client = Client()
127
- if not workspace_name_or_id:
128
- active_workspace = client.active_workspace
129
- cli_utils.print_pydantic_models(
130
- [active_workspace], exclude_columns=["created", "updated"]
131
- )
132
- else:
133
- try:
134
- workspace_ = client.get_workspace(workspace_name_or_id)
135
- except KeyError as err:
136
- cli_utils.error(str(err))
137
- else:
138
- cli_utils.print_pydantic_models(
139
- [workspace_], exclude_columns=["created", "updated"]
140
- )
141
-
142
-
143
- @workspace.command("delete")
144
- @click.argument("workspace_name_or_id", type=str, required=True)
145
- def delete_workspace(workspace_name_or_id: str) -> None:
146
- """Delete a workspace.
147
-
148
- Args:
149
- workspace_name_or_id: The name or ID of the workspace to delete.
150
- """
151
- check_zenml_pro_workspace_availability()
152
- client = Client()
153
- with console.status("Deleting workspace...\n"):
154
- try:
155
- client.delete_workspace(workspace_name_or_id)
156
- cli_utils.declare(
157
- f"Workspace '{workspace_name_or_id}' deleted successfully."
158
- )
159
- except Exception as e:
160
- cli_utils.error(str(e))
@@ -1,131 +0,0 @@
1
- # Copyright (c) ZenML GmbH 2023. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at:
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12
- # or implied. See the License for the specific language governing
13
- # permissions and limitations under the License.
14
- """Models representing workspaces."""
15
-
16
- from typing import Optional
17
-
18
- from pydantic import Field
19
-
20
- from zenml.constants import STR_FIELD_MAX_LENGTH
21
- from zenml.models.v2.base.base import (
22
- BaseDatedResponseBody,
23
- BaseIdentifiedResponse,
24
- BaseRequest,
25
- BaseResponseMetadata,
26
- BaseResponseResources,
27
- BaseUpdate,
28
- )
29
- from zenml.models.v2.base.filter import BaseFilter
30
-
31
- # ------------------ Request Model ------------------
32
-
33
-
34
- class WorkspaceRequest(BaseRequest):
35
- """Request model for workspaces."""
36
-
37
- name: str = Field(
38
- title="The unique name of the workspace.",
39
- max_length=STR_FIELD_MAX_LENGTH,
40
- )
41
- description: str = Field(
42
- default="",
43
- title="The description of the workspace.",
44
- max_length=STR_FIELD_MAX_LENGTH,
45
- )
46
-
47
-
48
- # ------------------ Update Model ------------------
49
-
50
-
51
- class WorkspaceUpdate(BaseUpdate):
52
- """Update model for workspaces."""
53
-
54
- name: Optional[str] = Field(
55
- title="The unique name of the workspace.",
56
- max_length=STR_FIELD_MAX_LENGTH,
57
- default=None,
58
- )
59
- description: Optional[str] = Field(
60
- title="The description of the workspace.",
61
- max_length=STR_FIELD_MAX_LENGTH,
62
- default=None,
63
- )
64
-
65
-
66
- # ------------------ Response Model ------------------
67
-
68
-
69
- class WorkspaceResponseBody(BaseDatedResponseBody):
70
- """Response body for workspaces."""
71
-
72
-
73
- class WorkspaceResponseMetadata(BaseResponseMetadata):
74
- """Response metadata for workspaces."""
75
-
76
- description: str = Field(
77
- default="",
78
- title="The description of the workspace.",
79
- max_length=STR_FIELD_MAX_LENGTH,
80
- )
81
-
82
-
83
- class WorkspaceResponseResources(BaseResponseResources):
84
- """Class for all resource models associated with the workspace entity."""
85
-
86
-
87
- class WorkspaceResponse(
88
- BaseIdentifiedResponse[
89
- WorkspaceResponseBody,
90
- WorkspaceResponseMetadata,
91
- WorkspaceResponseResources,
92
- ]
93
- ):
94
- """Response model for workspaces."""
95
-
96
- name: str = Field(
97
- title="The unique name of the workspace.",
98
- max_length=STR_FIELD_MAX_LENGTH,
99
- )
100
-
101
- def get_hydrated_version(self) -> "WorkspaceResponse":
102
- """Get the hydrated version of this workspace.
103
-
104
- Returns:
105
- an instance of the same entity with the metadata field attached.
106
- """
107
- from zenml.client import Client
108
-
109
- return Client().zen_store.get_workspace(self.id)
110
-
111
- # Body and metadata properties
112
- @property
113
- def description(self) -> str:
114
- """The `description` property.
115
-
116
- Returns:
117
- the value of the property.
118
- """
119
- return self.get_metadata().description
120
-
121
-
122
- # ------------------ Filter Model ------------------
123
-
124
-
125
- class WorkspaceFilter(BaseFilter):
126
- """Model to enable advanced filtering of all Workspaces."""
127
-
128
- name: Optional[str] = Field(
129
- default=None,
130
- description="Name of the workspace",
131
- )