nextmv 1.0.0.dev4__py3-none-any.whl → 1.0.0.dev6__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 (38) hide show
  1. nextmv/__about__.py +1 -1
  2. nextmv/__entrypoint__.py +1 -2
  3. nextmv/__init__.py +0 -4
  4. nextmv/cli/cloud/app/push.py +294 -204
  5. nextmv/cli/cloud/input_set/__init__.py +2 -0
  6. nextmv/cli/cloud/input_set/delete.py +67 -0
  7. nextmv/cli/cloud/run/create.py +4 -9
  8. nextmv/cli/cloud/shadow/stop.py +14 -2
  9. nextmv/cli/cloud/switchback/stop.py +14 -2
  10. nextmv/cli/community/clone.py +11 -197
  11. nextmv/cli/community/list.py +46 -116
  12. nextmv/cli/confirm.py +5 -3
  13. nextmv/cloud/__init__.py +4 -38
  14. nextmv/cloud/acceptance_test.py +1 -65
  15. nextmv/cloud/account.py +1 -6
  16. nextmv/cloud/application/__init__.py +1 -198
  17. nextmv/cloud/application/_batch_scenario.py +2 -17
  18. nextmv/cloud/application/_input_set.py +42 -6
  19. nextmv/cloud/application/_instance.py +1 -1
  20. nextmv/cloud/application/_managed_input.py +1 -1
  21. nextmv/cloud/application/_shadow.py +10 -4
  22. nextmv/cloud/application/_switchback.py +11 -2
  23. nextmv/cloud/application/_version.py +1 -1
  24. nextmv/cloud/batch_experiment.py +3 -1
  25. nextmv/cloud/community.py +441 -0
  26. nextmv/cloud/shadow.py +25 -0
  27. nextmv/deprecated.py +5 -3
  28. nextmv/input.py +0 -52
  29. nextmv/local/runner.py +1 -1
  30. nextmv/options.py +11 -256
  31. nextmv/output.py +0 -62
  32. nextmv/run.py +1 -10
  33. nextmv/status.py +1 -51
  34. {nextmv-1.0.0.dev4.dist-info → nextmv-1.0.0.dev6.dist-info}/METADATA +3 -1
  35. {nextmv-1.0.0.dev4.dist-info → nextmv-1.0.0.dev6.dist-info}/RECORD +38 -36
  36. {nextmv-1.0.0.dev4.dist-info → nextmv-1.0.0.dev6.dist-info}/WHEEL +0 -0
  37. {nextmv-1.0.0.dev4.dist-info → nextmv-1.0.0.dev6.dist-info}/entry_points.txt +0 -0
  38. {nextmv-1.0.0.dev4.dist-info → nextmv-1.0.0.dev6.dist-info}/licenses/LICENSE +0 -0
nextmv/options.py CHANGED
@@ -24,155 +24,6 @@ from dataclasses import dataclass
24
24
  from typing import Any
25
25
 
26
26
  from nextmv.base_model import BaseModel
