nextmv 1.0.0.dev8__py3-none-any.whl → 1.0.0.dev10__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 (54) hide show
  1. nextmv/__about__.py +1 -1
  2. nextmv/_serialization.py +1 -1
  3. nextmv/cli/CONTRIBUTING.md +31 -11
  4. nextmv/cli/cloud/acceptance/create.py +12 -12
  5. nextmv/cli/cloud/acceptance/delete.py +1 -4
  6. nextmv/cli/cloud/account/delete.py +1 -1
  7. nextmv/cli/cloud/app/delete.py +1 -1
  8. nextmv/cli/cloud/app/push.py +23 -42
  9. nextmv/cli/cloud/batch/delete.py +1 -4
  10. nextmv/cli/cloud/ensemble/delete.py +1 -4
  11. nextmv/cli/cloud/input_set/__init__.py +2 -0
  12. nextmv/cli/cloud/input_set/delete.py +64 -0
  13. nextmv/cli/cloud/instance/delete.py +1 -1
  14. nextmv/cli/cloud/managed_input/delete.py +1 -1
  15. nextmv/cli/cloud/run/create.py +4 -9
  16. nextmv/cli/cloud/scenario/delete.py +1 -4
  17. nextmv/cli/cloud/secrets/delete.py +1 -4
  18. nextmv/cli/cloud/shadow/delete.py +1 -4
  19. nextmv/cli/cloud/shadow/stop.py +14 -2
  20. nextmv/cli/cloud/switchback/delete.py +1 -4
  21. nextmv/cli/cloud/switchback/stop.py +14 -2
  22. nextmv/cli/cloud/version/delete.py +1 -1
  23. nextmv/cli/community/clone.py +11 -197
  24. nextmv/cli/community/list.py +51 -116
  25. nextmv/cli/configuration/create.py +4 -4
  26. nextmv/cli/configuration/delete.py +1 -1
  27. nextmv/cli/main.py +2 -3
  28. nextmv/cli/message.py +71 -54
  29. nextmv/cloud/__init__.py +4 -0
  30. nextmv/cloud/application/__init__.py +1 -200
  31. nextmv/cloud/application/_acceptance.py +13 -8
  32. nextmv/cloud/application/_input_set.py +42 -6
  33. nextmv/cloud/application/_run.py +1 -8
  34. nextmv/cloud/application/_shadow.py +9 -3
  35. nextmv/cloud/application/_switchback.py +11 -2
  36. nextmv/cloud/batch_experiment.py +3 -1
  37. nextmv/cloud/client.py +1 -1
  38. nextmv/cloud/community.py +446 -0
  39. nextmv/cloud/integration.py +7 -4
  40. nextmv/cloud/shadow.py +25 -0
  41. nextmv/cloud/switchback.py +2 -0
  42. nextmv/default_app/main.py +6 -4
  43. nextmv/local/executor.py +3 -83
  44. nextmv/local/geojson_handler.py +1 -1
  45. nextmv/manifest.py +7 -11
  46. nextmv/model.py +52 -13
  47. nextmv/options.py +1 -1
  48. nextmv/output.py +21 -57
  49. nextmv/run.py +3 -12
  50. {nextmv-1.0.0.dev8.dist-info → nextmv-1.0.0.dev10.dist-info}/METADATA +5 -4
  51. {nextmv-1.0.0.dev8.dist-info → nextmv-1.0.0.dev10.dist-info}/RECORD +54 -52
  52. {nextmv-1.0.0.dev8.dist-info → nextmv-1.0.0.dev10.dist-info}/WHEEL +0 -0
  53. {nextmv-1.0.0.dev8.dist-info → nextmv-1.0.0.dev10.dist-info}/entry_points.txt +0 -0
  54. {nextmv-1.0.0.dev8.dist-info → nextmv-1.0.0.dev10.dist-info}/licenses/LICENSE +0 -0
nextmv/local/executor.py CHANGED
@@ -22,8 +22,6 @@ process_run_information
22
22
  Function to update run metadata including duration and status.
