nextmv 0.10.3.dev0__py3-none-any.whl → 0.35.0__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 (61) hide show
  1. nextmv/__about__.py +1 -1
  2. nextmv/__entrypoint__.py +39 -0
  3. nextmv/__init__.py +57 -0
  4. nextmv/_serialization.py +96 -0
  5. nextmv/base_model.py +79 -9
  6. nextmv/cloud/__init__.py +71 -10
  7. nextmv/cloud/acceptance_test.py +888 -17
  8. nextmv/cloud/account.py +154 -10
  9. nextmv/cloud/application.py +3644 -437
  10. nextmv/cloud/batch_experiment.py +292 -33
  11. nextmv/cloud/client.py +354 -53
  12. nextmv/cloud/ensemble.py +247 -0
  13. nextmv/cloud/input_set.py +121 -4
  14. nextmv/cloud/instance.py +125 -0
  15. nextmv/cloud/package.py +474 -0
  16. nextmv/cloud/scenario.py +410 -0
  17. nextmv/cloud/secrets.py +234 -0
  18. nextmv/cloud/url.py +73 -0
  19. nextmv/cloud/version.py +174 -0
  20. nextmv/default_app/.gitignore +1 -0
  21. nextmv/default_app/README.md +32 -0
  22. nextmv/default_app/app.yaml +12 -0
  23. nextmv/default_app/input.json +5 -0
  24. nextmv/default_app/main.py +37 -0
  25. nextmv/default_app/requirements.txt +2 -0
  26. nextmv/default_app/src/__init__.py +0 -0
  27. nextmv/default_app/src/main.py +37 -0
  28. nextmv/default_app/src/visuals.py +36 -0
  29. nextmv/deprecated.py +47 -0
  30. nextmv/input.py +883 -78
  31. nextmv/local/__init__.py +5 -0
  32. nextmv/local/application.py +1263 -0
  33. nextmv/local/executor.py +1040 -0
  34. nextmv/local/geojson_handler.py +323 -0
  35. nextmv/local/local.py +97 -0
  36. nextmv/local/plotly_handler.py +61 -0
  37. nextmv/local/runner.py +274 -0
  38. nextmv/logger.py +80 -9
  39. nextmv/manifest.py +1472 -0
  40. nextmv/model.py +431 -0
  41. nextmv/options.py +968 -78
  42. nextmv/output.py +1363 -231
  43. nextmv/polling.py +287 -0
  44. nextmv/run.py +1623 -0
  45. nextmv/safe.py +145 -0
  46. nextmv/status.py +122 -0
  47. {nextmv-0.10.3.dev0.dist-info → nextmv-0.35.0.dist-info}/METADATA +51 -288
  48. nextmv-0.35.0.dist-info/RECORD +50 -0
  49. {nextmv-0.10.3.dev0.dist-info → nextmv-0.35.0.dist-info}/WHEEL +1 -1
  50. nextmv/cloud/status.py +0 -29
  51. nextmv/nextroute/__init__.py +0 -2
  52. nextmv/nextroute/check/__init__.py +0 -26
  53. nextmv/nextroute/check/schema.py +0 -141
  54. nextmv/nextroute/schema/__init__.py +0 -19
  55. nextmv/nextroute/schema/input.py +0 -52
  56. nextmv/nextroute/schema/location.py +0 -13
  57. nextmv/nextroute/schema/output.py +0 -136
  58. nextmv/nextroute/schema/stop.py +0 -61
  59. nextmv/nextroute/schema/vehicle.py +0 -68
  60. nextmv-0.10.3.dev0.dist-info/RECORD +0 -28
  61. {nextmv-0.10.3.dev0.dist-info → nextmv-0.35.0.dist-info}/licenses/LICENSE +0 -0
nextmv/cloud/account.py CHANGED
@@ -1,14 +1,83 @@
1
+ """
2
+ Account management functionality for the Nextmv Cloud API.
3
+
4
+ This module provides classes for interacting with account-level resources
5
+ in the Nextmv Platform, particularly for accessing and managing the queue
6
+ of runs.
7
+
8
+ Classes
9
+ -------
10
+ QueuedRun
11
+ A run that is pending to be executed in the account.
12
+ Queue
13
+ A list of runs that are pending or currently being executed.
14
+ Account
15
+ The Nextmv Platform account with API access methods.
16
+ """
17
+
1
18
  from dataclasses import dataclass
2
19
  from datetime import datetime
3
- from typing import List
4
20
 
5
21
  from nextmv.base_model import BaseModel
6
22
  from nextmv.cloud.client import Client
7
- from nextmv.cloud.status import Status, StatusV2
23
+ from nextmv.status import Status, StatusV2
8
24
 
9
25
 
10
26
  class QueuedRun(BaseModel):
