zenml-nightly 0.80.1.dev20250406__py3-none-any.whl → 0.80.1.dev20250408__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.80.1.dev20250406
1
+ 0.80.1.dev20250408
zenml/cli/base.py CHANGED
@@ -87,7 +87,7 @@ ZENML_PROJECT_TEMPLATES = dict(
87
87
  ),
88
88
  nlp=ZenMLProjectTemplateLocation(
89
89
  github_url="zenml-io/template-nlp",
90
- github_tag="2025.01.08", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
90
+ github_tag="2025.04.07", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
91
91
  ),
92
92
  llm_finetuning=ZenMLProjectTemplateLocation(
93
93
  github_url="zenml-io/template-llm-finetuning",
@@ -11,7 +11,14 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12
12
  # or implied. See the License for the specific language governing
13
13
  # permissions and limitations under the License.
14
- """Materializer for Pandas."""
14
+ """Materializer for Pandas.
15
+
16
+ This materializer handles pandas DataFrame and Series objects.
17
+
18
+ Environment Variables:
19
+ ZENML_PANDAS_SAMPLE_ROWS: Controls the number of sample rows to include in
20
+ visualizations. Defaults to 10 if not set.
21
+ """
15
22
 
16
23
  import os
17
24
  from typing import Any, ClassVar, Dict, Optional, Tuple, Type, Union
@@ -31,6 +38,9 @@ COMPRESSION_TYPE = "gzip"
31
38
 
32
39
  CSV_FILENAME = "df.csv"
33
40
 
41
+ # Default number of sample rows to display in visualizations
42
+ DEFAULT_SAMPLE_ROWS = 10
43
+
34
44
 
35
45
  class PandasMaterializer(BaseMaterializer):
36
46
  """Materializer to read data to and from pandas."""
@@ -142,17 +152,46 @@ class PandasMaterializer(BaseMaterializer):
142
152
  ) -> Dict[str, VisualizationType]:
143
153
  """Save visualizations of the given pandas dataframe or series.
144
154
 
155
+ Creates two visualizations:
156
+ 1. A statistical description of the data (using df.describe())
157
+ 2. A sample of the data (first N rows controlled by ZENML_PANDAS_SAMPLE_ROWS)
158
+
159
+ Note:
160
+ The number of sample rows shown can be controlled with the
161
+ ZENML_PANDAS_SAMPLE_ROWS environment variable.
162
+
145
163
  Args:
146
164
  df: The pandas dataframe or series to visualize.
147
165
 
148
166
  Returns:
149
167
  A dictionary of visualization URIs and their types.
150
168
  """
169
+ visualizations = {}
151
170
  describe_uri = os.path.join(self.uri, "describe.csv")
152
171
  describe_uri = describe_uri.replace("\\", "/")
153
172
  with self.artifact_store.open(describe_uri, mode="wb") as f:
154
173
  df.describe().to_csv(f)
155
- return {describe_uri: VisualizationType.CSV}
174
+ visualizations[describe_uri] = VisualizationType.CSV
175
+
176
+ # Get the number of sample rows from environment variable or use default
177
+ sample_rows = int(
178
+ os.environ.get("ZENML_PANDAS_SAMPLE_ROWS", DEFAULT_SAMPLE_ROWS)
179
+ )
180
+
181
+ # Add our sample visualization (with configurable number of rows)
182
+ if isinstance(df, pd.Series):
183
+ sample_df = df.head(sample_rows).to_frame()
184
+ else:
185
+ sample_df = df.head(sample_rows)
186
+
187
+ sample_uri = os.path.join(self.uri, "sample.csv")
188
+ sample_uri = sample_uri.replace("\\", "/")
189
+ with self.artifact_store.open(sample_uri, mode="wb") as f:
190
+ sample_df.to_csv(f)
191
+
192
+ visualizations[sample_uri] = VisualizationType.CSV
193
+
194
+ return visualizations
156
195
 
157
196
  def extract_metadata(
158
197
  self, df: Union[pd.DataFrame, pd.Series]
zenml/steps/base_step.py CHANGED
@@ -605,9 +605,9 @@ class BaseStep:
605
605
  on_failure: Optional["HookSpecification"] = None,
606
606
  on_success: Optional["HookSpecification"] = None,
607
607
  model: Optional["Model"] = None,
608
- merge: bool = True,
609
608
  retry: Optional[StepRetryConfig] = None,
610
609
  substitutions: Optional[Dict[str, str]] = None,
610
+ merge: bool = True,
611
611
  ) -> T:
612
612
  """Configures the step.
613
613
 
@@ -643,14 +643,14 @@ class BaseStep:
643
643
  on_success: Callback function in event of success of the step. Can
644
644
  be a function with no arguments, or a source path to such a
645
645
  function (e.g. `module.my_function`).
646
- model: configuration of the model version in the Model Control Plane.
646
+ model: Model to use for this step.
647
+ retry: Configuration for retrying the step in case of failure.
648
+ substitutions: Extra placeholders to use in the name template.
647
649
  merge: If `True`, will merge the given dictionary configurations
648
650
  like `parameters` and `settings` with existing
649
651
  configurations. If `False` the given configurations will
650
652
  overwrite all existing ones. See the general description of this
651
653
  method for an example.
652
- retry: Configuration for retrying the step in case of failure.
653
- substitutions: Extra placeholders to use in the name template.
654
654
 
655
655
  Returns:
656
656
  The step instance that this method was called on.
@@ -739,8 +739,9 @@ class BaseStep:
739
739
  on_failure: Optional["HookSpecification"] = None,
740
740
  on_success: Optional["HookSpecification"] = None,
741
741
  model: Optional["Model"] = None,
742
- merge: bool = True,
742
+ retry: Optional[StepRetryConfig] = None,
743
743
  substitutions: Optional[Dict[str, str]] = None,
744
+ merge: bool = True,
744
745
  ) -> "BaseStep":
745
746
  """Copies the step and applies the given configurations.
746
747
 
@@ -766,13 +767,14 @@ class BaseStep:
766
767
  on_success: Callback function in event of success of the step. Can
767
768
  be a function with no arguments, or a source path to such a
768
769
  function (e.g. `module.my_function`).
769
- model: configuration of the model version in the Model Control Plane.
770
+ model: Model to use for this step.
771
+ retry: Configuration for retrying the step in case of failure.
772
+ substitutions: Extra placeholders for the step name.
770
773
  merge: If `True`, will merge the given dictionary configurations
771
774
  like `parameters` and `settings` with existing
772
775
  configurations. If `False` the given configurations will
773
776
  overwrite all existing ones. See the general description of this
774
777
  method for an example.
775
- substitutions: Extra placeholders for the step name.
776
778
 
777
779
  Returns:
778
780
  The copied step instance.
@@ -792,8 +794,9 @@ class BaseStep:
792
794
  on_failure=on_failure,
793
795
  on_success=on_success,
794
796
  model=model,
795
- merge=merge,
797
+ retry=retry,
796
798
  substitutions=substitutions,
799
+ merge=merge,
797
800
  )
798
801
  return step_copy
799
802
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: zenml-nightly
3
- Version: 0.80.1.dev20250406
3
+ Version: 0.80.1.dev20250408
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=KuyoP-WHB8ddgval-dbAACiDnw8X8wzYrSePLpENp_s,19
2
+ zenml/VERSION,sha256=oVqESuv_o9HBKEM8DUu3iGZNlGLFijzeuFz_Z6i1OQI,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
@@ -30,7 +30,7 @@ zenml/cli/__init__.py,sha256=gRXpnqHtz0lqgpiH_Yb82J1sXsAVNHd1GxDPiH7_ZbI,75666
30
30
  zenml/cli/annotator.py,sha256=JRR7_TJOWKyiKGv1kwSjG1Ay6RBWPVgm0X-D0uSBlyE,6976
31
31
  zenml/cli/artifact.py,sha256=7lsAS52DroBTFkFWxkyb-lIDOGP5jPL_Se_RDG_2jgg,9564
32
32
  zenml/cli/authorized_device.py,sha256=_1PzE3BM2SmwtuzRliEMStvbBRKWQmg_lbwCRtn8dBg,4324
33
- zenml/cli/base.py,sha256=5RRg3h1BMFOaDHA42irLjROnosdSQZ1s0lvCtk3fjLs,28240
33
+ zenml/cli/base.py,sha256=zSc4a2wFuF_3cjtYodrbls0wuOtau7YTrWGKG3jus5s,28240
34
34
  zenml/cli/cli.py,sha256=Pnq468IZ4oqzluA_gZ5PsrdnSPEyHcasIH-xI1_8Y_Q,5454
35
35
  zenml/cli/code_repository.py,sha256=6T3Hgv0vxNGhZ4Lb5TDw8t0Ihzv0qQS6ojFoflQ2de8,9446
36
36
  zenml/cli/config.py,sha256=UI_j0a_zRgEUd2q0zuOi4UgbjiCYjMJ_Y9iSg-wi8Oo,2768
@@ -419,7 +419,7 @@ zenml/integrations/openai/hooks/__init__.py,sha256=8VfiVOyIrjya9G_VK5GPEqq9G5i9w
419
419
  zenml/integrations/openai/hooks/open_ai_failure_hook.py,sha256=tQe-dUO7_w24ABfN96TZ7Zc2inJMI5u9sdE8gBxrDyM,4702
420
420
  zenml/integrations/pandas/__init__.py,sha256=KSkBrivgMU-1iQJVNYSmlD66Zyll4yiuXlMYbxwwJCE,1074
421
421
  zenml/integrations/pandas/materializers/__init__.py,sha256=LcN6iO4vZKTMFp1eRF5njIu-UwqMsonms3T4ObFTtbk,770