23
23
  process_run_logs
24
24
  Function to process and save run logs.
25
- process_run_metrics
26
- Function to process and save run metrics.
27
25
  process_run_statistics
28
26
  Function to process and save run statistics.
29
27
  process_run_assets
@@ -59,16 +57,7 @@ from nextmv.local.local import (
59
57
  )
60
58
  from nextmv.local.plotly_handler import handle_plotly_visual
61
59
  from nextmv.manifest import Manifest, ManifestType
62
- from nextmv.output import (
63
- ASSETS_KEY,
64
- METRICS_KEY,
65
- OUTPUTS_KEY,
66
- SOLUTIONS_KEY,
67
- STATISTICS_KEY,
68
- Asset,
69
- OutputFormat,
70
- VisualSchema,
71
- )
60
+ from nextmv.output import ASSETS_KEY, OUTPUTS_KEY, SOLUTIONS_KEY, STATISTICS_KEY, Asset, OutputFormat, VisualSchema
72
61
  from nextmv.status import StatusV2
73
62
 
74
63
 
@@ -316,7 +305,7 @@ def process_run_output(
316
305
  ) -> None:
317
306
  """
318
307
  Processes the result of the subprocess run. This function is in charge of
319
- handling the run results, including solutions, statistics, metrics, logs, assets,
308
+ handling the run results, including solutions, statistics, logs, assets,
320
309
  and visuals.
321
310
 
322
311
  Parameters
@@ -358,13 +347,6 @@ def process_run_output(
358
347
  result=result,
359
348
  stdout_output=stdout_output,
360
349
  )
361
- process_run_metrics(
362
- temp_run_outputs_dir=temp_run_outputs_dir,
363
- outputs_dir=outputs_dir,
364
- stdout_output=stdout_output,
365
- temp_src=temp_src,
366
- manifest=manifest,
367
- )
368
350
  process_run_statistics(
369
351
  temp_run_outputs_dir=temp_run_outputs_dir,
370
352
  outputs_dir=outputs_dir,
@@ -517,65 +499,6 @@ def process_run_logs(
517
499
 
518
500
  f.write(std_err)
519
501
 
520
- def process_run_metrics(
521
- temp_run_outputs_dir: str,
522
- outputs_dir: str,
523
- stdout_output: str | dict[str, Any],
524
- temp_src: str,
525
- manifest: Manifest,
526
- ) -> None:
527
- """
528
- Processes the metrics of the run. Checks for an outputs/metrics folder
529
- or custom metrics file location from manifest. If found, copies to run
530
- directory. Otherwise, attempts to extract metrics from stdout.
531
-
532
- Parameters
533
- ----------
534
- temp_run_outputs_dir : str
535
- The path to the temporary outputs directory.
536
- outputs_dir : str
537
- The path to the outputs directory in the run directory.
538
- stdout_output : Union[str, dict[str, Any]]
539
- The stdout output of the run, either as raw string or parsed dictionary.
540
- temp_src : str
541
- The path to the temporary source directory.
542
- manifest : Manifest
543
- The application manifest containing configuration and custom paths.
544
- """
545
-
546
- metrics_dst = os.path.join(outputs_dir, METRICS_KEY)
547
- os.makedirs(metrics_dst, exist_ok=True)
548
- metrics_file = f"{METRICS_KEY}.json"
549
-
550
- # Check for custom location in manifest and override metrics_src if needed.
551
- if (
552
- manifest.configuration is not None
553
- and manifest.configuration.content is not None
554
- and manifest.configuration.content.format == OutputFormat.MULTI_FILE
555
- and manifest.configuration.content.multi_file is not None
556
- ):
557
- metrics_src_file = os.path.join(temp_src, manifest.configuration.content.multi_file.output.metrics)
558
-
559
- # If the custom metrics file exists, copy it to the metrics destination
560
- if os.path.exists(metrics_src_file) and os.path.isfile(metrics_src_file):
561
- metrics_dst_file = os.path.join(metrics_dst, metrics_file)
562
- shutil.copy2(metrics_src_file, metrics_dst_file)
563
- return
564
-
565
- metrics_src = os.path.join(temp_run_outputs_dir, METRICS_KEY)
566
- if os.path.exists(metrics_src) and os.path.isdir(metrics_src):
567
- shutil.copytree(metrics_src, metrics_dst, dirs_exist_ok=True)
568
- return
569
-
570
- if not isinstance(stdout_output, dict):
571
- return
572
-
573
- if METRICS_KEY not in stdout_output:
574
- return
575
-
576
- with open(os.path.join(metrics_dst, metrics_file), "w") as f:
577
- metrics = {METRICS_KEY: stdout_output[METRICS_KEY]}
578
- json.dump(metrics, f, indent=2)
579
502
 
580
503
  def process_run_statistics(
581
504
  temp_run_outputs_dir: str,
@@ -585,9 +508,6 @@ def process_run_statistics(
585
508
  manifest: Manifest,
586
509
  ) -> None:
587
510
  """
