peak-sdk 1.11.0__py3-none-any.whl → 1.13.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 (48) hide show
  1. peak/__init__.py +3 -2
  2. peak/_metadata.py +185 -1
  3. peak/_version.py +1 -1
  4. peak/callbacks.py +22 -2
  5. peak/cli/cli.py +2 -0
  6. peak/cli/helpers.py +2 -0
  7. peak/cli/metrics/__init__.py +21 -0
  8. peak/cli/metrics/metrics.py +707 -0
  9. peak/cli/press/apps/deployments.py +12 -6
  10. peak/cli/press/apps/specs.py +20 -0
  11. peak/cli/press/blocks/deployments.py +5 -6
  12. peak/cli/press/blocks/specs.py +2 -0
  13. peak/cli/press/deployments.py +49 -3
  14. peak/cli/resources/services.py +20 -5
  15. peak/handler.py +16 -7
  16. peak/metrics/__init__.py +26 -0
  17. peak/metrics/metrics.py +553 -0
  18. peak/output.py +9 -1
  19. peak/press/apps.py +100 -5
  20. peak/press/blocks.py +2 -0
  21. peak/press/deployments.py +35 -0
  22. peak/resources/__init__.py +10 -1
  23. peak/resources/services.py +5 -2
  24. peak/sample_yaml/metrics/create_collection.yaml +8 -0
  25. peak/sample_yaml/metrics/publish.yaml +6 -0
  26. peak/sample_yaml/metrics/query.yaml +25 -0
  27. peak/sample_yaml/press/apps/deployments/create_app_deployment.yaml +12 -0
  28. peak/sample_yaml/press/apps/deployments/create_app_deployment_revision.yaml +12 -0
  29. peak/sample_yaml/press/apps/specs/create_app_spec.yaml +63 -0
  30. peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml +63 -0
  31. peak/sample_yaml/press/blocks/specs/service/api/create_block_spec.yaml +28 -28
  32. peak/sample_yaml/press/blocks/specs/service/api/create_block_spec_release.yaml +28 -28
  33. peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec.yaml +29 -28
  34. peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec_release.yaml +29 -28
  35. peak/sample_yaml/press/blocks/specs/workflow/create_block_spec.yaml +32 -32
  36. peak/sample_yaml/press/blocks/specs/workflow/create_block_spec_release.yaml +32 -32
  37. peak/sample_yaml/press/patch_parameters.yaml +9 -0
  38. peak/sample_yaml/resources/services/create_or_update_service.yaml +1 -0
  39. peak/sample_yaml/resources/services/create_service.yaml +1 -0
  40. peak/sample_yaml/resources/services/update_service.yaml +1 -0
  41. peak/sample_yaml/resources/webapps/create_or_update_webapp.yaml +1 -0
  42. peak/sample_yaml/resources/webapps/create_webapp.yaml +1 -0
  43. peak/sample_yaml/resources/webapps/update_webapp.yaml +1 -0
  44. {peak_sdk-1.11.0.dist-info → peak_sdk-1.13.0.dist-info}/METADATA +45 -7
  45. {peak_sdk-1.11.0.dist-info → peak_sdk-1.13.0.dist-info}/RECORD +48 -40
  46. {peak_sdk-1.11.0.dist-info → peak_sdk-1.13.0.dist-info}/LICENSE +0 -0
  47. {peak_sdk-1.11.0.dist-info → peak_sdk-1.13.0.dist-info}/WHEEL +0 -0
  48. {peak_sdk-1.11.0.dist-info → peak_sdk-1.13.0.dist-info}/entry_points.txt +0 -0
@@ -26,16 +26,18 @@ body:
26
26
  minInstances: 1
27
27
  parameters:
28
28
  build:
29
- - defaultValue: /health
30
- description: Enter the health check URL
31
- name: health_check_url
29
+ - name: health_check_url
30
+ type: string
32
31
  required: true
33
32
  title: Health Check URL