422
- zenml/integrations/pandas/materializers/pandas_materializer.py,sha256=kr4kVLluvytiqvYMS8JtwmcGQW6cMJxnsSbX1XMKo6c,7077
422
+ zenml/integrations/pandas/materializers/pandas_materializer.py,sha256=lELAptsOVgFeQg1X2FIjIwQqqRWsLBM8siNz2xYDIsU,8481
423
423
  zenml/integrations/pigeon/__init__.py,sha256=JrCvQIGooxBpawkDdRmzd0rcm3hDWw6neYkKoTdycZI,1392
424
424
  zenml/integrations/pigeon/annotators/__init__.py,sha256=Bw0EwrHw1-TdqYLnhkQRMajO6yd5iVHYeT1FBuWG0Q4,793
425
425
  zenml/integrations/pigeon/annotators/pigeon_annotator.py,sha256=yloKFdInhA16haQ0e0JKC6pGVW9XfDmtzoMHnWCoBaI,11273
@@ -749,7 +749,7 @@ zenml/step_operators/__init__.py,sha256=tqj7fgnQyZubLjwUu4ITwkA-70KMQz4g37agbfF7
749
749
  zenml/step_operators/base_step_operator.py,sha256=ZRnY6lcEHY8xZskrKKdPhgKg2BlEoh2_kb8xCaM2D1g,3522
750
750
  zenml/step_operators/step_operator_entrypoint_configuration.py,sha256=WoNO-fXukVnPph1J2v-ZRe2AwRzfBLjDKntL7gNOC10,3693
751
751
  zenml/steps/__init__.py,sha256=KKWFOmCZGLDEikOD2E5YmDA7QHo47uPV37by21WwI0U,1453
752
- zenml/steps/base_step.py,sha256=lnggh2f8bl5WllKPLe2ksK69ww2w3IquAuG12hC8lsY,44233
752
+ zenml/steps/base_step.py,sha256=qzW9I99PWK8brm3wdV1NEuUxGFlMvrmqNh3YjNKUkgg,44312
753
753
  zenml/steps/decorated_step.py,sha256=C8Ng5PCLc9eql4JF1N345HQ6LyC1qCUdTnysUTeoAJs,1315
754
754
  zenml/steps/entrypoint_function_utils.py,sha256=AuBIKqcquuvSTNhvuavtSuPdzzEfdOa3_h3mt7twfrA,9577
755
755
  zenml/steps/step_context.py,sha256=TMeVtcopVA8VwwVoAATzKx8E83F3Bu1kX40bpdn9bzw,15518
@@ -1310,8 +1310,8 @@ zenml/zen_stores/secrets_stores/sql_secrets_store.py,sha256=nEO0bAPlULBLxLVk-UTR
1310
1310
  zenml/zen_stores/sql_zen_store.py,sha256=ldyC1uhMnmX5ojnqY9d_L2S-iC-eaNUwsexTkdPtqr4,440204
1311
1311
  zenml/zen_stores/template_utils.py,sha256=GWBP5QEOyvhzndS_MLPmvh28sQaOPpPoZFXCIX9CRL4,9065
1312
1312
  zenml/zen_stores/zen_store_interface.py,sha256=fF_uL_FplnvGvM5o3jOQ8i1zHXhuhKLL2n4nvIKSR7E,92090
1313
- zenml_nightly-0.80.1.dev20250406.dist-info/LICENSE,sha256=wbnfEnXnafPbqwANHkV6LUsPKOtdpsd-SNw37rogLtc,11359
1314
- zenml_nightly-0.80.1.dev20250406.dist-info/METADATA,sha256=IWOoMhxmhxpm2uVRNGjUlMxKXw3UmktNY81LMT1jPIQ,24230
1315
- zenml_nightly-0.80.1.dev20250406.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
1316
- zenml_nightly-0.80.1.dev20250406.dist-info/entry_points.txt,sha256=QK3ETQE0YswAM2mWypNMOv8TLtr7EjnqAFq1br_jEFE,43
1317
- zenml_nightly-0.80.1.dev20250406.dist-info/RECORD,,
1313
+ zenml_nightly-0.80.1.dev20250408.dist-info/LICENSE,sha256=wbnfEnXnafPbqwANHkV6LUsPKOtdpsd-SNw37rogLtc,11359
1314
+ zenml_nightly-0.80.1.dev20250408.dist-info/METADATA,sha256=ipOMfTkT6faA2RENllwcFbruDdAYc-_GAl_Wch6ldeg,24230
1315
+ zenml_nightly-0.80.1.dev20250408.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
1316
+ zenml_nightly-0.80.1.dev20250408.dist-info/entry_points.txt,sha256=QK3ETQE0YswAM2mWypNMOv8TLtr7EjnqAFq1br_jEFE,43
1317
+ zenml_nightly-0.80.1.dev20250408.dist-info/RECORD,,