zenml-nightly 0.80.0.dev20250326__py3-none-any.whl → 0.80.0.dev20250328__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 (36) hide show
  1. zenml/VERSION +1 -1
  2. zenml/cli/project.py +41 -4
  3. zenml/client.py +7 -2
  4. zenml/config/global_config.py +15 -15
  5. zenml/integrations/databricks/__init__.py +6 -3
  6. zenml/integrations/deepchecks/__init__.py +5 -2
  7. zenml/integrations/evidently/__init__.py +5 -2
  8. zenml/integrations/facets/__init__.py +5 -2
  9. zenml/integrations/feast/__init__.py +4 -2
  10. zenml/integrations/great_expectations/__init__.py +4 -2
  11. zenml/integrations/huggingface/__init__.py +4 -2
  12. zenml/integrations/integration.py +6 -1
  13. zenml/integrations/kubernetes/orchestrators/kubernetes_orchestrator.py +1 -1
  14. zenml/integrations/langchain/materializers/openai_embedding_materializer.py +5 -9
  15. zenml/integrations/langchain/materializers/vector_store_materializer.py +3 -7
  16. zenml/integrations/llama_index/materializers/document_materializer.py +2 -6
  17. zenml/integrations/llama_index/materializers/gpt_index_materializer.py +2 -7
  18. zenml/integrations/mlflow/__init__.py +15 -4
  19. zenml/integrations/seldon/__init__.py +4 -2
  20. zenml/integrations/tensorboard/__init__.py +3 -1
  21. zenml/integrations/tensorflow/__init__.py +4 -3
  22. zenml/integrations/whylogs/__init__.py +4 -2
  23. zenml/models/v2/core/user.py +17 -0
  24. zenml/utils/requirements_utils.py +12 -3
  25. zenml/zen_server/routers/users_endpoints.py +169 -173
  26. zenml/zen_server/template_execution/utils.py +14 -5
  27. zenml/zen_stores/base_zen_store.py +46 -14
  28. zenml/zen_stores/migrations/versions/1f1105204aaf_add_user_default_project.py +51 -0
  29. zenml/zen_stores/rest_zen_store.py +1 -3
  30. zenml/zen_stores/schemas/user_schemas.py +11 -0
  31. zenml/zen_stores/sql_zen_store.py +1 -5
  32. {zenml_nightly-0.80.0.dev20250326.dist-info → zenml_nightly-0.80.0.dev20250328.dist-info}/METADATA +1 -1
  33. {zenml_nightly-0.80.0.dev20250326.dist-info → zenml_nightly-0.80.0.dev20250328.dist-info}/RECORD +36 -35
  34. {zenml_nightly-0.80.0.dev20250326.dist-info → zenml_nightly-0.80.0.dev20250328.dist-info}/LICENSE +0 -0
  35. {zenml_nightly-0.80.0.dev20250326.dist-info → zenml_nightly-0.80.0.dev20250328.dist-info}/WHEEL +0 -0
  36. {zenml_nightly-0.80.0.dev20250326.dist-info → zenml_nightly-0.80.0.dev20250328.dist-info}/entry_points.txt +0 -0
zenml/VERSION CHANGED
@@ -1 +1 @@
1
- 0.80.0.dev20250326
1
+ 0.80.0.dev20250328
zenml/cli/project.py CHANGED
@@ -50,10 +50,14 @@ def list_projects(ctx: click.Context, /, **kwargs: Any) -> None:
50
50
  with console.status("Listing projects...\n"):
51
51
  projects = client.list_projects(**kwargs)
52
52
  if projects:
53
+ try:
54
+ active_project = [client.active_project]
55
+ except Exception:
56
+ active_project = []
53
57
  cli_utils.print_pydantic_models(
54
58
  projects,
55
59
  exclude_columns=["id", "created", "updated"],
56
- active_models=[Client().active_project],
60
+ active_models=active_project,
57
61
  show_active=not is_sorted_or_filtered(ctx),
58
62
  )
59
63
  else:
@@ -75,11 +79,18 @@ def list_projects(ctx: click.Context, /, **kwargs: Any) -> None:
75
79
  required=False,
76
80
  help="The display name of the project.",
77
81
  )
82
+ @click.option(
83
+ "--set-default",
84
+ "set_default",
85
+ is_flag=True,
86
+ help="Set this project as the default project.",
87
+ )
78
88
  @click.argument("project_name", type=str, required=True)
