nextmv 1.0.0.dev8__py3-none-any.whl → 1.0.0.dev9__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.
nextmv/__about__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "v1.0.0.dev8"
1
+ __version__ = "v1.0.0.dev9"
nextmv/_serialization.py CHANGED
@@ -90,7 +90,7 @@ def _custom_serial(obj: Any) -> str:
90
90
  If the object type is not supported for serialization.
91
91
  """
92
92
 
93
- if isinstance(obj, datetime.datetime | datetime.date):
93
+ if isinstance(obj, (datetime.datetime, datetime.date)):
94
94
  return obj.isoformat()
95
95
 
96
96
  raise TypeError(f"Type {type(obj)} not serializable")
@@ -45,7 +45,7 @@ app = typer.Typer()
45
45
  - Multiple metrics as a [magenta]json[/magenta] array in a single --metrics flag.
46
46
 
47
47
  Each metric must have the following fields:
48
- - [magenta]field[/magenta]: Field of the metric to measure (e.g., "result.custom.unassigned").
48
+ - [magenta]field[/magenta]: Field of the metric to measure (e.g., "solution.objective").
49
49
  - [magenta]metric_type[/magenta]: Type of metric comparison. Allowed values: {enum_values(MetricType)}.
50
50
  - [magenta]params[/magenta]: Parameters of the metric comparison.
51
51
  - [magenta]operator[/magenta]: Comparison operator. Allowed values: {enum_values(Comparison)}.
@@ -71,8 +71,8 @@ app = typer.Typer()
71
71
  [bold][underline]Examples[/underline][/bold]
72
72
 
73
73
  - Create an acceptance test with a single metric.
74
- $ [green]METRIC='{{
75
- "field": "result.custom.unassigned",
74
+ $ [dim]METRIC='{{
75
+ "field": "solution.objective",
76
76
  "metric_type": "direct-comparison",
77
77
  "params": {{
78
78
  "operator": "lt",
@@ -85,8 +85,8 @@ app = typer.Typer()
85
85
  --metrics "$METRIC" --input-set-id input-set-123[/dim]
86
86
 
87
87
  - Create with multiple metrics by repeating the flag.
88
- $ [green]METRIC1='{{
89
- "field": "result.custom.unassigned",
88
+ $ [dim]METRIC1='{{
89
+ "field": "solution.objective",
90
90
  "metric_type": "direct-comparison",
91
91
  "params": {{
92
92
  "operator": "lt",
@@ -95,7 +95,7 @@ app = typer.Typer()
95
95
  "statistic": "mean"
96
96
  }}'
97
97
  METRIC2='{{
98
- "field": "run.duration",
98
+ "field": "statistics.run.duration",
99
99
  "metric_type": "direct-comparison",
100
100
  "params": {{
101
101
  "operator": "le",
@@ -110,7 +110,7 @@ app = typer.Typer()
110
110
  - Create with multiple metrics in a single [magenta]json[/magenta] array.
111
111
  $ [dim]METRICS='[
112
112
  {{
113
- "field": "result.custom.unassigned",
113
+ "field": "solution.objective",
114
114
  "metric_type": "direct-comparison",
115
115
  "params": {{
116
116
  "operator": "lt",
@@ -119,7 +119,7 @@ app = typer.Typer()
119
119
  "statistic": "mean"
120
120
  }},
121
121
  {{
122
- "field": "run.duration",
122
+ "field": "statistics.run.duration",
123
123
  "metric_type": "direct-comparison",
124
124
  "params": {{
125
125
  "operator": "le",
@@ -133,8 +133,8 @@ app = typer.Typer()
133
133
  --metrics "$METRICS" --input-set-id input-set-123[/dim]
134
134
 
135
135
  - Create an acceptance test and wait for it to complete.
136
- $ [green]METRIC='{{
137
- "field": "result.custom.unassigned",
136
+ $ [dim]METRIC='{{
137
+ "field": "solution.objective",
138
138
  "metric_type": "direct-comparison",
139
139
  "params": {{
140
140
  "operator": "lt",
@@ -147,8 +147,8 @@ app = typer.Typer()
147
147
  --metrics "$METRIC" --input-set-id input-set-123 --wait[/dim]
148
148
 
149
149
  - Create an acceptance test and save the results to a file, waiting for completion.
150
- $ [green]METRIC='{{
151
- "field": "result.custom.unassigned",
150
+ $ [dim]METRIC='{{
151
+ "field": "solution.objective",
152
152
  "metric_type": "direct-comparison",
153
153
  "params": {{
154
154
  "operator": "lt",
@@ -119,7 +119,7 @@ def clone(
119
119
  # Extract the tarball to a temporary directory to handle nested structure
120
120
  with tempfile.TemporaryDirectory() as temp_dir:
121
121
  with tarfile.open(downloaded_object, "r:gz") as tar:
122
- tar.extractall(path=temp_dir)
122
+ tar.extractall(path=temp_dir, filter=None)
123
123
 
124
124
  # Find the extracted directory (typically the app name)
125
125
  extracted_items = os.listdir(temp_dir)
@@ -270,3 +270,4 @@ def download_object(file: str, path: str, output_dir: str, output_file: str, pro
270
270
  f.write(response.content)
271
271
 
272
272
  return file_name
273
+ return file_name
@@ -867,8 +867,6 @@ class Application(
867
867
  output_config = multi_config["output_configuration"] = {}
868
868
  if content.multi_file.output.statistics:
869
869
  output_config["statistics_path"] = content.multi_file.output.statistics
870
- if content.multi_file.output.metrics:
871
- output_config["metrics_path"] = content.multi_file.output.metrics
872
870
  if content.multi_file.output.assets:
873
871
  output_config["assets_path"] = content.multi_file.output.assets
874
872
  if content.multi_file.output.solutions:
@@ -21,14 +21,7 @@ from nextmv.cloud.url import DownloadURL
21
21
  from nextmv.input import Input, InputFormat
22
22
  from nextmv.logger import log
23
23
  from nextmv.options import Options
24
- from nextmv.output import (
25
- ASSETS_KEY,
26
- STATISTICS_KEY,
27
- Asset,
28
- Output,
29
- OutputFormat,
30
- Statistics,
31
- )
24
+ from nextmv.output import ASSETS_KEY, STATISTICS_KEY, Asset, Output, OutputFormat, Statistics
32
25
  from nextmv.polling import DEFAULT_POLLING_OPTIONS, PollingOptions, poll
33
26
  from nextmv.run import (
34
27
  ExternalRunResult,
@@ -642,7 +635,7 @@ class ApplicationRunMixin:
642
635
  temp_tar_path = os.path.join(tmpdirname, f"{run_id}.tar.gz")
643
636
  with open(temp_tar_path, "wb") as f:
644
637
  f.write(download_response.content)
645
- shutil.unpack_archive(temp_tar_path, output_dir_path)
638
+ shutil.unpack_archive(temp_tar_path, output_dir_path, filter=None)
646
639
 
647
640
  return
648
641
 
@@ -1294,7 +1287,7 @@ class ApplicationRunMixin:
1294
1287
  temp_tar_path = os.path.join(tmpdirname, f"{run_id}.tar.gz")
1295
1288
  with open(temp_tar_path, "wb") as f:
1296
1289
  f.write(download_response.content)
1297
- shutil.unpack_archive(temp_tar_path, output_dir_path)
1290
+ shutil.unpack_archive(temp_tar_path, output_dir_path, filter=None)
1298
1291
  else:
1299
1292
  result.output = download_response.json()
1300
1293
 
nextmv/cloud/client.py CHANGED
@@ -303,7 +303,7 @@ class Client:
303
303
  if data is not None:
304
304
  kwargs["data"] = data
305
305
  if payload is not None:
306
- if isinstance(payload, dict | list):
306
+ if isinstance(payload, (dict, list)):
307
307
  data = deflated_serialize_json(payload, json_configurations=json_configurations)
308
308
  kwargs["data"] = data
309
309
  else:
@@ -26,10 +26,12 @@ assets = create_visuals(name, input.data["radius"], input.data["distance"])
26
26
  output = nextmv.Output(
27
27
  options=options,
28
28
  solution={"message": message},
29
- metrics={
30
- "value": 1.23,
31
- "custom": {"message": message},
32
- },
29
+ statistics=nextmv.Statistics(
30
+ result=nextmv.ResultStatistics(
31
+ value=1.23,
32
+ custom={"message": message},
33
+ ),
34
+ ),
33
35
  assets=assets,
34
36
  )
35
37
  nextmv.write(output)
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
@@ -84,6 +84,9 @@ def _custom_showwarning(message, category, filename, lineno, file=None, line=Non
84
84
  if "mlflow/pyfunc/__init__.py" in filename:
85
85
  return
86
86
 
87
+ if "/mlflow/tracing/provider.py" in filename:
88
+ return
89
+
87
90
  _original_showwarning(message, category, filename, lineno, file, line)
88
91
 
89
92
 
@@ -195,7 +198,7 @@ class Model:
195
198
  ... return nextmv.Output(
196
199
  ... options=input.options,
197
200
  ... solution=nextroute_output.solutions[0].to_dict(),
198
- ... metrics=nextroute_output.metrics.to_dict(),
201
+ ... statistics=nextroute_output.statistics.to_dict(),
199
202
  ... )
200
203
  """