27
- from nextmv.deprecated import deprecated
28
-
29
-
30
- @dataclass
31
- class Parameter:
32
- """
33
- !!! warning
34
- `Parameter` is deprecated, use `Option` instead.
35
-
36
- Parameter that is used in a `Configuration`. When a parameter is required,
37
- it is a good practice to provide a default value for it. This is because
38
- the configuration will raise an error if a required parameter is not
39
- provided through a command-line argument, an environment variable or a
40
- default value.
41
-
42
- Parameters
43
- ----------
44
- name : str
45
- The name of the parameter.
46
-
47
- param_type : type
48
- The type of the parameter.
49
-
50
- default : Any, optional
51
- The default value of the parameter. Even though this is optional, it is
52
- recommended to provide a default value for all parameters.
53
-
54
- description : str, optional
55
- An optional description of the parameter. This is useful for generating
56
- help messages for the configuration.
57
-
58
- required : bool, optional
59
- Whether the parameter is required. If a parameter is required, it will
60
- be an error to not provide a value for it, either through a command-line
61
- argument, an environment variable or a default value.
62
-
63
- choices : list[Optional[Any]], optional
64
- Limits values to a specific set of choices.
65
-
66
- Examples
67
- --------
68
- >>> from nextmv.options import Parameter
69
- >>> parameter = Parameter("timeout", int, 60, "The maximum timeout in seconds", required=True)
70
- """
71
-
72
- name: str
73
- """The name of the parameter."""
74
- param_type: type
75
- """The type of the parameter."""
76
-
77
- default: Any | None = None
78
- """The default value of the parameter. Even though this is optional, it is
79
- recommended to provide a default value for all parameters."""
80
- description: str | None = None
81
- """An optional description of the parameter. This is useful for generating
82
- help messages for the configuration."""
83
- required: bool = False
84
- """Whether the parameter is required. If a parameter is required, it will
85
- be an error to not provide a value for it, either trough a command-line
86
- argument, an environment variable or a default value."""
87
- choices: list[Any | None] = None
88
- """Limits values to a specific set of choices."""
89
-
90
- def __post_init__(self):
91
- """
92
- Post-initialization hook that marks this class as deprecated.
93
-
94
- This method is automatically called after the object is initialized.
95
- It displays a deprecation warning to inform users to use the `Option` class instead.
96
- """
97
- deprecated(
98
- name="Parameter",
99
- reason="`Parameter` is deprecated, use `Option` instead",
100
- )
101
-
102
- @classmethod
103
- def from_dict(cls, data: dict[str, Any]) -> "Parameter":
104
- """
105
- !!! warning
106
- `Parameter` is deprecated, use `Option` instead.
107
- `Parameter.from_dict` -> `Option.from_dict`
108
-
109
- Creates an instance of `Parameter` from a dictionary.
110
-
111
- Parameters
112
- ----------
113
- data : dict[str, Any]
114
- The dictionary representation of a parameter.
115
-
116
- Returns
117
- -------
118
- Parameter
119
- An instance of `Parameter`.
120
- """
121
-
122
- deprecated(
123
- name="Parameter.from_dict",
124
- reason="`Parameter` is deprecated, use `Option` instead. Parameter.from_dict -> Option.from_dict",
125
- )
126
-
127
- param_type_string = data["param_type"]
128
- param_type = getattr(builtins, param_type_string.split("'")[1])
129
-
130
- return Parameter(
131
- name=data["name"],
132
- param_type=param_type,
133
- default=data.get("default"),
134
- description=data.get("description"),
135
- required=data.get("required", False),
136
- choices=data.get("choices"),
137
- )
138
-
139
- def to_dict(self) -> dict[str, Any]:
140
- """
141
- !!! warning
142
- `Parameter` is deprecated, use `Option` instead.
143
- `Parameter.to_dict` -> `Option.to_dict`
144
-
145
- Converts the parameter to a dict.
146
-
147
- Returns
148
- -------
149
- dict[str, Any]
150
- The parameter as a dict with its name, type, default value,
151
- description, required flag, and choices.
152
-
153
- Examples
154
- --------
155
- >>> param = Parameter("timeout", int, 60, "Maximum time in seconds", True)
156
- >>> param_dict = param.to_dict()
157
- >>> param_dict["name"]
158
- 'timeout'
159
- >>> param_dict["default"]
160
- 60
161
- """
162
-
163
- deprecated(
164
- name="Parameter.to_dict",
165
- reason="`Parameter` is deprecated, use `Option` instead. Parameter.to_dict -> Option.to_dict",
166
- )
167
-
168
- return {
169
- "name": self.name,
170
- "param_type": str(self.param_type),
171
- "default": self.default,
172
- "description": self.description,
173
- "required": self.required,
174
- "choices": self.choices,
175
- }
176
27
 
177
28
 
178
29
  @dataclass
@@ -425,8 +276,7 @@ class Options:
425
276
  If a required option is not provided through a command-line
426
277
  argument, an environment variable or a default value.
427
278
  TypeError
428
- If an option is not either an `Option` or `Parameter` (deprecated)
429
- object.
279
+ If an option is not an `Option`
430
280
  ValueError
431
281
  If an environment variable is not of the type of the corresponding