34
- type: string
33
+ description: Enter the health check URL
34
+ defaultValue: /health
35
35
  hideValue: false
36
- - defaultValue: 20
36
+ - name: instance_type_id
37
+ type: number
38
+ required: true
39
+ title: Instance Type ID
37
40
  description: Select an instance type
38
- name: instance_type_id
39
41
  options:
40
42
  - title: Pico (0.125CPU, 0.125GB RAM)
41
43
  value: 20
@@ -43,26 +45,26 @@ parameters:
43
45
  value: 21
44
46
  - title: Micro (0.5CPU, 1GB RAM)
45
47
  value: 22
46
- required: true
47
- title: Instance Type ID
48
- type: number
48
+ defaultValue: 20
49
49
  run:
50
- - defaultValue: AVG
51
- description: Select an aggregation function (e.g., AVG, SUM, COUNT)
52
- name: agg_type
50
+ - name: agg_type
51
+ type: string
53
52
  required: false
54
53
  title: Agg Type
55
- type: string
54
+ description: Select an aggregation function (e.g., AVG, SUM, COUNT)
55
+ defaultValue: AVG
56
56
  hideValue: true
57
- - defaultValue: false
58
- description: Enable email notifications
59
- name: email_notifications
57
+ - name: email_notifications
58
+ type: boolean
60
59
  required: false
61
60
  title: Email Notifications
62
- type: boolean
63
- - defaultValue: 10
61
+ description: Enable email notifications
62
+ defaultValue: false
63
+ - name: num_iterations
64
+ type: number
65
+ required: false
66
+ title: Number of Iterations
64
67
  description: Select the number of iterations
65
- name: num_iterations
66
68
  options:
67
69
  - title: Low
68
70
  value: 10
@@ -70,17 +72,15 @@ parameters:
70
72
  value: 50
71
73
  - title: High
72
74
  value: 100
73
- required: false
74
- title: Number of Iterations
75
- type: number
76
- - defaultValue:
77
- - input.csv
78
- - output.csv
79
- description: Specify input and output file names
80
- name: file_names
75
+ defaultValue: 10
76
+ - name: file_names
77
+ type: string_array
81
78
  required: true
82
79
  title: File Names
83
- type: string_array
80
+ description: Specify input and output file names
81
+ defaultValue:
82
+ - input.csv
83
+ - output.csv
84
84
  artifact:
85
85
  path: "."
86
86
  ignore_files:
@@ -30,22 +30,25 @@ body:
30
30
  instanceTypeId: "@param:instance_type_id"
31
31
  healthCheckURL: "@param:health_check_url"
32
32
  sessionStickiness: false
33
+ scaleToZero: true
33
34
  entrypoint: |
34
35
  python
35
36
  app.py
36
37
  minInstances: 1
37
38
  parameters:
38
39
  build:
39
- - defaultValue: /health
40
- description: Enter the health check URL
41
- name: health_check_url
40
+ - name: health_check_url
41
+ type: string
42
42
  required: true
43
43
  title: Health Check URL
44
- type: string
44
+ description: Enter the health check URL
45
+ defaultValue: /health
45
46
  hideValue: false
46
- - defaultValue: 43
47
+ - name: instance_type_id
48
+ type: number
49
+ required: true
50
+ title: Instance Type ID
47
51
  description: Select an instance type
48
- name: instance_type_id
49
52
  options:
50
53
  - title: Pico (0.25CPU, 0.5GB RAM)
51
54
  value: 43
@@ -53,26 +56,26 @@ parameters:
53
56
  value: 44
54
57
  - title: Micro (0.5CPU, 1GB RAM)
55
58
  value: 45
56
- required: true
57
- title: Instance Type ID
58
- type: number
59
+ defaultValue: 43
59
60
  run:
60
- - defaultValue: AVG
61
- description: Select an aggregation function (e.g., AVG, SUM, COUNT)
62
- name: agg_type
61
+ - name: agg_type
62
+ type: string
63
63
  required: false
64
64
  title: Agg Type