201
204
 
@@ -234,7 +237,7 @@ class Model:
234
237
  ... return Output(
235
238
  ... options=input.options,
236
239
  ... solution=result,
237
- ... metrics={"processing_time": 0.5}
240
+ ... statistics={"processing_time": 0.5}
238
241
  ... )
239
242
  """
240
243
 
@@ -288,7 +291,6 @@ class Model:
288
291
  ) from e
289
292
 
290
293
  finally:
291
- from mlflow.models import infer_signature
292
294
  from mlflow.pyfunc import PythonModel, save_model
293
295
 
294
296
  class MLFlowModel(PythonModel):
@@ -342,12 +344,13 @@ class Model:
342
344
 
343
345
  _cleanup_python_model(model_dir, configuration, verbose=False)
344
346
 
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
- )
347
+ # signature = None
348
+ # if configuration.options is not None:
349
+ # options_dict = configuration.options.to_dict()
350
+ # signature = infer_signature(
351
+ # model_input={},
352
+ # params=options_dict,
353
+ # )
351
354
 
352
355
  # We use mlflow to save the model to the local filesystem, to be able to
353
356
  # load it later on.
@@ -356,7 +359,7 @@ class Model:
356
359
  path=model_path, # Customize the name of the model location.
357
360
  infer_code_paths=True, # Makes the imports portable.
358
361
  python_model=MLFlowModel(),
359
- signature=signature, # Allows us to work with our own `Options` class.
362
+ # signature=signature, # Allows us to work with our own `Options` class.
360
363
  )
361
364
 
362
365
  # Create an auxiliary requirements file with the model dependencies.
@@ -415,9 +418,9 @@ def _cleanup_python_model(
415
418
  if os.path.exists(model_path):
416
419
  shutil.rmtree(model_path)
417
420
 
418
- mlruns_path = os.path.join(model_dir, "mlruns")
419
- if os.path.exists(mlruns_path):
420
- shutil.rmtree(mlruns_path)
421
+ mlflow_db_path = os.path.join(model_dir, "mlflow.db")
422
+ if os.path.exists(mlflow_db_path):
423
+ os.remove(mlflow_db_path)
421
424
 
422
425
  requirements_file = os.path.join(model_dir, _REQUIREMENTS_FILE)
423
426
  if os.path.exists(requirements_file):
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.dev9
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,8 +229,7 @@ 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'
234
233
  Requires-Dist: openpyxl>=3.1.5; extra == 'dev'
235
234
  Requires-Dist: pandas>=2.2.3; extra == 'dev'
236
235
  Requires-Dist: plotly>=6.0.1; extra == 'dev'
@@ -241,7 +240,7 @@ Requires-Dist: ruff>=0.1.7; extra == 'dev'
241
240
  Requires-Dist: twine>=4.0.2; extra == 'dev'
242
241
  Requires-Dist: urllib3>=2.1.0; extra == 'dev'
243
242
  Provides-Extra: notebook
244
- Requires-Dist: mlflow>=2.19.0; extra == 'notebook'
243
+ Requires-Dist: mlflow>=3.9.0; extra == 'notebook'
245
244
  Description-Content-Type: text/markdown
246
245
 
247
246
  # Nextmv Python SDK
@@ -1,17 +1,17 @@
1
- nextmv/__about__.py,sha256=gaYHqa3kcC-a8tfZv6Hq1-xsB1kwSym282AsDr7hgq8,28
1
+ nextmv/__about__.py,sha256=VlLsZkZ0zjltxAYOr-XbXribwiPhO-YMZ5Qymsv1Se0,28
2
2
  nextmv/__entrypoint__.py,sha256=XMT-ds1f2Yc6KoI2C0YEH-rJj5gVLfJMqUdRfcA3_KQ,1070
3
3
  nextmv/__init__.py,sha256=LwpGBSiV0UG13zKHO2N3Ikb7bCMV08Gfbl6Cp80b_2g,3813
4
- nextmv/_serialization.py,sha256=fT-GXiy9cNo7D2KL1blZcsAaQHHgkEVTI_JvXIFlWZc,2833
4
+ nextmv/_serialization.py,sha256=jYitMS1MU8ldsmObT-K_8V8P2Wx69tnDiEHCCgPGun4,2834
5
5
  nextmv/base_model.py,sha256=kPFqE-c_3LcEy8fY0qDrJk_gbPYgSKtetRMby71oxE8,2298
6
6
  nextmv/deprecated.py,sha256=U1YD-vie0dEVWFJgIwOuinxACHsyiEIQpfrt95ykhlg,1651
7
7
  nextmv/input.py,sha256=iONLkXhcIXRCJVPNVkJdivh47A399VMepsSxNZByX2I,37649
8
8
  nextmv/logger.py,sha256=kNIbu46MisrzYe4T0hNMpWfRTKKacDVvbtQcNys_c_E,2513
9
- nextmv/manifest.py,sha256=VoZo7cGKGCdmcxDu5ECTZPY67J4LAUxBu6gmhgXVWRY,49216
10
- nextmv/model.py,sha256=uthHjRCrC1b9OCoyQ_n-2_nfP1bFu-nMiUxYhmLf0SI,14989
9
+ nextmv/manifest.py,sha256=v9En9zMZVKZn6G_HThoKUZowMtZr5hxzwWiK9wkVHPU,49023
10
+ nextmv/model.py,sha256=GWzg9eWtTKjZqsQNvMPWdv5BLLb63Ied_q2koXxiCxM,15066
11
11
  nextmv/options.py,sha256=3BnnuAoiFD6qr0EMYv1VgAXarDjLb-t7OpC1IpsnS1M,29648
12
- nextmv/output.py,sha256=7ioVUlsQiQP9MeR6baUXs9C-5q6jcBteu1DUNExcHCw,55707
12
+ nextmv/output.py,sha256=MbmI7t8p2LhKD1T--IZnsHvIuFY_TM8wTNCdLQVWs2A,54356
13
13
  nextmv/polling.py,sha256=fwnAxmfpuBg4d6pi53TRTyyefdpf-cHLoTG6trAu-QA,11048
14
- nextmv/run.py,sha256=o6_nSPOYwGCsCaqmYYAwrtCLE_aJuqy5NHFRfXYE7TI,54440
14
+ nextmv/run.py,sha256=8tkRQexJC8JN7IkLlhpwEW5pEudxwDq2sC_PImfwReI,54126
15
15
  nextmv/safe.py,sha256=VAK4fGEurbLNji4Pg5Okga5XQSbI4aI9JJf95_68Z20,3867
16
16
  nextmv/status.py,sha256=VqmOgxiEK89Y88ZUxZPfUXmY0HqvN28Lc1PDt0-9PLw,1600
17
17
  nextmv/cli/CONTRIBUTING.md,sha256=xM_skfI1WPh2UtZ1axbB8AfOLJ3LZk8YhQpZY4qtSqw,21911
@@ -23,7 +23,7 @@ nextmv/cli/options.py,sha256=ymd6Y7_ZQkln35nHw3pLnFpqivgmJfuYAnyizmEuonc,6887
23
23
  nextmv/cli/version.py,sha256=VRbfNpUvCFYPcphr-F3Ph4Z4UwtVis4keyVFHj1JISw,681
24
24
  nextmv/cli/cloud/__init__.py,sha256=pywNNBy_poHaKn3_oIZRR9DDE8w3u65KvLpnX6S0BQI,1886
25
25
  nextmv/cli/cloud/acceptance/__init__.py,sha256=v4U1m6z5zI8mQpmIE4kFeEYOsaDxnGRnRj2j5I6WueI,711
26
- nextmv/cli/cloud/acceptance/create.py,sha256=lc1EYydsIuxr2qiQ_0W7po8DnPIfXSYR-5cm_6ddYGA,14604
26
+ nextmv/cli/cloud/acceptance/create.py,sha256=Mtiy7fMBU5Ay_hxb2DXxdaM2XvR_QDbldtyjQIAaelQ,14582
27
27
  nextmv/cli/cloud/acceptance/delete.py,sha256=julZ6Bs6YcsmyuE00yPjPScIRz4QteNt-GUR4J2Hp_I,2260
28
28
  nextmv/cli/cloud/acceptance/get.py,sha256=pb3hRdIiynTi4K7xDNCMJE7bW46FE-X3EoAQU8kQJjE,3438
29
29
  nextmv/cli/cloud/acceptance/list.py,sha256=9tTV4B2lgDqNxDnaNXkHxeh7jUQuAu9GQJsEKJ_NqIo,1881
@@ -124,7 +124,7 @@ nextmv/cli/cloud/version/get.py,sha256=eGbka3TG8UJE150h22rn0BUqTi1xRE7roVDj6yJvn
124
124
  nextmv/cli/cloud/version/list.py,sha256=sKdHgyowLG1jyUEtu87yCPC5_2-0i3VDEgfmvb-bBn0,1770
125
125
  nextmv/cli/cloud/version/update.py,sha256=mEUYXGHLGkiEGH31KK6jDDfviHEhVCdLjLQL_5u0vLk,2869
126
126
  nextmv/cli/community/__init__.py,sha256=t2l6adm9Km6hSvSFzeKHTQzacVSnwjx4wpj2kqee5nM,612
127
- nextmv/cli/community/clone.py,sha256=qXDgsMfAnAcZvP9kOp-O4rqj0qw0zueg9BgWl71DqpA,9202
127
+ nextmv/cli/community/clone.py,sha256=C9ujRTBpL7fbgpBjIALsNjzYh5T-8weHOzkV1bsuiLU,9236
128
128
  nextmv/cli/community/list.py,sha256=ad7qPPaNh29tj_ggR4lJnRkMTgWstHQFV90sqdiWcdA,7440
129
129
  nextmv/cli/configuration/__init__.py,sha256=7oryF4PKkORh8bcdgbN2k36rZrFpJsM7Xfq_J4-MkFs,516
130
130
  nextmv/cli/configuration/config.py,sha256=t43ubCcbfbpfq9HvkVb2WQY9V47lrLEP0KvsWfjOJ8Y,6667
@@ -136,7 +136,7 @@ nextmv/cloud/acceptance_test.py,sha256=H34lvccJzN1URpnhrHstcVxgvq1s2iCymiKIPBHcT
136
136
  nextmv/cloud/account.py,sha256=X2xQjzhgEdKR0eypH8lWKUOwDISjJSd5SwOwEnpfTVk,13573
137
137
  nextmv/cloud/assets.py,sha256=alw634ub-DR0CHQXZy_ObeGvQthPXFLdgzgbvbH1SGY,1376
138
138
  nextmv/cloud/batch_experiment.py,sha256=thS94-ZdMR7Em5TeGN5UtnIDHmhzqld_U49SODyhrPU,10537
139
- nextmv/cloud/client.py,sha256=FGyzpwPBXMiiT4Jr2DLvWzzhjQ64AdadPDACaCuIDGM,18100
139
+ nextmv/cloud/client.py,sha256=Yj4FE4GKsLHkYijAYXcotlyNfhAWANMuWetHXsYPg1M,18101
140
140
  nextmv/cloud/ensemble.py,sha256=_hKPjSLtuGH1xGG70ZBsmY_IL5XinZqVHHwBxtX9Omw,8570
141
141
  nextmv/cloud/input_set.py,sha256=wsLmMI1C7BslWDN5j1RnVUA8z54-Hq1eLG9bkzyqafo,4187
142
142
  nextmv/cloud/instance.py,sha256=rLrgNNvNyC6hZtjxIfTR2Luylmbh2emJIZVCy_hTJZ4,5495
@@ -148,14 +148,14 @@ nextmv/cloud/shadow.py,sha256=DWJfFkwlbULdl988A1HkOsyQGq0l9xtLT8Q-ZzsepH0,7214
148
148
  nextmv/cloud/switchback.py,sha256=AGA0LDMu7sHndczy2TrcZghn_ZRnTGlBDmGRZG34dZY,7344
149
149
  nextmv/cloud/url.py,sha256=Fz70ywkWdCLmP21ZBmJwZi5kDbjpmsX_VlwVF_xQeHg,1836
150
150
  nextmv/cloud/version.py,sha256=5_S7_pWUVBFbvAArku20eK7S645GJcHtgE2OpXLdSzQ,5300
151
- nextmv/cloud/application/__init__.py,sha256=E1Q-WIly_PiNg1ynMynA81SwX88Q6uH_lqWKtQQX0tg,40369
151
+ nextmv/cloud/application/__init__.py,sha256=XmRdxE-pMUGdOG8tCblQUAtb9q5F_9Xdh3SoGk-Nj2Q,40221
152
152
  nextmv/cloud/application/_acceptance.py,sha256=ZwbVkur3-1fwM_L4F8ZUqrNaIdHgYGxKd3utoOCWjSc,13679
153
153
  nextmv/cloud/application/_batch_scenario.py,sha256=cSsX5vPOkm91UqRBPIcqlOvQ0iojwt4sQKYGZEE7x6k,28479
154
154
  nextmv/cloud/application/_ensemble.py,sha256=05l9uR0hTnW8nQjhRzjd2TPfvCoaAqNddWP-aVRL5rg,7666
155
155
  nextmv/cloud/application/_input_set.py,sha256=m7PKqhR3evdE_a_RER1L6iKwftlaxTiRd1JQvgCepUU,7069
156
156
  nextmv/cloud/application/_instance.py,sha256=Jjig8NI1jXNyBQoYj7JOfS0JFmw5jJdKLfi82fqBYgo,8386
157
157
  nextmv/cloud/application/_managed_input.py,sha256=zaWqGpe8Y5XWheroAqZSo-xNHfn2MKblNwRUbQVXBRM,6694
158
- nextmv/cloud/application/_run.py,sha256=LgSKm537F0ej-LTsMVmabkyOBtFnaHjvAdInnPzL6UI,53898
158
+ nextmv/cloud/application/_run.py,sha256=-cAnkqiZ1rP37XbV8xH_R89wvMZpDzBFzSi684GgErA,53895
159
159
  nextmv/cloud/application/_secrets.py,sha256=hWhPAyY8aDF8zlEz9opPNLrFOYtp-COFqG_jgOZ6VxI,9476
160
160
  nextmv/cloud/application/_shadow.py,sha256=8uH0Zr-9czef2BhshYLzc0yBQhIcIdBYTCIiUS1ru44,9123
161
161
  nextmv/cloud/application/_switchback.py,sha256=MapHkquya7SeyNnEVIy7E7Um_9VuMH7XiB7FFxZx6Po,9743
@@ -165,19 +165,19 @@ nextmv/default_app/.gitignore,sha256=gsfnfXMYNt-YTroh5hAzauwBZoPDJ6D_fB17rMSnIko
165
165
  nextmv/default_app/README.md,sha256=hW3zWcYzxhYfof-pThaN1Fkx93GT8tTUVRhx15edBis,662
166
166
  nextmv/default_app/app.yaml,sha256=TKjKnuoK0SDpouB_AS7TQmE_8HZbQYjmwFvhzFL1xpc,382
167
167
  nextmv/default_app/input.json,sha256=zgvbKL3boB0WIU6-9mEU3ZWBddQ5cQ0vhgmDwDyz4hE,63
168
- nextmv/default_app/main.py,sha256=j5L0itCyXKl3ezgkaS0cToLHzSl26Ah-PYr0gvxizxU,815
168
+ nextmv/default_app/main.py,sha256=gG-1JIvKXPCkm4JV46PcXxsQTAefwPXQbdPxkSubhf0,888
169
169
  nextmv/default_app/requirements.txt,sha256=wRE_HkYYWzCGnYZ2NuatHXul4gCHvU3iUAdsxtzpYiA,29
170
170
  nextmv/default_app/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
171
171
  nextmv/default_app/src/visuals.py,sha256=WYK_YBnLmYo3TpVev1CpoNCuW5R7hk9QIkeCmvMn1Fs,1014
172
172
  nextmv/local/__init__.py,sha256=6BsoqlK4dw6X11_uKzz9gBPfxKpdiol2FYO8R3X73SE,116
173
173
  nextmv/local/application.py,sha256=SBOARPnffAH6q-S0GGPEjt0gYIXmeR-38-VcZMfhqKk,47745
174
- nextmv/local/executor.py,sha256=BxR7QWb4RekeFphJ4rOvJs8fYZGIQfgWlc75b8I7GRU,39310
175
- nextmv/local/geojson_handler.py,sha256=CVlW5iof-8AODudEQ-a_o6WHqAeULfQS7-oJHf1-sAQ,12538
174
+ nextmv/local/executor.py,sha256=1qoynUCB9UDgXhjXKds0OGc8McAtAsQHJ0-QVWTJrQs,36562
175
+ nextmv/local/geojson_handler.py,sha256=7FavJdkUonop-yskjis0x3qFGB8A5wZyoBUblw-bVhw,12540
176
176
  nextmv/local/local.py,sha256=cp56UpI8h19Ob6Jvb_Ni0ceXH5Vv3ET_iPTDe6ftq3Y,2617
177
177
  nextmv/local/plotly_handler.py,sha256=bLb50e3AkVr_W-F6S7lXfeRdN60mG2jk3UElNmhoMWU,1930
178
178
  nextmv/local/runner.py,sha256=bM1dFIAG4f9pEtbyevzkRa9nSppqTeD8naomNzJVBRU,8560
179
- nextmv-1.0.0.dev8.dist-info/METADATA,sha256=f8DkOWUbGdeNNNBWcVrcHD7z0CAP9PgAWrDr6QOFK3Q,16484
180
- nextmv-1.0.0.dev8.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
181
- nextmv-1.0.0.dev8.dist-info/entry_points.txt,sha256=bH7kXUt_IOLpeW_O7Z-J2gALs2YYJ4CmWuzS8MdK6uY,48
182
- nextmv-1.0.0.dev8.dist-info/licenses/LICENSE,sha256=ZIbK-sSWA-OZprjNbmJAglYRtl5_K4l9UwAV3PGJAPc,11349
183
- nextmv-1.0.0.dev8.dist-info/RECORD,,
179
+ nextmv-1.0.0.dev9.dist-info/METADATA,sha256=401CvhCVmExbub4P0bcQU64MItlTOaSq5VTcVSyD0ss,16433
180
+ nextmv-1.0.0.dev9.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
181
+ nextmv-1.0.0.dev9.dist-info/entry_points.txt,sha256=bH7kXUt_IOLpeW_O7Z-J2gALs2YYJ4CmWuzS8MdK6uY,48
182
+ nextmv-1.0.0.dev9.dist-info/licenses/LICENSE,sha256=ZIbK-sSWA-OZprjNbmJAglYRtl5_K4l9UwAV3PGJAPc,11349
183
+ nextmv-1.0.0.dev9.dist-info/RECORD,,