432
282
  parameter.
@@ -522,27 +372,6 @@ class Options:
522
372
 
523
373
  return cloud_dict
524
374
 
525
- def parameters_dict(self) -> list[dict[str, Any]]:
526
- """
527
- !!! warning
528
- `Parameter` is deprecated, use `Option` instead. `Options.parameters_dict` -> `Options.options_dict`
529
-
530
- Converts the options to a list of dicts. Each dict is the dict
531
- representation of a `Parameter`.
532
-
533
- Returns
534
- -------
535
- list[dict[str, Any]]
536
- The list of dictionaries (parameter entries).
537
- """
538
-
539
- deprecated(
540
- name="Options.parameters_dict",
541
- reason="`Parameter` is deprecated, use `Option` instead. Options.parameters_dict -> Options.options_dict",
542
- )
543
-
544
- return [param.to_dict() for param in self.options]
545
-
546
375
  def options_dict(self) -> list[dict[str, Any]]:
547
376
  """
548
377
  Converts the `Options` to a list of dicts. Each dict is the dict
@@ -606,7 +435,7 @@ class Options:
606
435
  If a required option is not provided through a command-line
607
436
  argument, an environment variable or a default value.
608
437
  TypeError
609
- If an option is not an `Option` or `Parameter` (deprecated) object.
438
+ If an option is not an `Option` object.
610
439
  ValueError
611
440
  If an environment variable is not of the type of the corresponding
612
441
  parameter.
@@ -728,41 +557,6 @@ class Options:
728
557
 
729
558
  return cls(*options)
730
559
 
731
- @classmethod
732
- def from_parameters_dict(cls, parameters_dict: list[dict[str, Any]]) -> "Options":
733
- """
734
- !!! warning
735
-
736
- `Parameter` is deprecated, use `Option` instead.
737
- `Options.from_parameters_dict` -> `Options.from_options_dict`
738
-
739
- Creates an instance of `Options` from parameters in dict form. Each
740
- entry is the dict representation of a `Parameter`.
741
-
742
- Parameters
743
- ----------
744
- parameters_dict : list[dict[str, Any]]
745
- The list of dictionaries (parameter entries).
746
-
747
- Returns
748
- -------
749
- Options
750
- An instance of `Options`.
751
- """
752
-
753
- deprecated(
754
- name="Options.from_parameters_dict",
755
- reason="`Parameter` is deprecated, use `Option` instead. "
756
- "Options.from_parameters_dict -> Options.from_options_dict",
757
- )
758
-
759
- parameters = []
760
- for parameter_dict in parameters_dict:
761
- parameter = Parameter.from_dict(parameter_dict)
762
- parameters.append(parameter)
763
-
764
- return cls(*parameters)
765
-
766
560
  @classmethod
767
561
  def from_options_dict(cls, options_dict: list[dict[str, Any]]) -> "Options":
768
562
  """
@@ -837,7 +631,7 @@ class Options:
837
631
  If a required option is not provided through a command-line
838
632
  argument, an environment variable or a default value.
839
633
  TypeError
840
- If an option is not an `Option` or `Parameter` (deprecated) object.
634
+ If an option is not an `Option` object.
841
635
  ValueError
842
636
  If an environment variable is not of the type of the corresponding
843
637
  parameter.
@@ -858,10 +652,8 @@ class Options:
858
652
  options_by_field_name: dict[str, Option] = {}
859
653
 
860
654
  for ix, option in enumerate(self.options):
861
- if not isinstance(option, Option) and not isinstance(option, Parameter):
862
- raise TypeError(
863
- f"expected an <Option> (or deprecated <Parameter>) object, but got {type(option)} in index {ix}"
864
- )
655
+ if not isinstance(option, Option):
656
+ raise TypeError(f"expected an <Option> object, but got {type(option)} in index {ix}")
865
657
 
866
658
  # See comment below about ipykernel adding a `-f` argument. We
867
659
  # restrict options from having the name 'f' or 'fff' for that
@@ -876,7 +668,7 @@ class Options:
876
668
  option.name = option.name.lstrip("-")
877
669
 