65
- type: string
65
+ description: Select an aggregation function (e.g., AVG, SUM, COUNT)
66
+ defaultValue: AVG
66
67
  hideValue: true
67
- - defaultValue: false
68
- description: Enable email notifications
69
- name: email_notifications
68
+ - name: email_notifications
69
+ type: boolean
70
70
  required: false
71
71
  title: Email Notifications
72
- type: boolean
73
- - defaultValue: 10
72
+ description: Enable email notifications
73
+ defaultValue: false
74
+ - name: num_iterations
75
+ type: number
76
+ required: false
77
+ title: Number of Iterations
74
78
  description: Select the number of iterations
75
- name: num_iterations
76
79
  options:
77
80
  - title: Low
78
81
  value: 10
@@ -80,17 +83,15 @@ parameters:
80
83
  value: 50
81
84
  - title: High
82
85
  value: 100
83
- required: false
84
- title: Number of Iterations
85
- type: number
86
- - defaultValue:
87
- - input.csv
88
- - output.csv
89
- description: Specify input and output file names
90
- name: file_names
86
+ defaultValue: 10
87
+ - name: file_names
88
+ type: string_array
91
89
  required: true
92
90
  title: File Names
93
- type: string_array
91
+ description: Specify input and output file names
92
+ defaultValue:
93
+ - input.csv
94
+ - output.csv
94
95
  artifact:
95
96
  path: "."
96
97
  ignore_files:
@@ -21,22 +21,25 @@ body:
21
21
  instanceTypeId: "@param:instance_type_id"
22
22
  healthCheckURL: "@param:health_check_url"
23
23
  sessionStickiness: false
24
+ scaleToZero: true
24
25
  entrypoint: |
25
26
  python
26
27
  app.py
27
28
  minInstances: 1
28
29
  parameters:
29
30
  build:
30
- - defaultValue: /health
31
- description: Enter the health check URL
32
- name: health_check_url
31
+ - name: health_check_url
32
+ type: string
33
33
  required: true
34
34
  title: Health Check URL
35
- type: string
35
+ description: Enter the health check URL
36
+ defaultValue: /health
36
37
  hideValue: false
37
- - defaultValue: 43
38
+ - name: instance_type_id
39
+ type: number
40
+ required: true
41
+ title: Instance Type ID
38
42
  description: Select an instance type
39
- name: instance_type_id
40
43
  options:
41
44
  - title: Pico (0.25CPU, 0.5GB RAM)
42
45
  value: 43
@@ -44,26 +47,26 @@ parameters:
44
47
  value: 44
45
48
  - title: Micro (0.5CPU, 1GB RAM)
46
49
  value: 45
47
- required: true
48
- title: Instance Type ID
49
- type: number
50
+ defaultValue: 43
50
51
  run:
51
- - defaultValue: AVG
52
- description: Select an aggregation function (e.g., AVG, SUM, COUNT)
53
- name: agg_type
52
+ - name: agg_type
53
+ type: string
54
54
  required: false
55
55
  title: Agg Type
56
- type: string
56
+ description: Select an aggregation function (e.g., AVG, SUM, COUNT)
57
+ defaultValue: AVG
57
58
  hideValue: true
58
- - defaultValue: false
59
- description: Enable email notifications
60
- name: email_notifications
59
+ - name: email_notifications
60
+ type: boolean
61
61
  required: false
62
62
  title: Email Notifications
63
- type: boolean
64
- - defaultValue: 10
63
+ description: Enable email notifications
64
+ defaultValue: false
65
+ - name: num_iterations
66
+ type: number
67
+ required: false
68
+ title: Number of Iterations
65
69
  description: Select the number of iterations
66
- name: num_iterations
67
70
  options:
68
71
  - title: Low
69
72
  value: 10
@@ -71,17 +74,15 @@ parameters:
71
74
  value: 50
72
75
  - title: High
73
76
  value: 100