588
- !!! warning
589
- `process_run_statistics` is deprecated, use `process_run_metrics` instead.
590
-
591
511
  Processes the statistics of the run. Checks for an outputs/statistics folder
592
512
  or custom statistics file location from manifest. If found, copies to run
593
513
  directory. Otherwise, attempts to extract statistics from stdout.
@@ -928,7 +848,7 @@ def _copy_new_or_modified_files( # noqa: C901
928
848
  This function identifies files that are either new (not present in the original
929
849
  source) or have been modified (different content, checksum, or modification time)
930
850
  compared to the original source. It excludes files that exist in specified
931
- exclusion directories to avoid copying input data, statistics, metrics, or assets as
851
+ exclusion directories to avoid copying input data, statistics, or assets as
932
852
  solution outputs.
933
853
 
934
854
  Parameters
@@ -111,7 +111,7 @@ def extract_coordinates(coords, all_coords) -> None:
111
111
  like Polygons and MultiPolygons
112
112
  """
113
113
  if isinstance(coords, list):
114
- if len(coords) == 2 and isinstance(coords[0], int | float) and isinstance(coords[1], int | float):
114
+ if len(coords) == 2 and isinstance(coords[0], (int, float)) and isinstance(coords[1], (int, float)):
115
115
  # This is a coordinate pair [lon, lat]
116
116
  all_coords.append(coords)
117
117
  else:
nextmv/manifest.py CHANGED
@@ -829,9 +829,7 @@ class ManifestContentMultiFileOutput(BaseModel):
829
829
  Parameters
830
830
  ----------
831
831
  statistics : Optional[str], default=""
832
- Deprecated: Use `metrics` instead. The path to the statistics file.
833
- metrics : Optional[str], default=""
834
- The path to the metrics file.
832
+ The path to the statistics file.
835
833
  assets : Optional[str], default=""
836
834
  The path to the assets file.
837
835
  solutions : Optional[str], default=""
@@ -841,18 +839,16 @@ class ManifestContentMultiFileOutput(BaseModel):
841
839
  --------
842
840
  >>> from nextmv import ManifestContentMultiFileOutput
843
841
  >>> output_config = ManifestContentMultiFileOutput(
844
- ... metrics="my-outputs/metrics.json",
842
+ ... statistics="my-outputs/statistics.json",
845
843
  ... assets="my-outputs/assets.json",
846
844
  ... solutions="my-outputs/solutions/"
847
845
  ... )
848
- >>> output_config.metrics
849
- 'my-outputs/metrics.json'
846
+ >>> output_config.statistics
847
+ 'my-outputs/statistics.json'
850
848
  """
851
849
 
852
850
  statistics: str | None = ""
853
- """Deprecated: Use `metrics` instead. The path to the statistics file."""
854
- metrics: str | None = ""
855
- """The path to the metrics file."""
851
+ """The path to the statistics file."""
856
852
  assets: str | None = ""
857
853
  """The path to the assets file."""
858
854
  solutions: str | None = ""
@@ -882,7 +878,7 @@ class ManifestContentMultiFile(BaseModel):
882
878
  >>> multi_file_config = ManifestContentMultiFile(
883
879
  ... input=ManifestContentMultiFileInput(path="data/input/"),
884
880
  ... output=ManifestContentMultiFileOutput(
885
- ... metrics="my-outputs/metrics.json",
881
+ ... statistics="my-outputs/statistics.json",
886
882
  ... assets="my-outputs/assets.json",
887
883
  ... solutions="my-outputs/solutions/"
888
884
  ... )
@@ -923,7 +919,7 @@ class ManifestContent(BaseModel):
923
919
  ... multi_file=ManifestContentMultiFile(
924
920
  ... input=ManifestContentMultiFileInput(path="data/input/"),
925
921
  ... output=ManifestContentMultiFileOutput(
926
- ... metrics="my-outputs/metrics.json",
922
+ ... statistics="my-outputs/statistics.json",
927
923
  ... assets="my-outputs/assets.json",
928
924
  ... solutions="my-outputs/solutions/"
929
925
  ... )
nextmv/model.py CHANGED
@@ -18,6 +18,8 @@ deployed to Nextmv Cloud for execution.
18
18
  import logging
19
19
  import os
20
20
  import shutil
21
+ import sqlite3
22
+ import time
21
23
  import warnings
22
24
  from dataclasses import dataclass
23
25
  from typing import Any
@@ -84,6 +86,9 @@ def _custom_showwarning(message, category, filename, lineno, file=None, line=Non
84
86
  if "mlflow/pyfunc/__init__.py" in filename:
85
87
  return
86
88
 
89
+ if "/mlflow/tracing/provider.py" in filename:
90
+ return
91
+
87
92
  _original_showwarning(message, category, filename, lineno, file, line)
88
93
 
89
94
 
@@ -195,7 +200,7 @@ class Model:
195
200
  ... return nextmv.Output(
196
201
  ... options=input.options,
197
202
  ... solution=nextroute_output.solutions[0].to_dict(),
198
- ... metrics=nextroute_output.metrics.to_dict(),
203
+ ... statistics=nextroute_output.statistics.to_dict(),
199
204
  ... )
200
205
  """
201
206
 
@@ -234,7 +239,7 @@ class Model:
234
239
  ... return Output(
235
240
  ... options=input.options,
236
241
  ... solution=result,
237
- ... metrics={"processing_time": 0.5}
242
+ ... statistics={"processing_time": 0.5}
238
243
  ... )
239
244
  """
240
245
 
@@ -288,7 +293,6 @@ class Model:
288
293
  ) from e
289
294
 
290
295
  finally:
291
- from mlflow.models import infer_signature
292
296
  from mlflow.pyfunc import PythonModel, save_model
293
297
 
294
298
  class MLFlowModel(PythonModel):
@@ -342,12 +346,16 @@ class Model:
342
346
 
343
347
  _cleanup_python_model(model_dir, configuration, verbose=False)
344
348
 
345
- signature = None
346
- if configuration.options is not None:
347
- options_dict = configuration.options.to_dict()
348
- signature = infer_signature(
349
- params=options_dict,
350
- )
349
+ # Removing this seems to make the "apps from models" experience once
350
+ # again. I am not removing it entirely because we might want to
351
+ # re-introduce it later on.
352
+ # signature = None
353
+ # if configuration.options is not None:
354
+ # options_dict = configuration.options.to_dict()
355
+ # signature = infer_signature(
356
+ # model_input={},
357
+ # params=options_dict,
358
+ # )
351
359
 
352
360
  # We use mlflow to save the model to the local filesystem, to be able to
353
361
  # load it later on.
@@ -356,7 +364,7 @@ class Model:
356
364
  path=model_path, # Customize the name of the model location.
357
365
  infer_code_paths=True, # Makes the imports portable.
358
366
  python_model=MLFlowModel(),
359
- signature=signature, # Allows us to work with our own `Options` class.
367
+ # signature=signature, # Please see comment above about keeping this in case we need to go back.
360
368
  )
361
369
 
362
370
  # Create an auxiliary requirements file with the model dependencies.
@@ -415,9 +423,7 @@ def _cleanup_python_model(
415
423
  if os.path.exists(model_path):
416
424
  shutil.rmtree(model_path)
417
425
 
418
- mlruns_path = os.path.join(model_dir, "mlruns")
419
- if os.path.exists(mlruns_path):
420
- shutil.rmtree(mlruns_path)
426
+ _cleanup_mlflow_db(model_dir)
421
427
 
422
428
  requirements_file = os.path.join(model_dir, _REQUIREMENTS_FILE)
423
429
  if os.path.exists(requirements_file):
@@ -429,3 +435,36 @@ def _cleanup_python_model(
429
435
 
430
436
  if verbose:
431
437
  log("🧹 Cleaned up Python model artifacts.")
438
+
439
+
440
+ def _cleanup_mlflow_db(model_dir: str) -> None:
441
+ """
442
+ Clean up the mlflow.db file created during model packaging.
443
+
444
+ Parameters
445
+ ----------
446
+ model_dir : str
447
+ The directory where the model was saved.
448
+ """
449
+ mlflow_db_path = os.path.join(model_dir, "mlflow.db")
450
+ if not os.path.exists(mlflow_db_path):
451
+ return
452
+
453
+ # Try to close any open SQLite connections and retry deletion
454
+ max_retries = 5
455
+ for attempt in range(max_retries):
456
+ try:
457
+ # Attempt to connect and close to release any locks
458
+ try:
459
+ conn = sqlite3.connect(mlflow_db_path)
460
+ conn.close()
461
+ except Exception:
462
+ pass
463
+ os.remove(mlflow_db_path)
464
+ break
465
+ except PermissionError:
466
+ if attempt < max_retries - 1:
467
+ time.sleep(0.5)
468
+ else:
469
+ log(f"Could not delete {mlflow_db_path} after {max_retries} retries due to file lock.")
470
+ break
nextmv/options.py CHANGED
@@ -695,7 +695,7 @@ class Options:
695
695
  help=argparse.SUPPRESS,
696
696
  default="1",
697
697
  )
698
- args = parser.parse_args()
698
+ args, _ = parser.parse_known_args()
699
699
 
700
700
  for arg in vars(args):
701
701
  if arg == "fff" or arg == "f":
nextmv/output.py CHANGED
@@ -8,9 +8,9 @@ destinations.
8
8
  Classes
9
9
  -------
10
10
  RunStatistics
11
- Deprecated: Statistics about a general run.
11
+ Statistics about a general run.
12
12
  ResultStatistics
13
- Deprecated: Statistics about a specific result.
13
+ Statistics about a specific result.
14
14
  DataPoint
15
15
  A data point representing a 2D coordinate.
16
16
  Series
@@ -18,10 +18,7 @@ Series
18
18
  SeriesData
19
19
  Data container for multiple series of data points.
20
20
  Statistics
21
- Deprecated: Use metrics instead. Complete statistics container for a
22
- solution, including run metrics and result data.
23
- Metrics
24
- Metrics container for a solution.
21
+ Complete statistics container for a solution, including run metrics and result data.
25
22
  OutputFormat
26
23
  Enumeration of supported output formats.
27
24
  SolutionFile
@@ -49,9 +46,7 @@ Attributes
49
46
  ASSETS_KEY : str
50
47
  Assets key constant used for identifying assets in the run output.
51
48
  STATISTICS_KEY : str
52
- Deprecated: Use METRICS_KEY instead. Statistics key constant used for identifying statistics in the run output.
53
- METRICS_KEY : str
54
- Metrics key constant used for identifying metrics in the run output.
49
+ Statistics key constant used for identifying statistics in the run output.
55
50
  SOLUTIONS_KEY : str
56
51
  Solutions key constant used for identifying solutions in the run output.
57
52
  OUTPUTS_KEY : str
@@ -80,11 +75,7 @@ Assets key constant used for identifying assets in the run output.
80
75
  """
81
76
  STATISTICS_KEY = "statistics"
82
77
  """
83
- Deprecated: Use METRICS_KEY instead. Statistics key constant used for identifying statistics in the run output.
84
- """
85
- METRICS_KEY = "metrics"
86
- """
87
- Metrics key constant used for identifying metrics in the run output.
78
+ Statistics key constant used for identifying statistics in the run output.
88
79
  """
89
80
  SOLUTIONS_KEY = "solutions"
90
81
  """
@@ -98,7 +89,7 @@ Outputs key constant used for identifying outputs in the run output.
98
89
 
99
90
  class RunStatistics(BaseModel):
100
91
  """
101
- Deprecated: Statistics about a general run.
92
+ Statistics about a general run.
102
93
 
103
94
  You can import the `RunStatistics` class directly from `nextmv`:
104
95
 
@@ -138,7 +129,7 @@ class RunStatistics(BaseModel):
138
129
 
139
130
  class ResultStatistics(BaseModel):
140
131
  """
141
- Deprecated: Statistics about a specific result.
132
+ Statistics about a specific result.
142
133
 
143
134
  You can import the `ResultStatistics` class directly from `nextmv`:
144
135
 
@@ -178,7 +169,7 @@ class ResultStatistics(BaseModel):
178
169
 
179
170
  class DataPoint(BaseModel):
180
171
  """
181
- Deprecated: A data point representing a 2D coordinate.
172
+ A data point representing a 2D coordinate.
182
173
 
183
174
  You can import the `DataPoint` class directly from `nextmv`:
184
175
 
@@ -211,7 +202,7 @@ class DataPoint(BaseModel):
211
202
 
212
203
  class Series(BaseModel):
213
204
  """
214
- Deprecated: A series of data points for visualization or analysis.
205
+ A series of data points for visualization or analysis.
215
206
 
216
207
  You can import the `Series` class directly from `nextmv`:
217
208
 
@@ -245,7 +236,7 @@ class Series(BaseModel):
245
236
 
246
237
  class SeriesData(BaseModel):
247
238
  """
248
- Deprecated: Data container for multiple series of data points.
239
+ Data container for multiple series of data points.
249
240
 
250
241
  You can import the `SeriesData` class directly from `nextmv`:
251
242
 
@@ -280,9 +271,6 @@ class SeriesData(BaseModel):
280
271
 
281
272
  class Statistics(BaseModel):
282
273
  """
283
- !!! warning
284
- `Statistics` is deprecated, use `Metrics` instead.
285
-
286
274
  Complete statistics container for a solution, including run metrics and
287
275
  result data.
288
276
 
@@ -889,9 +877,7 @@ class Output:
889
877
  The solution to the decision problem. The type must match the
890
878
  `output_format`. Default is None.
891
879
  statistics : Optional[Union[Statistics, dict[str, Any]]], optional
892
- Deprecated: Use Metrics instead. Statistics of the solution. Default is None.
893
- metrics : Optional[dict[str, Any]], optional
894
- Metrics of the solution. Default is None.
880
+ Statistics of the solution. Default is None.
895
881
  csv_configurations : Optional[dict[str, Any]], optional
896
882
  Configuration for writing CSV files. Default is None.
897
883
  json_configurations : Optional[dict[str, Any]], optional
@@ -930,16 +916,17 @@ class Output:
930
916
  Examples
931
917
  --------
932
918
  >>> from nextmv.output import Output, OutputFormat, Statistics, RunStatistics
933
- >>> metrics = {"duration": 30.0, "iterations": 100}
919
+ >>> run_stats = RunStatistics(duration=30.0, iterations=100)
920
+ >>> stats = Statistics(run=run_stats)
934
921
  >>> solution = {"routes": [{"vehicle": 1, "stops": [1, 2, 3]}, {"vehicle": 2, "stops": [4, 5]}]}
935
922
  >>> output = Output(
936
923
  ... output_format=OutputFormat.JSON,
937
924
  ... solution=solution,
938
- ... metrics=metrics,
925
+ ... statistics=stats,
939
926
  ... json_configurations={"indent": 4}
940
927
  ... )
941
928
  >>> output_dict = output.to_dict()
942
- >>> "solution" in output_dict and "metrics" in output_dict
929
+ >>> "solution" in output_dict and "statistics" in output_dict
943
930
  True
944
931
  """
945
932
 
@@ -982,16 +969,11 @@ class Output:
982
969
  """
983
970
  statistics: Statistics | dict[str, Any] | None = None
984
971
  """
985
- Deprecated: Use Metrics instead.
986
972
  Statistics of the solution. These statistics can be of type `Statistics` or a
987
973
  simple dictionary. If the statistics are of type `Statistics`, they will be
988
974
  serialized to a dictionary using the `to_dict` method. If they are a
989
- dictionary, they will be used as is.
990
- """
991
- metrics: dict[str, Any] | None = None
992
- """
993
- Metrics of the solution. These metrics should be provided as a simple or
994
- nested dictionary.
975
+ dictionary, they will be used as is. If the statistics are not provided, an
976
+ empty dictionary will be used.
995
977
  """
996
978
  csv_configurations: dict[str, Any] | None = None
997
979
  """
@@ -1106,7 +1088,7 @@ class Output:
1106
1088
  # Statistics need to end up as a dict, so we achieve that based on the
1107
1089
  # type of statistics that were used to create the class.
1108
1090
  if self.statistics is None:
1109
- statistics = None
1091
+ statistics = {}
1110
1092
  elif isinstance(self.statistics, Statistics):
1111
1093
  statistics = self.statistics.to_dict()
1112
1094
  elif isinstance(self.statistics, dict):
@@ -1116,18 +1098,6 @@ class Output:
1116
1098
  f"unsupported statistics type: {type(self.statistics)}, supported types are `Statistics` or `dict`"
1117
1099
  )
1118
1100
 
1119
- if self.metrics is None:
1120
- metrics = None
1121
- elif isinstance(self.metrics, dict):
1122
- metrics = self.metrics
1123
- else:
1124
- raise TypeError(f"unsupported metrics type: {type(self.metrics)}, supported type is `dict`")
1125
-
1126
- # if both metrics and statistics are None, set statistics to an
1127
- # empty dict for backward compatibility
1128
- if statistics is None and metrics is None:
1129
- statistics = {}
1130
-
1131
1101
  # Assets need to end up as a list of dicts, so we achieve that based on
1132
1102
  # the type of each asset in the list.
1133
1103
  assets = []
@@ -1147,16 +1117,10 @@ class Output:
1147
1117
  output_dict = {
1148
1118
  "options": options,
1149
1119
  "solution": self.solution if self.solution is not None else {},
1120
+ STATISTICS_KEY: statistics,
1150
1121
  ASSETS_KEY: assets,
1151
1122
  }
1152
1123
 
1153
- # Only include statistics in output if it's not None
1154
- if statistics is not None:
1155
- output_dict[STATISTICS_KEY] = statistics
1156
-
1157
- if metrics is not None:
1158
- output_dict[METRICS_KEY] = metrics
1159
-
1160
1124
  # Add the auxiliary configurations to the output dictionary if they are
1161
1125
  # defined and not empty.
1162
1126
  if (
@@ -1229,9 +1193,9 @@ class LocalOutputWriter(OutputWriter):
1229
1193
 
1230
1194
  Examples
1231
1195
  --------
1232
- >>> from nextmv.output import LocalOutputWriter, Output, Metrics
1196
+ >>> from nextmv.output import LocalOutputWriter, Output, Statistics
1233
1197
  >>> writer = LocalOutputWriter()
1234
- >>> output = Output(solution={"result": 42}, metrics={"time": 1.23})
1198
+ >>> output = Output(solution={"result": 42}, statistics=Statistics())
1235
1199
  >>> # Write to stdout
1236
1200
  >>> writer.write(output, path=None)
1237
1201
  >>> # Write to a file
nextmv/run.py CHANGED
@@ -434,9 +434,6 @@ class RunInfoStatistics(BaseModel):
434
434
  """List of statistics indicators."""
435
435
 
436
436
 
437
- RunInfoMetrics = RunInfoStatistics
438
-
439
-
440
437
  class OptionsSummaryItem(BaseModel):
441
438
  """
442
439
  Summary item for options used in a run.
@@ -532,9 +529,7 @@ class Run(BaseModel):
532
529
  experiment_id : str, optional
533
530
  ID of the experiment associated with the run. Defaults to None.
534
531
  statistics : RunInfoStatistics, optional
535
- Deprecated: Statistics of the run. Defaults to None.
536
- metrics: RunInfoMetrics, optional
537
- Metrics of the run. Defaults to None.
532
+ Statistics of the run. Defaults to None.
538
533
  input_id : str, optional
539
534
  ID of the input associated with the run. Defaults to None.
540
535
  option_set : str, optional
@@ -608,9 +603,7 @@ class Run(BaseModel):
608
603
  experiment_id: str | None = None
609
604
  """ID of the experiment associated with the run."""
610
605
  statistics: RunInfoStatistics | None = None
611
- """Deprecated: Statistics of the run."""
612
- metrics: RunInfoMetrics | None = None
613
- """Metrics of the run."""
606
+ """Statistics of the run."""
614
607
  input_id: str | None = None
615
608
  """ID of the input associated with the run."""
616
609
  option_set: str | None = None
@@ -684,9 +677,7 @@ class Metadata(BaseModel):
684
677
  status_v2: StatusV2
685
678
  """Status of the run."""
686
679
  statistics: dict[str, Any] | None = None
687
- """Deprecated: User defined statistics of the run."""
688
- metrics: dict[str, Any] | None = None
689
- """User defined metrics of the run."""
680
+ """User defined statistics of the run."""
690
681
 
691
682
  def run_is_finalized(self) -> bool:
692
683
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nextmv
3
- Version: 1.0.0.dev8
3
+ Version: 1.0.0.dev10
4
4
  Summary: The all-purpose Python SDK for Nextmv
5
5
  Project-URL: Homepage, https://www.nextmv.io
6
6
  Project-URL: Documentation, https://nextmv-py.docs.nextmv.io/en/latest/nextmv/
@@ -229,19 +229,20 @@ Requires-Dist: plotly>=6.0.1; extra == 'all'
229
229
  Provides-Extra: dev
230
230
  Requires-Dist: build>=1.0.3; extra == 'dev'
231
231
  Requires-Dist: folium>=0.20.0; extra == 'dev'
232
- Requires-Dist: mlflow>=2.19.0; extra == 'dev'
233
- Requires-Dist: nextroute>=1.11.1; extra == 'dev'
232
+ Requires-Dist: mlflow>=3.9.0; extra == 'dev'
233
+ Requires-Dist: nextpipe>=0.6.0; extra == 'dev'
234
234
  Requires-Dist: openpyxl>=3.1.5; extra == 'dev'
235
235
  Requires-Dist: pandas>=2.2.3; extra == 'dev'
236
236
  Requires-Dist: plotly>=6.0.1; extra == 'dev'
237
237
  Requires-Dist: pydantic>=2.5.2; extra == 'dev'
238
+ Requires-Dist: pytest>=9.0.2; extra == 'dev'
238
239
  Requires-Dist: pyyaml>=6.0.1; extra == 'dev'
239
240
  Requires-Dist: requests>=2.31.0; extra == 'dev'
240
241
  Requires-Dist: ruff>=0.1.7; extra == 'dev'
241
242
  Requires-Dist: twine>=4.0.2; extra == 'dev'
242
243
  Requires-Dist: urllib3>=2.1.0; extra == 'dev'
243
244
  Provides-Extra: notebook
244
- Requires-Dist: mlflow>=2.19.0; extra == 'notebook'
245
+ Requires-Dist: mlflow>=3.9.0; extra == 'notebook'
245
246
  Description-Content-Type: text/markdown
246
247
 
247
248
  # Nextmv Python SDK