878
670
  kwargs = {
879
- "type": self._option_type(option) if self._option_type(option) is not bool else str,
671
+ "type": option.option_type if option.option_type is not bool else str,
880
672
  "help": self._description(option),
881
673
  }
882
674
 
@@ -903,7 +695,7 @@ class Options:
903
695
  help=argparse.SUPPRESS,
904
696
  default="1",
905
697
  )
906
- args = parser.parse_args()
698
+ args, _ = parser.parse_known_args()
907
699
 
908
700
  for arg in vars(args):
909
701
  if arg == "fff" or arg == "f":
@@ -925,12 +717,10 @@ class Options:
925
717
  env_value = os.getenv(upper_name)
926
718
  if env_value is not None:
927
719
  try:
928
- typed_env_value = (
929
- self._option_type(option)(env_value) if self._option_type(option) is not bool else env_value
930
- )
720
+ typed_env_value = option.option_type(env_value) if option.option_type is not bool else env_value
931
721
  except ValueError:
932
722
  raise ValueError(
933
- f'environment variable "{upper_name}" is not of type {self._option_type(option)}'
723
+ f'environment variable "{upper_name}" is not of type {option.option_type}'
934
724
  ) from None
935
725
 
936
726
  value = self._option_value(option, typed_env_value)
@@ -968,8 +758,6 @@ class Options:
968
758
  """
969
759
 
970
760
  description = ""
971
- if isinstance(option, Parameter):
972
- description = "DEPRECATED (initialized with <Parameter>, use <Option> instead) "
973
761
 
974
762
  description += f"[env var: {option.name.upper()}]"
975
763
 
@@ -979,7 +767,7 @@ class Options:
979
767
  if option.default is not None:
980
768
  description += f" (default: {option.default})"
981
769
 
982
- description += f" (type: {self._option_type(option).__name__})"
770
+ description += f" (type: {option.option_type.__name__})"
983
771
 
984
772
  if isinstance(option, Option) and option.additional_attributes is not None:
985
773
  description += f" (additional attributes: {option.additional_attributes})"
@@ -1020,7 +808,7 @@ class Options:
1020
808
  other values are converted to False.
1021
809
  """
1022
810
 
1023
- opt_type = self._option_type(option)
811
+ opt_type = option.option_type
1024
812
  if opt_type is not bool:
1025
813
  return value
1026
814
 
@@ -1031,39 +819,6 @@ class Options:
1031
819
 
1032
820
  return False
1033
821
 
1034
- @staticmethod
1035
- def _option_type(option: Option | Parameter) -> type:
1036
- """
1037
- Get the type of an option.
1038
-
1039
- This auxiliary function was introduced for backwards compatibility with
1040
- the deprecated `Parameter` class. Once `Parameter` is removed, this function
1041
- can be removed as well. When the function is removed, use the
1042
- `option.option_type` attribute directly, instead of calling this function.
1043
-
1044
- Parameters
1045
- ----------
1046
- option : Union[Option, Parameter]
1047
- The option to get the type for.
1048
-
1049
- Returns
1050
- -------
1051
- type
1052
- The type of the option.
1053
-
1054
- Raises
1055
- ------
1056
- TypeError
1057
- If the option is not an `Option` or `Parameter` object.
1058
- """
1059
-
1060
- if isinstance(option, Option):
1061
- return option.option_type
1062
- elif isinstance(option, Parameter):
1063
- return option.param_type
1064
- else:
1065
- raise TypeError(f"expected an <Option> (or deprecated <Parameter>) object, but got {type(option)}")
1066
-
1067
822
 
1068
823
  class OptionsEnforcement:
1069
824
  """
nextmv/output.py CHANGED
@@ -66,7 +66,6 @@ from pydantic import AliasChoices, Field
66
66
 
67
67
  from nextmv._serialization import serialize_json
68
68
  from nextmv.base_model import BaseModel
69
- from nextmv.deprecated import deprecated
70
69
  from nextmv.logger import reset_stdout
71
70
  from nextmv.options import Options
72
71
 
@@ -1518,67 +1517,6 @@ class LocalOutputWriter(OutputWriter):
1518
1517
  )
1519
1518
 
1520
1519
 
1521
- def write_local(
1522
- output: Output | dict[str, Any],
1523
- path: str | None = None,
1524
- skip_stdout_reset: bool = False,
1525
- ) -> None:
1526
- """
1527
- !!! warning
1528
- `write_local` is deprecated, use `write` instead.
1529
-
1530
- Write the output to the local filesystem or stdout.
1531
-
1532
- This is a convenience function for instantiating a `LocalOutputWriter` and
1533
- calling its `write` method.
1534
-
1535
- Parameters
1536
- ----------
1537
- output : Union[Output, dict[str, Any]]
1538
- Output data to write. Can be an Output object or a dictionary.
1539
- path : str, optional
1540
- Path to write the output data to. The interpretation depends on the
1541
- output format:
1542
-
1543
- - For `OutputFormat.JSON`: File path for the JSON output. If None or
1544
- empty, writes to stdout.
1545
- - For `OutputFormat.CSV_ARCHIVE`: Directory path for CSV files. If None
1546
- or empty, writes to a directory named "output" in the current working
1547
- directory.
1548
- skip_stdout_reset : bool, optional
1549
- Skip resetting stdout before writing the output data. Default is False.
1550
-
1551
- Raises
1552
- ------
1553
- ValueError
1554
- If the Output.output_format is not supported.
1555
- TypeError
1556
- If the output is of an unsupported type.
1557
-
1558
- Notes
1559
- -----
1560
- This function detects if stdout was redirected and resets it to avoid
1561
- unexpected behavior. If you want to skip this behavior, set the
1562
- skip_stdout_reset parameter to True.
1563
-
1564
- Examples
1565
- --------
1566
- >>> from nextmv.output import write_local, Output
1567
- >>> # Write JSON to a file
1568
- >>> write_local(Output(solution={"result": 42}), path="result.json")
1569
- >>> # Write JSON to stdout
1570
- >>> write_local({"simple": "data"})
1571
- """
1572
-
1573
- deprecated(
1574
- name="write_local",
1575
- reason="`write_local` is deprecated, use `write` instead",
1576
- )
1577
-
1578
- writer = LocalOutputWriter()
1579
- writer.write(output, path, skip_stdout_reset)
1580
-
1581
-
1582
1520
  _LOCAL_OUTPUT_WRITER = LocalOutputWriter()
1583
1521
  """Default LocalOutputWriter instance used by the write function."""
1584
1522
 
nextmv/run.py CHANGED
@@ -53,7 +53,7 @@ from nextmv._serialization import serialize_json
53
53
  from nextmv.base_model import BaseModel
54
54
  from nextmv.input import Input, InputFormat
55
55
  from nextmv.output import Asset, Output, OutputFormat, Statistics
56
- from nextmv.status import Status, StatusV2
56
+ from nextmv.status import StatusV2
57
57
 
58
58
 
59
59
  def run_duration(start: datetime | float, end: datetime | float) -> int:
@@ -520,8 +520,6 @@ class Run(BaseModel):
520
520
  Class name for the execution of a job.
521
521
  runtime : str
522
522
  Runtime environment for the run.
523
- status : Status
524
- Deprecated, use status_v2 instead.
525
523
  status_v2 : StatusV2
526
524
  Status of the run.
527
525
  queuing_priority : int, optional
@@ -598,8 +596,6 @@ class Run(BaseModel):
598
596
  status_v2: StatusV2
599
597
  """Status of the run."""
600
598
 
601
- status: Status | None = None
602
- """Deprecated, use status_v2 instead."""
603
599
  queuing_priority: int | None = None
604
600
  """Priority of the run in the queue."""
605
601
  queuing_disabled: bool | None = None
@@ -656,8 +652,6 @@ class Metadata(BaseModel):
656
652
  Size of the output in bytes.
657
653
  format : Format
658
654
  Format of the input and output of the run.
659
- status : Status
660
- Deprecated: use status_v2.
661
655
  status_v2 : StatusV2
662
656
  Status of the run.
663
657
  """