74
- required: false
75
- title: Number of Iterations
76
- type: number
77
- - defaultValue:
78
- - input.csv
79
- - output.csv
80
- description: Specify input and output file names
81
- name: file_names
77
+ defaultValue: 10
78
+ - name: file_names
79
+ type: string_array
82
80
  required: true
83
81
  title: File Names
84
- type: string_array
82
+ description: Specify input and output file names
83
+ defaultValue:
84
+ - input.csv
85
+ - output.csv
85
86
  artifact:
86
87
  path: "."
87
88
  ignore_files:
@@ -111,22 +111,24 @@ body:
111
111
  runtimeExceeded: "@param:runtime_exceeded"
112
112
  parameters:
113
113
  build:
114
- - defaultValue: user@peak.ai
115
- description: Set the watcher user email
116
- name: watcher_user
114
+ - name: watcher_user
115
+ type: string
117
116
  required: true
118
117
  title: Watcher User Email
119
- type: string
118
+ description: Set the watcher user email
119
+ defaultValue: user@peak.ai
120
120
  hideValue: false
121
- - defaultValue: false
122
- description: Enable image caching for the workflow
123
- name: use_cache
121
+ - name: use_cache
122
+ type: boolean
124
123
  required: false
125
124
  title: Image Caching
126
- type: boolean
127
- - defaultValue: 10
125
+ description: Enable image caching for the workflow
126
+ defaultValue: false
127
+ - name: runtime_exceeded
128
+ type: number
129
+ required: false
130
+ title: Runtime Exceeded
128
131
  description: Select the runtime exceeded value to trigger a failed notification for the workflow (in minutes)
129
- name: runtime_exceeded
130
132
  options:
131
133
  - title: Low
132
134
  value: 10
@@ -134,26 +136,26 @@ parameters:
134
136
  value: 50
135
137
  - title: High
136
138
  value: 100
137
- required: false
138
- title: Runtime Exceeded
139
- type: number
139
+ defaultValue: 10
140
140
  run:
141
- - defaultValue: AVG
142
- description: Select an aggregation function (e.g., AVG, SUM, COUNT)
143
- name: agg_type
141
+ - name: agg_type
142
+ type: string
144
143
  required: false
145
144
  title: Agg Type
146
- type: string
145
+ description: Select an aggregation function (e.g., AVG, SUM, COUNT)
146
+ defaultValue: AVG
147
147
  hideValue: true
148
- - defaultValue: false
149
- description: Enable email notifications
150
- name: email_notifications
148
+ - name: email_notifications
149
+ type: boolean
151
150
  required: false
152
151
  title: Email Notifications
153
- type: boolean
154
- - defaultValue: 10
152
+ description: Enable email notifications
153
+ defaultValue: false
154
+ - name: num_iterations
155
+ type: number
156
+ required: false
157
+ title: Number of Iterations
155
158
  description: Select the number of iterations
156
- name: num_iterations
157
159
  options:
158
160
  - title: Low
159
161
  value: 10
@@ -161,17 +163,15 @@ parameters:
161
163
  value: 50
162
164
  - title: High
163
165
  value: 100
164
- required: false
165
- title: Number of Iterations
166
- type: number
167
- - defaultValue:
168
- - input.csv
169
- - output.csv
170
- description: Specify input and output file names
171
- name: file_names
166
+ defaultValue: 10
167
+ - name: file_names
168
+ type: string_array
172
169
  required: true
173
170
  title: File Names
174
- type: string_array
171
+ description: Specify input and output file names
172
+ defaultValue:
173
+ - input.csv
174
+ - output.csv
175
175
  artifact:
176
176
  path: "."
177
177
  ignore_files:
@@ -100,22 +100,24 @@ body:
100
100
  runtimeExceeded: "@param:runtime_exceeded"
101
101
  parameters:
102
102
  build:
103
- - defaultValue: user@peak.ai
104
- description: Set the watcher user email
105
- name: watcher_user
103
+ - name: watcher_user
104
+ type: string
106
105
  required: true
107
106
  title: Watcher User Email
108
- type: string
107
+ description: Set the watcher user email
108
+ defaultValue: user@peak.ai
109
109
  hideValue: false