79
89
  def register_project(
80
90
  project_name: str,
81
91
  set_project: bool = False,
82
92
  display_name: Optional[str] = None,
93
+ set_default: bool = False,
83
94
  ) -> None:
84
95
  """Register a new project.
85
96
 
@@ -87,12 +98,13 @@ def register_project(
87
98
  project_name: The name of the project to register.
88
99
  set_project: Whether to set the project as active.
89
100
  display_name: The display name of the project.
101
+ set_default: Whether to set the project as the default project.
90
102
  """
91
103
  check_zenml_pro_project_availability()
92
104
  client = Client()
93
105
  with console.status("Creating project...\n"):
94
106
  try:
95
- client.create_project(
107
+ project = client.create_project(
96
108
  project_name,
97
109
  description="",
98
110
  display_name=display_name,
@@ -105,26 +117,51 @@ def register_project(
105
117
  client.set_active_project(project_name)
106
118
  cli_utils.declare(f"The active project has been set to {project_name}")
107
119
 
120
+ if set_default:
121
+ client.update_user(
122
+ name_id_or_prefix=client.active_user.id,
123
+ updated_default_project_id=project.id,
124
+ )
125
+ cli_utils.declare(
126
+ f"The default project has been set to {project.name}"
127
+ )
128
+
108
129
 
109
130
  @project.command("set")
110
131
  @click.argument("project_name_or_id", type=str, required=True)
111
- def set_project(project_name_or_id: str) -> None:
132
+ @click.option(
133
+ "--default",
134
+ "default",
135
+ is_flag=True,
136
+ help="Set this project as the default project.",
137
+ )
138
+ def set_project(project_name_or_id: str, default: bool = False) -> None:
112
139
  """Set the active project.
113
140
 
114
141
  Args:
115
142
  project_name_or_id: The name or ID of the project to set as active.
143
+ default: Whether to set the project as the default project.
116
144
  """
117
145
  check_zenml_pro_project_availability()
118
146
  client = Client()
119
147
  with console.status("Setting project...\n"):
120
148
  try:
121
- client.set_active_project(project_name_or_id)
149
+ project = client.set_active_project(project_name_or_id)
122
150
  cli_utils.declare(
123
151
  f"The active project has been set to {project_name_or_id}"
124
152
  )
125
153
  except Exception as e:
126
154
  cli_utils.error(str(e))
127
155
 
156
+ if default:
157
+ client.update_user(
158
+ name_id_or_prefix=client.active_user.id,
159
+ updated_default_project_id=project.id,
160
+ )
161
+ cli_utils.declare(
162
+ f"The default project has been set to {project.name}"
163
+ )
164
+
128
165
 
129
166
  @project.command("describe")
130
167
  @click.argument("project_name_or_id", type=str, required=False)
zenml/client.py CHANGED
@@ -235,7 +235,7 @@ class ClientConfiguration(FileSyncModel):
235
235
  else:
236
236
  raise RuntimeError(
237
237
  "No active project is configured. Run "
238
- "`zenml project set PROJECT_NAME` to set the active "
238
+ "`zenml project set <NAME>` to set the active "
239
239
  "project."
240
240
  )
241
241
 
@@ -876,6 +876,7 @@ class Client(metaclass=ClientMetaClass):
876
876
  old_password: Optional[str] = None,
877
877
  updated_is_admin: Optional[bool] = None,
878
878
  updated_metadata: Optional[Dict[str, Any]] = None,
879
+ updated_default_project_id: Optional[UUID] = None,
879
880
  active: Optional[bool] = None,
880
881
  ) -> UserResponse:
881
882
  """Update a user.
@@ -891,6 +892,7 @@ class Client(metaclass=ClientMetaClass):
891
892
  update.
892
893
  updated_is_admin: Whether the user should be an admin.
893
894
  updated_metadata: The new metadata for the user.
895
+ updated_default_project_id: The new default project ID for the user.
894
896
  active: Use to activate or deactivate the user.
895
897
 
896
898
  Returns:
@@ -928,6 +930,9 @@ class Client(metaclass=ClientMetaClass):
928
930
  if updated_metadata is not None:
929
931
  user_update.user_metadata = updated_metadata
930
932
 
933
+ if updated_default_project_id is not None:
934
+ user_update.default_project_id = updated_default_project_id
935
+
931
936
  return self.zen_store.update_user(
932
937
  user_id=user.id, user_update=user_update
933
938
  )
@@ -1154,7 +1159,7 @@ class Client(metaclass=ClientMetaClass):
1154
1159
  if not project:
1155
1160
  raise RuntimeError(
1156
1161
  "No active project is configured. Run "
1157
- "`zenml project set PROJECT_NAME` to set the active "
1162
+ "`zenml project set <NAME>` to set the active "
1158
1163
  "project."
1159
1164
  )
1160
1165
 
@@ -113,7 +113,7 @@ class GlobalConfiguration(BaseModel, metaclass=GlobalConfigMetaClass):
113
113
  global config.
114
114
  store: Store configuration.
115
115
  active_stack_id: The ID of the active stack.
116
- active_project_name: The name of the active project.
116
+ active_project_id: The ID of the active project.
117
117
  """
118
118
 
119
119
  user_id: uuid.UUID = Field(default_factory=uuid.uuid4)
@@ -123,7 +123,7 @@ class GlobalConfiguration(BaseModel, metaclass=GlobalConfigMetaClass):
123
123
  version: Optional[str] = None
124
124
  store: Optional[SerializeAsAny[StoreConfiguration]] = None
125
125
  active_stack_id: Optional[uuid.UUID] = None
126
- active_project_name: Optional[str] = None
126
+ active_project_id: Optional[uuid.UUID] = None
127
127
 
128
128
  _zen_store: Optional["BaseZenStore"] = None
129
129
  _active_project: Optional["ProjectResponse"] = None
@@ -393,15 +393,15 @@ class GlobalConfiguration(BaseModel, metaclass=GlobalConfigMetaClass):
393
393
  if ENV_ZENML_SERVER in os.environ:
394
394
  return
395
395
  active_project, active_stack = self.zen_store.validate_active_config(
396
- self.active_project_name,
396
+ self.active_project_id,
397
397
  self.active_stack_id,
398
398
  config_name="global",
399
399
  )
400
400
  if active_project:
401
- self.active_project_name = active_project.name
401
+ self.active_project_id = active_project.id
402
402
  self._active_project = active_project
403
403
  else:
404
- self.active_project_name = None
404
+ self.active_project_id = None
405
405
  self._active_project = None
406
406
 
407
407
  self.set_active_stack(active_stack)
@@ -730,7 +730,7 @@ class GlobalConfiguration(BaseModel, metaclass=GlobalConfigMetaClass):
730
730
  Returns:
731
731
  The project that was set active.
732
732
  """
733
- self.active_project_name = project.name
733
+ self.active_project_id = project.id
734
734
  self._active_project = project
735
735
  # Sanitize the global configuration to reflect the new project
736
736
  self._sanitize_config()
@@ -751,35 +751,35 @@ class GlobalConfiguration(BaseModel, metaclass=GlobalConfigMetaClass):
751
751
  Returns:
752
752
  The model of the active project.
753
753
  """
754
- project_name = self.get_active_project_name()
754
+ project_id = self.get_active_project_id()
755
755
 
756
756
  if self._active_project is not None:
757
757
  return self._active_project
758
758
 
759
759
  project = self.zen_store.get_project(
760
- project_name_or_id=project_name,
760
+ project_name_or_id=project_id,
761
761
  )
762
762
  return self.set_active_project(project)
763
763
 
764
- def get_active_project_name(self) -> str:
765
- """Get the name of the active project.
764
+ def get_active_project_id(self) -> UUID:
765
+ """Get the ID of the active project.
766
766
 
767
767
  Returns:
768
- The name of the active project.
768
+ The ID of the active project.
769
769
 
770
770
  Raises:
771
771
  RuntimeError: If the active project is not set.
772
772
  """
773
- if self.active_project_name is None:
773
+ if self.active_project_id is None:
774
774
  _ = self.zen_store
775
- if self.active_project_name is None:
775
+ if self.active_project_id is None:
776
776
  raise RuntimeError(
777
777
  "No project is currently set as active. Please set the "
778
- "active project using the `zenml project set` CLI "
778
+ "active project using the `zenml project set <NAME>` CLI "
779
779
  "command."
780
780
  )
781
781
 
782
- return self.active_project_name
782
+ return self.active_project_id
783
783
 
784
784
  def get_active_stack_id(self) -> UUID:
785
785
  """Get the ID of the active stack.
@@ -34,11 +34,14 @@ class DatabricksIntegration(Integration):
34
34
  REQUIREMENTS_IGNORED_ON_UNINSTALL = ["numpy", "pandas"]
35
35
 
36
36
  @classmethod
37
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
37
+ def get_requirements(
38
+ cls, target_os: Optional[str] = None, python_version: Optional[str] = None
39
+ ) -> List[str]:
38
40
  """Method to get the requirements for the integration.
39
41
 
40
42
  Args:
41
43
  target_os: The target operating system to get the requirements for.
44
+ python_version: The Python version to use for the requirements.
42
45
 
43
46
  Returns:
44
47
  A list of requirements.
@@ -47,8 +50,8 @@ class DatabricksIntegration(Integration):
47
50
  from zenml.integrations.pandas import PandasIntegration
48
51
 
49
52
  return cls.REQUIREMENTS + \
50
- NumpyIntegration.get_requirements(target_os=target_os) + \
51
- PandasIntegration.get_requirements(target_os=target_os)
53
+ NumpyIntegration.get_requirements(target_os=target_os, python_version=python_version) + \
54
+ PandasIntegration.get_requirements(target_os=target_os, python_version=python_version)
52
55
 
53
56
  @classmethod
54
57
  def flavors(cls) -> List[Type[Flavor]]:
@@ -58,11 +58,14 @@ class DeepchecksIntegration(Integration):
58
58
  from zenml.integrations.deepchecks import materializers # noqa
59
59
 
60
60
  @classmethod
61
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
61
+ def get_requirements(
62
+ cls, target_os: Optional[str] = None, python_version: Optional[str] = None
63
+ ) -> List[str]:
62
64
  """Method to get the requirements for the integration.
63
65
 
64
66
  Args:
65
67
  target_os: The target operating system to get the requirements for.
68
+ python_version: The Python version to use for the requirements.
66
69
 
67
70
  Returns:
68
71
  A list of requirements.
@@ -70,7 +73,7 @@ class DeepchecksIntegration(Integration):
70
73
  from zenml.integrations.pandas import PandasIntegration
71
74
 
72
75
  return cls.REQUIREMENTS + \
73
- PandasIntegration.get_requirements(target_os=target_os)
76
+ PandasIntegration.get_requirements(target_os=target_os, python_version=python_version)
74
77
 
75
78
  @classmethod
76
79
  def flavors(cls) -> List[Type[Flavor]]:
@@ -60,11 +60,14 @@ class EvidentlyIntegration(Integration):
60
60
  REQUIREMENTS_IGNORED_ON_UNINSTALL = ["tenacity", "pandas"]
61
61
 
62
62
  @classmethod
63
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
63
+ def get_requirements(
64
+ cls, target_os: Optional[str] = None, python_version: Optional[str] = None
65
+ ) -> List[str]:
64
66
  """Method to get the requirements for the integration.
65
67
 
66
68
  Args:
67
69
  target_os: The target operating system to get the requirements for.
70
+ python_version: The Python version to use for the requirements.
68
71
 
69
72
  Returns:
70
73
  A list of requirements.
@@ -72,7 +75,7 @@ class EvidentlyIntegration(Integration):
72
75
  from zenml.integrations.pandas import PandasIntegration
73
76
 
74
77
  return cls.REQUIREMENTS + \
75
- PandasIntegration.get_requirements(target_os=target_os)
78
+ PandasIntegration.get_requirements(target_os=target_os, python_version=python_version)
76
79
 
77
80
  @classmethod
78
81
  def flavors(cls) -> List[Type[Flavor]]:
@@ -31,11 +31,14 @@ class FacetsIntegration(Integration):
31
31
  from zenml.integrations.facets import materializers # noqa
32
32
 
33
33
  @classmethod
34
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
34
+ def get_requirements(
35
+ cls, target_os: Optional[str] = None, python_version: Optional[str] = None
36
+ ) -> List[str]:
35
37
  """Method to get the requirements for the integration.
36
38
 
37
39
  Args:
38
40
  target_os: The target operating system to get the requirements for.
41
+ python_version: The Python version to use for the requirements.
39
42
 
40
43
  Returns:
41
44
  A list of requirements.
@@ -43,5 +46,5 @@ class FacetsIntegration(Integration):
43
46
  from zenml.integrations.pandas import PandasIntegration
44
47
 
45
48
  return cls.REQUIREMENTS + \
46
- PandasIntegration.get_requirements(target_os=target_os)
49
+ PandasIntegration.get_requirements(target_os=target_os, python_version=python_version)
47
50
 
@@ -46,11 +46,13 @@ class FeastIntegration(Integration):
46
46
  return [FeastFeatureStoreFlavor]
47
47
 
48
48
  @classmethod
49
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
49
+ def get_requirements(cls, target_os: Optional[str] = None, python_version: Optional[str] = None
50
+ ) -> List[str]:
50
51
  """Method to get the requirements for the integration.
51
52
 
52
53
  Args:
53
54
  target_os: The target operating system to get the requirements for.
55
+ python_version: The Python version to use for the requirements.
54
56
 
55
57
  Returns:
56
58
  A list of requirements.
@@ -58,5 +60,5 @@ class FeastIntegration(Integration):
58
60
  from zenml.integrations.pandas import PandasIntegration
59
61
 
60
62
  return cls.REQUIREMENTS + \
61
- PandasIntegration.get_requirements(target_os=target_os)
63
+ PandasIntegration.get_requirements(target_os=target_os, python_version=python_version)
62
64
 
@@ -53,11 +53,13 @@ class GreatExpectationsIntegration(Integration):
53
53
  return [GreatExpectationsDataValidatorFlavor]
54
54
 
55
55
  @classmethod
56
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
56
+ def get_requirements(cls, target_os: Optional[str] = None, python_version: Optional[str] = None
57
+ ) -> List[str]:
57
58
  """Method to get the requirements for the integration.
58
59
 
59
60
  Args:
60
61
  target_os: The target operating system to get the requirements for.
62
+ python_version: The Python version to use for the requirements.
61
63
 
62
64
  Returns:
63
65
  A list of requirements.
@@ -65,4 +67,4 @@ class GreatExpectationsIntegration(Integration):
65
67
  from zenml.integrations.pandas import PandasIntegration
66
68
 
67
69
  return cls.REQUIREMENTS + \
68
- PandasIntegration.get_requirements(target_os=target_os)
70
+ PandasIntegration.get_requirements(target_os=target_os, python_version=python_version)
@@ -37,11 +37,13 @@ class HuggingfaceIntegration(Integration):
37
37
  from zenml.integrations.huggingface import services
38
38
 
39
39
  @classmethod
40
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
40
+ def get_requirements(cls, target_os: Optional[str] = None, python_version: Optional[str] = None
41
+ ) -> List[str]:
41
42
  """Defines platform specific requirements for the integration.
42
43
 
43
44
  Args:
44
45
  target_os: The target operating system.
46
+ python_version: The Python version to use for the requirements.
45
47
 
46
48
  Returns:
47
49
  A list of requirements.
@@ -59,7 +61,7 @@ class HuggingfaceIntegration(Integration):
59
61
  from zenml.integrations.pandas import PandasIntegration
60
62
 
61
63
  return requirements + \
62
- PandasIntegration.get_requirements(target_os=target_os)
64
+ PandasIntegration.get_requirements(target_os=target_os, python_version=python_version)
63
65
 
64
66
  @classmethod
65
67
  def flavors(cls) -> List[Type[Flavor]]:
@@ -133,11 +133,16 @@ class Integration(metaclass=IntegrationMeta):
133
133
  return True
134
134
 
135
135
  @classmethod
136
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
136
+ def get_requirements(
137
+ cls,
138
+ target_os: Optional[str] = None,
139
+ python_version: Optional[str] = None,
140
+ ) -> List[str]:
137
141
  """Method to get the requirements for the integration.
138
142
 
139
143
  Args:
140
144
  target_os: The target operating system to get the requirements for.
145
+ python_version: The Python version to use for the requirements.
141
146
 
142
147
  Returns:
143
148
  A list of requirements.
@@ -238,7 +238,7 @@ class KubernetesOrchestrator(ContainerizedOrchestrator):
238
238
  )
239
239
  if kubernetes_context != active_context:
240
240
  logger.warning(
241
- f"{msg}the Kubernetes context "
241
+ f"{msg}the Kubernetes context " # nosec
242
242
  f"'{kubernetes_context}' configured for the "
243
243
  f"Kubernetes orchestrator is not the same as the "
244
244
  f"active context in the local Kubernetes "
@@ -13,21 +13,17 @@
13
13
  # permissions and limitations under the License.
14
14
  """Implementation of the Langchain OpenAI embedding materializer."""
15
15
 
16
- import sys
17
- from typing import TYPE_CHECKING, Any, ClassVar, Tuple, Type
16
+ from typing import Any, ClassVar, Tuple, Type
17
+
18
+ from langchain_community.embeddings import (
19
+ OpenAIEmbeddings,
20
+ )
18
21
 
19
22
  from zenml.enums import ArtifactType
20
23
  from zenml.materializers.cloudpickle_materializer import (
21
24
  CloudpickleMaterializer,
22
25
  )
23
26
 
24
- if TYPE_CHECKING and sys.version_info < (3, 8):
25
- OpenAIEmbeddings = Any
26
- else:
27
- from langchain_community.embeddings import (
28
- OpenAIEmbeddings,
29
- )
30
-
31
27
 
32
28
  class LangchainOpenaiEmbeddingMaterializer(CloudpickleMaterializer):
33
29
  """Materializer for Langchain OpenAI Embeddings."""
@@ -13,19 +13,15 @@
13
13
  # permissions and limitations under the License.
14
14
  """Implementation of the langchain vector store materializer."""
15
15
 
16
- import sys
17
- from typing import TYPE_CHECKING, Any, ClassVar, Tuple, Type
16
+ from typing import Any, ClassVar, Tuple, Type
17
+
18
+ from langchain.vectorstores.base import VectorStore
18
19
 
19
20
  from zenml.enums import ArtifactType
20
21
  from zenml.materializers.cloudpickle_materializer import (
21
22
  CloudpickleMaterializer,
22
23
  )
23
24
 
24
- if TYPE_CHECKING and sys.version_info < (3, 8):
25
- VectorStore = Any
26
- else:
27
- from langchain.vectorstores.base import VectorStore
28
-
29
25
 
30
26
  class LangchainVectorStoreMaterializer(CloudpickleMaterializer):
31
27
  """Handle langchain vector store objects."""
@@ -25,12 +25,8 @@
25
25
  # from zenml.metadata.metadata_types import MetadataType
26
26
 
27
27
 
28
- # if TYPE_CHECKING and sys.version_info < (3, 8):
29
- # Document = Any
30
- # LCDocument = Any
31
- # else:
32
- # from langchain.docstore.document import Document as LCDocument
33
- # from llama_index.readers.schema.base import Document
28
+ # from langchain.docstore.document import Document as LCDocument
29
+ # from llama_index.readers.schema.base import Document
34
30
 
35
31
 
36
32
  # class LlamaIndexDocumentMaterializer(LangchainDocumentMaterializer):
@@ -34,13 +34,8 @@
34
34
  # DEFAULT_FILENAME = "index.json"
35
35
  # DEFAULT_FAISS_FILENAME = "faiss_index.json"
36
36
 
37
- # if TYPE_CHECKING and sys.version_info < (3, 8):
38
- # BaseGPTIndex = Any
39
- # GPTFaissIndex = Any
40
- # T = TypeVar("T", bound=Any)
41
- # else:
42
- # from llama_index.indices.base import BaseGPTIndex
43
- # from llama_index.indices.vector_store import GPTFaissIndex
37
+ # from llama_index.indices.base import BaseGPTIndex
38
+ # from llama_index.indices.vector_store import GPTFaissIndex
44
39
 
45
40
  # T = TypeVar("T", bound=BaseGPTIndex[Any])
46
41
 
@@ -16,6 +16,7 @@
16
16
  The MLflow integrations currently enables you to use MLflow tracking as a
17
17
  convenient way to visualize your experiment runs within the MLflow UI.
18
18
  """
19
+ from packaging import version
19
20
  from typing import List, Type, Optional
20
21
 
21
22
  from zenml.integrations.constants import MLFLOW
@@ -45,17 +46,21 @@ class MlflowIntegration(Integration):
45
46
  ]
46
47
 
47
48
  @classmethod
48
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
49
+ def get_requirements(
50
+ cls, target_os: Optional[str] = None, python_version: Optional[str] = None
51
+ ) -> List[str]:
49
52
  """Method to get the requirements for the integration.
50
53
 
51
54
  Args:
52
55
  target_os: The target operating system to get the requirements for.
56
+ python_version: The Python version to use for the requirements.
53
57
 
54
58
  Returns:
55
59
  A list of requirements.
56
60
  """
57
61
  from zenml.integrations.numpy import NumpyIntegration
58
62
  from zenml.integrations.pandas import PandasIntegration
63
+
59
64
 
60
65
  reqs = [
61
66
  "mlflow>=2.1.1,<2.21.0",
@@ -71,7 +76,13 @@ class MlflowIntegration(Integration):
71
76
  # downgrade will not happen.
72
77
  "pydantic>=2.8.0,<2.9.0",
73
78
  ]
74
- if sys.version_info.minor >= 12:
79
+
80
+ if python_version:
81
+ version_minor = version.parse(python_version).minor
82
+ else:
83
+ version_minor = sys.version_info.minor
84
+
85
+ if version_minor >= 12:
75
86
  logger.debug(
76
87
  "The MLflow integration on Python 3.12 and above is not yet "
77
88
  "fully supported: The extra dependencies 'mlserver' and "
@@ -83,8 +94,8 @@ class MlflowIntegration(Integration):
83
94
  "mlserver-mlflow>=1.3.3",
84
95
  ])
85
96
 
86
- reqs.extend(NumpyIntegration.get_requirements(target_os=target_os))
87
- reqs.extend(PandasIntegration.get_requirements(target_os=target_os))
97
+ reqs.extend(NumpyIntegration.get_requirements(target_os=target_os, python_version=python_version))
98
+ reqs.extend(PandasIntegration.get_requirements(target_os=target_os, python_version=python_version))
88
99
  return reqs
89
100
 
90
101
  @classmethod
@@ -53,11 +53,13 @@ class SeldonIntegration(Integration):
53
53
  return [SeldonModelDeployerFlavor]
54
54
 
55
55
  @classmethod
56
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
56
+ def get_requirements(cls, target_os: Optional[str] = None, python_version: Optional[str] = None
57
+ ) -> List[str]:
57
58
  """Method to get the requirements for the integration.
58
59
 
59
60
  Args:
60
61
  target_os: The target operating system to get the requirements for.
62
+ python_version: The Python version to use for the requirements.
61
63
 
62
64
  Returns:
63
65
  A list of requirements.
@@ -65,5 +67,5 @@ class SeldonIntegration(Integration):
65
67
  from zenml.integrations.numpy import NumpyIntegration
66
68
 
67
69
  return cls.REQUIREMENTS + \
68
- NumpyIntegration.get_requirements(target_os=target_os)
70
+ NumpyIntegration.get_requirements(target_os=target_os, python_version=python_version)
69
71
 
@@ -25,11 +25,13 @@ class TensorBoardIntegration(Integration):
25
25
  REQUIREMENTS = []
26
26
 
27
27
  @classmethod
28
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
28
+ def get_requirements(cls, target_os: Optional[str] = None, python_version: Optional[str] = None
29
+ ) -> List[str]:
29
30
  """Defines platform specific requirements for the integration.
30
31
 
31
32
  Args:
32
33
  target_os: The target operating system.
34
+ python_version: The Python version to use for the requirements.
33
35
 
34
36
  Returns:
35
37
  A list of requirements.
@@ -41,11 +41,13 @@ class TensorflowIntegration(Integration):
41
41
  from zenml.integrations.tensorflow import materializers # noqa
42
42
 
43
43
  @classmethod
44
- def get_requirements(cls, target_os: Optional[str] = None) -> List[str]:
44
+ def get_requirements(cls, target_os: Optional[str] = None, python_version: Optional[str] = None
45
+ ) -> List[str]:
45
46
  """Defines platform specific requirements for the integration.
46
47
 
47
48
  Args:
48
49
  target_os: The target operating system.
50
+ python_version: The Python version to use for the requirements.
49
51
 
50
52
  Returns:
51
53
  A list of requirements.
@@ -60,7 +62,6 @@ class TensorflowIntegration(Integration):
60
62
  "tensorflow>=2.12,<2.15",
61
63
  "tensorflow_io>=0.24.0",
62
64
  ]
63
- if sys.version_info.minor == 8:
64
- requirements.append("typing-extensions>=4.6.1")
65
+
65
66
  return requirements
66
67