@@ -682,8 +676,6 @@ class Metadata(BaseModel):
682
676
  """Format of the input and output of the run."""
683
677
  status_v2: StatusV2
684
678
  """Status of the run."""
685
- status: Status | None = None
686
- """Deprecated: use status_v2."""
687
679
  statistics: dict[str, Any] | None = None
688
680
  """User defined statistics of the run."""
689
681
 
@@ -867,7 +859,6 @@ class RunInformation(BaseModel):
867
859
  run_type=RunTypeConfiguration(), # Default empty configuration
868
860
  execution_class="", # Not available in RunInformation
869
861
  runtime="", # Not available in RunInformation
870
- status=self.metadata.status,
871
862
  status_v2=self.metadata.status_v2,
872
863
  # Optional fields that are not available in RunInformation
873
864
  queuing_priority=None,
nextmv/status.py CHANGED
@@ -2,13 +2,10 @@
2
2
  Provides status enums for Nextmv application runs.
3
3
 
4
4
  This module defines enumerations for representing the status of a run in a
5
- Nextmv application. It includes a deprecated `Status` enum and the current
6
- `StatusV2` enum.
5
+ Nextmv application.
7
6
 
8
7
  Classes
9
8
  -------
10
- Status
11
- Deprecated status of a run.
12
9
  StatusV2
13
10
  Represents the status of a run.
14
11
  """
@@ -16,53 +13,6 @@ StatusV2
16
13
  from enum import Enum
17
14
 
18
15
 
19
- class Status(str, Enum):
20
- """
21
- !!! warning
22
- `Status` is deprecated, use `StatusV2` instead.
23
-
24
- Status of a run.
25
-
26
- You can import the `Status` class directly from `nextmv`:
27
-
28
- ```python
29
- from nextmv import Status
30
- ```
31
-
32
- This enum represents the possible states of a run. It is deprecated and
33
- `StatusV2` should be used for new implementations.
34
-
35
- Attributes
36
- ----------
37
- failed : str
38
- Run failed.
39
- running : str
40
- Run is running.
41
- succeeded : str
42
- Run succeeded.
43
-
44
- Examples
45
- --------
46
- >>> from nextmv.cloud import Status
47
- >>> current_status = Status.running
48
- >>> if current_status == Status.succeeded:
49
- ... print("Run completed successfully.")
50
- ... elif current_status == Status.failed:
51
- ... print("Run failed.")
52
- ... else:
53
- ... print(f"Run is currently {current_status.value}.")
54
- Run is currently running.
55
-
56
- """
57
-
58
- failed = "failed"
59
- """Run failed."""
60
- running = "running"
61
- """Run is running."""
62
- succeeded = "succeeded"
63
- """Run succeeded."""
64
-
65
-
66
16
  class StatusV2(str, Enum):
67
17
  """
68
18
  Status of a run.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nextmv
3
- Version: 1.0.0.dev4
3
+ Version: 1.0.0.dev6
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/
@@ -230,11 +230,13 @@ Provides-Extra: dev
230
230
  Requires-Dist: build>=1.0.3; extra == 'dev'
231
231
  Requires-Dist: folium>=0.20.0; extra == 'dev'
232
232
  Requires-Dist: mlflow>=2.19.0; extra == 'dev'
233
+ Requires-Dist: nextpipe>=0.6.0.dev0; extra == 'dev'
233
234
  Requires-Dist: nextroute>=1.11.1; extra == 'dev'
234
235
  Requires-Dist: openpyxl>=3.1.5; extra == 'dev'
235
236
  Requires-Dist: pandas>=2.2.3; extra == 'dev'
236
237
  Requires-Dist: plotly>=6.0.1; extra == 'dev'
237
238
  Requires-Dist: pydantic>=2.5.2; extra == 'dev'
239
+ Requires-Dist: pytest>=9.0.2; extra == 'dev'
238
240
  Requires-Dist: pyyaml>=6.0.1; extra == 'dev'
239
241
  Requires-Dist: requests>=2.31.0; extra == 'dev'
240
242
  Requires-Dist: ruff>=0.1.7; extra == 'dev'