110
- - defaultValue: false
111
- description: Enable image caching for the workflow
112
- name: use_cache
110
+ - name: use_cache
111
+ type: boolean
113
112
  required: false
114
113
  title: Image Caching
115
- type: boolean
116
- - defaultValue: 10
114
+ description: Enable image caching for the workflow
115
+ defaultValue: false
116
+ - name: runtime_exceeded
117
+ type: number
118
+ required: false
119
+ title: Runtime Exceeded
117
120
  description: Select the runtime exceeded value to trigger a failed notification for the workflow (in minutes)
118
- name: runtime_exceeded
119
121
  options:
120
122
  - title: Low
121
123
  value: 10
@@ -123,26 +125,26 @@ parameters:
123
125
  value: 50
124
126
  - title: High
125
127
  value: 100
126
- required: false
127
- title: Runtime Exceeded
128
- type: number
128
+ defaultValue: 10
129
129
  run:
130
- - defaultValue: AVG
131
- description: Select an aggregation function (e.g., AVG, SUM, COUNT)
132
- name: agg_type
130
+ - name: agg_type
131
+ type: string
133
132
  required: false
134
133
  title: Agg Type
135
- type: string
134
+ description: Select an aggregation function (e.g., AVG, SUM, COUNT)
135
+ defaultValue: AVG
136
136
  hideValue: true
137
- - defaultValue: false
138
- description: Enable email notifications
139
- name: email_notifications
137
+ - name: email_notifications
138
+ type: boolean
140
139
  required: false
141
140
  title: Email Notifications
142
- type: boolean
143
- - defaultValue: 10
141
+ description: Enable email notifications
142
+ defaultValue: false
143
+ - name: num_iterations
144
+ type: number
145
+ required: false
146
+ title: Number of Iterations
144
147
  description: Select the number of iterations
145
- name: num_iterations
146
148
  options:
147
149
  - title: Low
148
150
  value: 10
@@ -150,17 +152,15 @@ parameters:
150
152
  value: 50
151
153
  - title: High
152
154
  value: 100
153
- required: false
154
- title: Number of Iterations
155
- type: number
156
- - defaultValue:
157
- - input.csv
158
- - output.csv
159
- description: Specify input and output file names
160
- name: file_names
155
+ defaultValue: 10
156
+ - name: file_names
157
+ type: string_array
161
158
  required: true
162
159
  title: File Names
163
- type: string_array
160
+ description: Specify input and output file names
161
+ defaultValue:
162
+ - input.csv
163
+ - output.csv
164
164
  artifact:
165
165
  path: "."
166
166
  ignore_files:
@@ -0,0 +1,9 @@
1
+ # parameters.yaml
2
+
3
+ body:
4
+ agg_type: "MAX"
5
+ num_iterations: 50
6
+ email_notifications: true
7
+ file_names:
8
+ - input.csv
9
+ - output.csv
@@ -18,6 +18,7 @@ body:
18
18
  - secret1
19
19
  - secret2
20
20
  sessionStickiness: true
21
+ scaleToZero: false
21
22
  entrypoint: |
22
23
  python
23
24
  app.py
@@ -18,6 +18,7 @@ body:
18
18
  - secret1
19
19
  - secret2
20
20
  sessionStickiness: true
21
+ scaleToZero: false
21
22
  entrypoint: |
22
23
  python
23
24
  app.py
@@ -16,6 +16,7 @@ body:
16
16
  - secret1
17
17
  - secret2
18
18
  sessionStickiness: true
19
+ scaleToZero: false
19
20
  entrypoint: |
20
21
  python
21
22
  app.py
@@ -9,3 +9,4 @@ body:
9
9
  resources:
10
10
  instanceTypeId: 1
11
11
  sessionStickiness: true
12
+ scaleToZero: false
@@ -10,3 +10,4 @@ body:
10
10
  resources:
11
11
  instanceTypeId: 1
12
12
  sessionStickiness: true