11
- """A run that is pending to be executed in the account."""
27
+ """A run that is pending to be executed in the account.
28
+
29
+ You can import the `QueuedRun` class directly from `cloud`:
30
+
31
+ ```python
32
+ from nextmv.cloud import QueuedRun
33
+ ```
34
+
35
+ Represents details of a run in the queue, including its status and metadata.
36
+ QueuedRun objects are typically obtained through the Account.queue() method.
37
+
38
+ Attributes
39
+ ----------
40
+ id : str
41
+ ID of the run.
42
+ user_email : str
43
+ Email of the user who created the run.
44
+ name : str
45
+ Name of the run.
46
+ description : str
47
+ Description of the run.
48
+ created_at : datetime
49
+ Creation date of the run.
50
+ application_id : str
51
+ ID of the application used for the run.
52
+ application_instance_id : str
53
+ ID of the application instance used for the run.
54
+ application_version_id : str
55
+ ID of the application version used for the run.
56
+ execution_class : str
57
+ Execution class used for the run.
58
+ status : Status
59
+ Deprecated: use status_v2.
60
+ status_v2 : StatusV2
61
+ Status of the run.
62
+
63
+ Examples
64
+ --------
65
+ >>> queued_run = QueuedRun.from_dict({
66
+ ... "id": "run-123456",
67
+ ... "user_email": "user@example.com",
68
+ ... "name": "My Run",
69
+ ... "description": "Test run",
70
+ ... "created_at": "2023-01-01T12:00:00Z",
71
+ ... "application_id": "app-123456",
72
+ ... "application_instance_id": "appins-123456",
73
+ ... "application_version_id": "appver-123456",
74
+ ... "execution_class": "standard",
75
+ ... "status": "RUNNING",
76
+ ... "status_v2": "RUNNING"
77
+ ... })
78
+ >>> print(queued_run.name)
79
+ My Run
80
+ """
12
81
 
13
82
  id: str
14
83
  """ID of the run."""
@@ -36,15 +105,74 @@ class QueuedRun(BaseModel):
36
105
 
37
106
  class Queue(BaseModel):
38
107
  """A queue is a list of runs that are pending to be executed, or currently
39
- being executed, in the account."""
108
+ being executed, in the account.
109
+
110
+ You can import the `Queue` class directly from `cloud`:
111
+
112
+ ```python
113
+ from nextmv.cloud import Queue
114
+ ```
115
+
116
+ The Queue object provides access to a list of queued runs in a Nextmv account.
117
+ It is typically obtained through the Account.queue() method.
40
118
 
41
- runs: List[QueuedRun]
119
+ Attributes
120
+ ----------
121
+ runs : list[QueuedRun]
122
+ List of runs in the queue.
123
+
124
+ Examples
125
+ --------
126
+ >>> account = Account(client=Client(api_key="your-api-key"))
127
+ >>> queue = account.queue()
128
+ >>> print(f"Number of runs in queue: {len(queue.runs)}")
129
+ Number of runs in queue: 5
130
+ >>> # Accessing the first run in the queue
131
+ >>> if queue.runs:
132
+ ... print(f"First run: {queue.runs[0].name}")
133
+ First run: My Priority Run
134
+ """
135
+
136
+ runs: list[QueuedRun]
42
137
  """List of runs in the queue."""
43
138
 
44
139
 
45
140
  @dataclass
46
141
  class Account:
47
- """The Nextmv Platform account."""
142
+ """The Nextmv Platform account.
143
+
144
+ You can import the `Account` class directly from `cloud`:
145
+
146
+ ```python
147
+ from nextmv.cloud import Account
148
+ ```
149
+
150
+ This class provides access to account-level operations in the Nextmv Platform,
151
+ such as retrieving the queue of runs.
152
+
153
+ Parameters
154
+ ----------
155
+ client : Client
156
+ Client to use for interacting with the Nextmv Cloud API.
157
+ endpoint : str, optional
158
+ Base endpoint for the account, by default "v1/account"
159
+
160
+ Attributes
161
+ ----------
162
+ client : Client
163
+ Client to use for interacting with the Nextmv Cloud API.
164
+ endpoint : str
165
+ Base endpoint for the account.
166
+
167
+ Examples
168
+ --------
169
+ >>> from nextmv.cloud import Client, Account
170
+ >>> client = Client(api_key="your-api-key")
171
+ >>> account = Account(client=client)
172
+ >>> queue = account.queue()
173
+ >>> print(f"Number of runs in queue: {len(queue.runs)}")
174
+ Number of runs in queue: 3
175
+ """
48
176
 
49
177
  client: Client
50
178
  """Client to use for interacting with the Nextmv Cloud API."""
@@ -55,11 +183,27 @@ class Account:
55
183
  def queue(self) -> Queue:
56
184
  """Get the queue of runs in the account.
57
185
 
58
- Returns:
59
- Queue: Queue of runs in the account.
186
+ Retrieves the current list of runs that are pending or being executed
187
+ in the Nextmv account.
188
+
189
+ Returns
190
+ -------
191
+ Queue
192
+ Queue of runs in the account.
193
+
194
+ Raises
195
+ ------
196
+ requests.HTTPError
197
+ If the response status code is not 2xx.
60
198
 
61
- Raises:
62
- requests.HTTPError: If the response status code is not 2xx.
199
+ Examples
200
+ --------
201
+ >>> account = Account(client=Client(api_key="your-api-key"))
202
+ >>> queue = account.queue()
203
+ >>> for run in queue.runs:
204
+ ... print(f"Run {run.id}: {run.name} - Status: {run.status_v2}")
205
+ Run run-123: Daily Optimization - Status: RUNNING
206
+ Run run-456: Weekly Planning - Status: QUEUED
63
207
  """
64
208
  response = self.client.request(
65
209
  method="GET",