zenml-nightly 0.74.0.dev20250211__py3-none-any.whl → 0.74.0.dev20250213__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 +1 -1
- zenml/models/v2/core/model_version.py +18 -27
- zenml/pipelines/pipeline_definition.py +9 -3
- zenml/utils/source_utils.py +35 -23
- {zenml_nightly-0.74.0.dev20250211.dist-info → zenml_nightly-0.74.0.dev20250213.dist-info}/METADATA +1 -1
- {zenml_nightly-0.74.0.dev20250211.dist-info → zenml_nightly-0.74.0.dev20250213.dist-info}/RECORD +9 -9
- {zenml_nightly-0.74.0.dev20250211.dist-info → zenml_nightly-0.74.0.dev20250213.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.74.0.dev20250211.dist-info → zenml_nightly-0.74.0.dev20250213.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.74.0.dev20250211.dist-info → zenml_nightly-0.74.0.dev20250213.dist-info}/entry_points.txt +0 -0
zenml/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.74.0.
|
1
|
+
0.74.0.dev20250213
|
@@ -28,7 +28,7 @@ from uuid import UUID
|
|
28
28
|
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr, field_validator
|
29
29
|
|
30
30
|
from zenml.constants import STR_FIELD_MAX_LENGTH, TEXT_FIELD_MAX_LENGTH
|
31
|
-
from zenml.enums import ModelStages
|
31
|
+
from zenml.enums import ArtifactType, ModelStages
|
32
32
|
from zenml.metadata.metadata_types import MetadataType
|
33
33
|
from zenml.models.v2.base.filter import AnyQuery
|
34
34
|
from zenml.models.v2.base.page import Page
|
@@ -426,32 +426,36 @@ class ModelVersionResponse(
|
|
426
426
|
|
427
427
|
def _get_linked_object(
|
428
428
|
self,
|
429
|
-
collection: Dict[str, Dict[str, UUID]],
|
430
429
|
name: str,
|
431
430
|
version: Optional[str] = None,
|
431
|
+
type: Optional[ArtifactType] = None,
|
432
432
|
) -> Optional["ArtifactVersionResponse"]:
|
433
433
|
"""Get the artifact linked to this model version given type.
|
434
434
|
|
435
435
|
Args:
|
436
|
-
collection: The collection to search in (one of
|
437
|
-
self.model_artifact_ids, self.data_artifact_ids,
|
438
|
-
self.deployment_artifact_ids)
|
439
436
|
name: The name of the artifact to retrieve.
|
440
437
|
version: The version of the artifact to retrieve (None for
|
441
438
|
latest/non-versioned)
|
439
|
+
type: The type of the artifact to filter by.
|
442
440
|
|
443
441
|
Returns:
|
444
442
|
Specific version of an artifact from collection or None
|
445
443
|
"""
|
446
444
|
from zenml.client import Client
|
447
445
|
|
448
|
-
|
446
|
+
artifact_versions = Client().list_artifact_versions(
|
447
|
+
sort_by="desc:created",
|
448
|
+
size=1,
|
449
|
+
name=name,
|
450
|
+
version=version,
|
451
|
+
model_version_id=self.id,
|
452
|
+
type=type,
|
453
|
+
hydrate=True,
|
454
|
+
)
|
449
455
|
|
450
|
-
if
|
456
|
+
if not artifact_versions.items:
|
451
457
|
return None
|
452
|
-
|
453
|
-
version = max(collection[name].keys())
|
454
|
-
return client.get_artifact_version(collection[name][version])
|
458
|
+
return artifact_versions.items[0]
|
455
459
|
|
456
460
|
def get_artifact(
|
457
461
|
self,
|
@@ -468,12 +472,7 @@ class ModelVersionResponse(
|
|
468
472
|
Returns:
|
469
473
|
Specific version of an artifact or None
|
470
474
|
"""
|
471
|
-
|
472
|
-
**self.model_artifact_ids,
|
473
|
-
**self.data_artifact_ids,
|
474
|
-
**self.deployment_artifact_ids,
|
475
|
-
}
|
476
|
-
return self._get_linked_object(all_artifact_ids, name, version)
|
475
|
+
return self._get_linked_object(name, version)
|
477
476
|
|
478
477
|
def get_model_artifact(
|
479
478
|
self,
|
@@ -490,7 +489,7 @@ class ModelVersionResponse(
|
|
490
489
|
Returns:
|
491
490
|
Specific version of the model artifact or None
|
492
491
|
"""
|
493
|
-
return self._get_linked_object(
|
492
|
+
return self._get_linked_object(name, version, ArtifactType.MODEL)
|
494
493
|
|
495
494
|
def get_data_artifact(
|
496
495
|
self,
|
@@ -507,11 +506,7 @@ class ModelVersionResponse(
|
|
507
506
|
Returns:
|
508
507
|
Specific version of the data artifact or None
|
509
508
|
"""
|
510
|
-
return self._get_linked_object(
|
511
|
-
self.data_artifact_ids,
|
512
|
-
name,
|
513
|
-
version,
|
514
|
-
)
|
509
|
+
return self._get_linked_object(name, version, ArtifactType.DATA)
|
515
510
|
|
516
511
|
def get_deployment_artifact(
|
517
512
|
self,
|
@@ -528,11 +523,7 @@ class ModelVersionResponse(
|
|
528
523
|
Returns:
|
529
524
|
Specific version of the deployment artifact or None
|
530
525
|
"""
|
531
|
-
return self._get_linked_object(
|
532
|
-
self.deployment_artifact_ids,
|
533
|
-
name,
|
534
|
-
version,
|
535
|
-
)
|
526
|
+
return self._get_linked_object(name, version, ArtifactType.SERVICE)
|
536
527
|
|
537
528
|
def get_pipeline_run(self, name: str) -> "PipelineRunResponse":
|
538
529
|
"""Get pipeline run linked to this version.
|
@@ -757,10 +757,16 @@ To avoid this consider setting pipeline parameters only in one place (config or
|
|
757
757
|
build=build_model,
|
758
758
|
can_download_from_code_repository=can_download_from_code_repository,
|
759
759
|
):
|
760
|
-
|
761
|
-
|
760
|
+
source_root = source_utils.get_source_root()
|
761
|
+
code_archive = code_utils.CodeArchive(root=source_root)
|
762
|
+
logger.info(
|
763
|
+
"Archiving pipeline code directory: `%s`. If this is taking "
|
764
|
+
"longer than you expected, make sure your source root "
|
765
|
+
"is set correctly by running `zenml init`, and that it "
|
766
|
+
"does not contain unnecessarily huge files.",
|
767
|
+
source_root,
|
762
768
|
)
|
763
|
-
|
769
|
+
|
764
770
|
code_path = code_utils.upload_code_if_necessary(code_archive)
|
765
771
|
|
766
772
|
request = PipelineDeploymentRequest(
|
zenml/utils/source_utils.py
CHANGED
@@ -275,6 +275,35 @@ def resolve(
|
|
275
275
|
)
|
276
276
|
|
277
277
|
|
278
|
+
def get_implicit_source_root() -> str:
|
279
|
+
"""Get the implicit source root (the parent directory of the main module).
|
280
|
+
|
281
|
+
Raises:
|
282
|
+
RuntimeError: If the main module file can't be found.
|
283
|
+
|
284
|
+
Returns:
|
285
|
+
The implicit source root.
|
286
|
+
"""
|
287
|
+
main_module = sys.modules.get("__main__")
|
288
|
+
if main_module is None:
|
289
|
+
raise RuntimeError(
|
290
|
+
"Unable to determine source root because the main module could not "
|
291
|
+
"be found."
|
292
|
+
)
|
293
|
+
|
294
|
+
if not hasattr(main_module, "__file__") or not main_module.__file__:
|
295
|
+
raise RuntimeError(
|
296
|
+
"Unable to determine source root because the main module does not "
|
297
|
+
"have an associated file. This could be because you're running in "
|
298
|
+
"an interactive Python environment. If you are trying to run from "
|
299
|
+
"within a Jupyter notebook, please run `zenml init` from the root "
|
300
|
+
"where your notebook is located and restart your notebook server."
|
301
|
+
)
|
302
|
+
|
303
|
+
path = Path(main_module.__file__).resolve().parent
|
304
|
+
return str(path)
|
305
|
+
|
306
|
+
|
278
307
|
def get_source_root() -> str:
|
279
308
|
"""Get the source root.
|
280
309
|
|
@@ -286,9 +315,6 @@ def get_source_root() -> str:
|
|
286
315
|
|
287
316
|
Returns:
|
288
317
|
The source root.
|
289
|
-
|
290
|
-
Raises:
|
291
|
-
RuntimeError: If the main module file can't be found.
|
292
318
|
"""
|
293
319
|
if _CUSTOM_SOURCE_ROOT:
|
294
320
|
logger.debug("Using custom source root: %s", _CUSTOM_SOURCE_ROOT)
|
@@ -301,26 +327,12 @@ def get_source_root() -> str:
|
|
301
327
|
logger.debug("Using repository root as source root: %s", repo_root)
|
302
328
|
return str(repo_root.resolve())
|
303
329
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
if not hasattr(main_module, "__file__") or not main_module.__file__:
|
312
|
-
raise RuntimeError(
|
313
|
-
"Unable to determine source root because the main module does not "
|
314
|
-
"have an associated file. This could be because you're running in "
|
315
|
-
"an interactive Python environment. If you are trying to run from "
|
316
|
-
"within a Jupyter notebook, please run `zenml init` from the root "
|
317
|
-
"where your notebook is located and restart your notebook server. "
|
318
|
-
)
|
319
|
-
|
320
|
-
path = Path(main_module.__file__).resolve().parent
|
321
|
-
|
322
|
-
logger.debug("Using main module parent directory as source root: %s", path)
|
323
|
-
return str(path)
|
330
|
+
implicit_source_root = get_implicit_source_root()
|
331
|
+
logger.debug(
|
332
|
+
"Using main module parent directory as source root: %s",
|
333
|
+
implicit_source_root,
|
334
|
+
)
|
335
|
+
return implicit_source_root
|
324
336
|
|
325
337
|
|
326
338
|
def set_custom_source_root(source_root: Optional[str]) -> None:
|
{zenml_nightly-0.74.0.dev20250211.dist-info → zenml_nightly-0.74.0.dev20250213.dist-info}/RECORD
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
zenml/README.md,sha256=827dekbOWAs1BpW7VF1a4d7EbwPbjwccX-2zdXBENZo,1777
|
2
|
-
zenml/VERSION,sha256=
|
2
|
+
zenml/VERSION,sha256=m5UFAlfM2bHdwaLw8Ttt42SvpS5yV6jrrfa_bMCNvyA,19
|
3
3
|
zenml/__init__.py,sha256=SkMObQA41ajqdZqGErN00S1Vf3KAxpLvbZ-OBy5uYoo,2130
|
4
4
|
zenml/actions/__init__.py,sha256=mrt6wPo73iKRxK754_NqsGyJ3buW7RnVeIGXr1xEw8Y,681
|
5
5
|
zenml/actions/base_action.py,sha256=UcaHev6BTuLDwuswnyaPjdA8AgUqB5xPZ-lRtuvf2FU,25553
|
@@ -639,7 +639,7 @@ zenml/models/v2/core/event_source_flavor.py,sha256=TgrGkypnJUutMvvHE7Y9MbUiEeNXZ
|
|
639
639
|
zenml/models/v2/core/flavor.py,sha256=tcn2GDbkOyYjXTor_7_kR7FuLwcXjlfzvAV2rU1NVM4,12806
|
640
640
|
zenml/models/v2/core/logs.py,sha256=UhaPOTJD7IFKH8YozsaVgXYNNDHre8amheIm5JMZYQU,5824
|
641
641
|
zenml/models/v2/core/model.py,sha256=yok73T2D4hzYGP0nhDs5mq-1LKA9iol_k5DQyCVwf1o,11918
|
642
|
-
zenml/models/v2/core/model_version.py,sha256=
|
642
|
+
zenml/models/v2/core/model_version.py,sha256=fkERxxFR_08LosUdbPF5hIeoz0n4C0703f5k_KE9mxQ,20807
|
643
643
|
zenml/models/v2/core/model_version_artifact.py,sha256=ZyupuEsfPSjgaHDIUOojwJepJt1LTXDoUyE2h9htB_s,9086
|
644
644
|
zenml/models/v2/core/model_version_pipeline_run.py,sha256=JbPZZEQvOK9I32htkWdAONy7gvtoz_Jo45B5gYrh2vs,7036
|
645
645
|
zenml/models/v2/core/pipeline.py,sha256=cql05iz2jqrlyRfn3jB4iQ_AgpHapD6Sr5Kd_6Q1W30,12044
|
@@ -695,7 +695,7 @@ zenml/pipelines/__init__.py,sha256=hpIX7hN8jsQRHT5R-xSXZL88qrHwkmrvGLQeu1rWt4o,8
|
|
695
695
|
zenml/pipelines/build_utils.py,sha256=DkID1YnRYkw569uU-gidpF8WR8E7K55_wn3CzRPQ3Cs,27562
|
696
696
|
zenml/pipelines/pipeline_context.py,sha256=V_p-F9W7cBIlTjS0iv5-uJYMzaOj8bAUkc_uNhQgBms,3579
|
697
697
|
zenml/pipelines/pipeline_decorator.py,sha256=FIbflYOMavbuyGmqsx3F5zZgg0oXMTi1eAcGXciljOs,4293
|
698
|
-
zenml/pipelines/pipeline_definition.py,sha256=
|
698
|
+
zenml/pipelines/pipeline_definition.py,sha256=pl5tV4_h03MQDaIJZQCJJ8mY5S3Js-89r5NFIBpxB6A,57244
|
699
699
|
zenml/pipelines/run_utils.py,sha256=4KuHIQFtLXTZNQBScTEkIG5pqNtu6xGm6UZT7ptyyKs,11623
|
700
700
|
zenml/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
701
701
|
zenml/plugins/base_plugin_flavor.py,sha256=88IxFW91UB_rQ8xPlfRnIhIJh7A308NEq2epMMdlOng,2530
|
@@ -787,7 +787,7 @@ zenml/utils/secret_utils.py,sha256=gEvqnhzAZwPO6mdOQWvioeH-xLoSObfaNRzt17N8zyU,5
|
|
787
787
|
zenml/utils/settings_utils.py,sha256=lAK13CiDCDkcLygizDbWB9q-9ukteVBJPypzFCrne9k,4631
|
788
788
|
zenml/utils/singleton.py,sha256=uFRrUlUdS5VyY9lLJyl_n5kqppsqJLKkBhSj4g5VPkY,2757
|
789
789
|
zenml/utils/source_code_utils.py,sha256=8iyNA2MGIORYVEkSdxNTXfS1ZdFKXTAG1dZRkeQtPL0,3751
|
790
|
-
zenml/utils/source_utils.py,sha256=
|
790
|
+
zenml/utils/source_utils.py,sha256=joKLghhDq9dh0fd8B0WRGX-nN-uwnGQdgmsyY_n-8gY,27033
|
791
791
|
zenml/utils/string_utils.py,sha256=VPuAwFzxwXXo1cKmBWxHnoeTyDX35XPf_lXGiDMXPEw,7254
|
792
792
|
zenml/utils/time_utils.py,sha256=-9Y9zwJ-6Gv7hoZQCoftPyC2LCLo2bYj6OgdyBaE44o,4076
|
793
793
|
zenml/utils/typed_model.py,sha256=00EAo1I1VnOBHG4-ce8dPkyHRPpgi67SRIU-KdewRWs,4757
|
@@ -1280,8 +1280,8 @@ zenml/zen_stores/secrets_stores/sql_secrets_store.py,sha256=nEO0bAPlULBLxLVk-UTR
|
|
1280
1280
|
zenml/zen_stores/sql_zen_store.py,sha256=tKOghX2Wa0f0xSYu_ReqHgCwslvHrBhE3RePJG2tcA0,415921
|
1281
1281
|
zenml/zen_stores/template_utils.py,sha256=EKYBgmDLTS_PSMWaIO5yvHPLiQvMqHcsAe6NUCrv-i4,9068
|
1282
1282
|
zenml/zen_stores/zen_store_interface.py,sha256=vf2gKBWfUUPtcGZC35oQB6pPNVzWVyQC8nWxVLjfrxM,92692
|
1283
|
-
zenml_nightly-0.74.0.
|
1284
|
-
zenml_nightly-0.74.0.
|
1285
|
-
zenml_nightly-0.74.0.
|
1286
|
-
zenml_nightly-0.74.0.
|
1287
|
-
zenml_nightly-0.74.0.
|
1283
|
+
zenml_nightly-0.74.0.dev20250213.dist-info/LICENSE,sha256=wbnfEnXnafPbqwANHkV6LUsPKOtdpsd-SNw37rogLtc,11359
|
1284
|
+
zenml_nightly-0.74.0.dev20250213.dist-info/METADATA,sha256=FfHRQAkvQcU-SpjOdUwnsKp1KURqE1eBLVm5L6Pd67M,21430
|
1285
|
+
zenml_nightly-0.74.0.dev20250213.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
1286
|
+
zenml_nightly-0.74.0.dev20250213.dist-info/entry_points.txt,sha256=QK3ETQE0YswAM2mWypNMOv8TLtr7EjnqAFq1br_jEFE,43
|
1287
|
+
zenml_nightly-0.74.0.dev20250213.dist-info/RECORD,,
|
{zenml_nightly-0.74.0.dev20250211.dist-info → zenml_nightly-0.74.0.dev20250213.dist-info}/LICENSE
RENAMED
File without changes
|
{zenml_nightly-0.74.0.dev20250211.dist-info → zenml_nightly-0.74.0.dev20250213.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|