13
+ scaleToZero: false
@@ -9,3 +9,4 @@ body:
9
9
  resources:
10
10
  instanceTypeId: 1
11
11
  sessionStickiness: true
12
+ scaleToZero: false
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: peak-sdk
3
- Version: 1.11.0
3
+ Version: 1.13.0
4
4
  Summary: Python SDK for interacting with the Peak platform
5
5
  Home-page: https://docs.peak.ai/sdk/latest/
6
6
  License: Apache-2.0
7
7
  Author: Peak
8
8
  Author-email: support@peak.ai
9
- Requires-Python: >=3.8.1,<3.12
9
+ Requires-Python: >=3.8.1,<3.13
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: Apache Software License
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3
16
16
  Classifier: Programming Language :: Python :: 3.9
17
17
  Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
19
20
  Classifier: Programming Language :: Python :: 3.8
20
21
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
21
22
  Classifier: Typing :: Typed
@@ -28,7 +29,7 @@ Requires-Dist: requests (>=2.32,<3.0)
28
29
  Requires-Dist: requests-toolbelt (>=1.0,<2.0)
29
30
  Requires-Dist: shellingham (<1.5.4)
30
31
  Requires-Dist: structlog (>=24.2.0,<25.0.0)
31
- Requires-Dist: typer (>=0.12.3,<0.13.0)
32
+ Requires-Dist: typer (>=0.12.4,<0.13.0)
32
33
  Requires-Dist: urllib3 (<2)
33
34
  Project-URL: Documentation, https://docs.peak.ai/sdk/latest/
34
35
  Description-Content-Type: text/markdown
@@ -93,6 +94,37 @@ Follow these steps to create a virtual environment using Python's built-in `venv
93
94
  echo "compinit" >> ~/.zshrc # replace .zshrc with your shell's configuration file
94
95
  ```
95
96
 
97
+ ### Checking Package Version
98
+
99
+ - As mentioned above, the Peak SDK ships with a CLI as well. You can check the version of both the CLI and the SDK quite easily.
100
+ - You can check the version for the `peak-cli` using the following command
101
+
102
+ ```bash
103
+ peak --version
104
+ ```
105
+
106
+ This should return a response of the following format
107
+
108
+ ```bash
109
+ peak-cli==1.13.0
110
+ Python==3.12.3
111
+ System==Darwin(23.6.0)
112
+ ```
113
+
114
+ - To check the version of the `peak-sdk`, the following code snippet can be used
115
+
116
+ ```python
117
+ import peak
118
+
119
+ print(peak.__version__)
120
+ ```
121
+
122
+ This should print the version of the SDK
123
+
124
+ ```
125
+ 1.13.0
126
+ ```
127
+
96
128
  ### Using the SDK and CLI
97
129
 
98
130
  - To start using the SDK and CLI, you'll need either an API Key or a Personal Access Token (PAT).
@@ -135,13 +167,13 @@ Here are some quick links to help you navigate easily:
135
167
  <tr>
136
168
  <td>3.8</td>
137
169
  <td>🟢</td>
138
- <td>🟡</td>
170
+ <td>🟢</td>
139
171
  <td>🟤</td>
140
172
  </tr>
141
173
  <tr>
142
174
  <td>3.9</td>
143
175
  <td>🟢</td>
144
- <td>🟡</td>
176
+ <td>🟢</td>
145
177
  <td>🟤</td>
146
178
  </tr>
147
179
  <tr>
@@ -152,8 +184,14 @@ Here are some quick links to help you navigate easily:
152
184
  </tr>
153
185
  <tr>
154
186
  <td>3.11</td>
155
- <td>🟡</td>
156
- <td>🟡</td>
187
+ <td>🟢</td>
188
+ <td>🟢</td>
189
+ <td>🟤</td>
190
+ </tr>
191
+ <tr>
192
+ <td>3.12</td>
193
+ <td>🟢</td>
194
+ <td>🟢</td>
157
195
  <td>🟤</td>
158
196
  </tr>
159
197
  </tbody>