peak-sdk 1.16.0__py3-none-any.whl → 1.17.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.
- peak/_version.py +1 -1
- peak/cli/metrics/metrics.py +104 -4
- peak/cli/press/apps/deployments.py +13 -0
- peak/metrics/metrics.py +63 -3
- peak/press/apps.py +27 -1
- peak/sample_yaml/metrics/publish.yaml +5 -0
- peak/sample_yaml/metrics/update-namespace.yaml +7 -0
- peak/sample_yaml/press/apps/deployments/create_app_deployment.yaml +6 -0
- peak/sample_yaml/press/apps/deployments/create_app_deployment_revision.yaml +7 -0
- peak/tools/logging/logger.py +13 -6
- {peak_sdk-1.16.0.dist-info → peak_sdk-1.17.0.dist-info}/METADATA +3 -3
- {peak_sdk-1.16.0.dist-info → peak_sdk-1.17.0.dist-info}/RECORD +15 -14
- {peak_sdk-1.16.0.dist-info → peak_sdk-1.17.0.dist-info}/LICENSE +0 -0
- {peak_sdk-1.16.0.dist-info → peak_sdk-1.17.0.dist-info}/WHEEL +0 -0
- {peak_sdk-1.16.0.dist-info → peak_sdk-1.17.0.dist-info}/entry_points.txt +0 -0
peak/_version.py
CHANGED
peak/cli/metrics/metrics.py
CHANGED
@@ -50,6 +50,16 @@ _NAMESPACE = typer.Option(
|
|
50
50
|
None,
|
51
51
|
help="The namespace associated with the metrics. If not provided, the default namespace is used.",
|
52
52
|
)
|
53
|
+
|
54
|
+
_NAMESPACE_DESCRIPTION = typer.Option(
|
55
|
+
None,
|
56
|
+
help="A description of the namespace.",
|
57
|
+
)
|
58
|
+
|
59
|
+
_NAMESPACE_METADATA = typer.Option(
|
60
|
+
None,
|
61
|
+
help="Key-value metadata associated with the namespace. Provide them in stringified JSON format.",
|
62
|
+
)
|
53
63
|
_GENERATE_SQL = typer.Option(
|
54
64
|
None,
|
55
65
|
help="Indicates whether to return the SQL query instead of data. If `true`, the response will include the SQL query used to retrieve the metrics. Default is `false`.",
|
@@ -70,6 +80,10 @@ _TIME_DIMENSIONS = typer.Option(
|
|
70
80
|
None,
|
71
81
|
help="An array of time dimensions to include in the query. Time dimensions allow querying over specific time ranges with optional granularity (e.g., day, month, year). Provide them in stringified JSON format.",
|
72
82
|
)
|
83
|
+
_SEARCH_TERM = typer.Option(
|
84
|
+
None,
|
85
|
+
help="A search term to filter the metrics. This can be used to search for specific metrics by name.",
|
86
|
+
)
|
73
87
|
_SEGMENTS = typer.Option(
|
74
88
|
None,
|
75
89
|
help="An array of segments to include in the query. Segments represent pre-defined filters that can be applied to metrics. Provide them in stringified JSON format.",
|
@@ -145,6 +159,7 @@ def publish(
|
|
145
159
|
params_file: str = args.TEMPLATE_PARAMS_FILE,
|
146
160
|
params: List[str] = args.TEMPLATE_PARAMS,
|
147
161
|
namespace: Optional[str] = _PUBLISH_NAMESPACE,
|
162
|
+
namespace_description: Optional[str] = _NAMESPACE_DESCRIPTION,
|
148
163
|
artifact_path: Optional[str] = _ARTIFACT_PATH,
|
149
164
|
collection_id: Optional[str] = _COLLECTION_ID,
|
150
165
|
dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
|
@@ -156,6 +171,7 @@ def publish(
|
|
156
171
|
The metrics can be published either by passing artifact and namespace,
|
157
172
|
or by passing collection_id and namespace. If both artifact and collection_id
|
158
173
|
are provided, artifact takes priority. If the namespace is not provided, the 'default' namespace is used.
|
174
|
+
Namespace metadata and Namespace description are optional.
|
159
175
|
|
160
176
|
\b
|
161
177
|
🧩 ***Input file schema(yaml):***<br/>
|
@@ -164,6 +180,9 @@ def publish(
|
|
164
180
|
```yaml
|
165
181
|
body (map):
|
166
182
|
namespace (str): The namespace associated with the metrics.
|
183
|
+
namespaceMetadata (map | required: false): Key-value metadata associated with the namespace.
|
184
|
+
namespaceDescription (str | required: false): A description of the namespace.
|
185
|
+
|
167
186
|
artifact (map):
|
168
187
|
path (str): Path to the artifact.
|
169
188
|
```
|
@@ -171,6 +190,9 @@ def publish(
|
|
171
190
|
```yaml
|
172
191
|
body (map):
|
173
192
|
namespace (str): The namespace associated with the metrics.
|
193
|
+
namespaceMetadata (map | required: false): Key-value metadata associated with the namespace.
|
194
|
+
namespaceDescription (str | required: false): A description of the namespace.
|
195
|
+
|
174
196
|
collectionId (str): The ID of the collection to publish the metrics.
|
175
197
|
```
|
176
198
|
|
@@ -186,9 +208,10 @@ def publish(
|
|
186
208
|
📝 ***Example usage without yaml:***
|
187
209
|
```bash
|
188
210
|
# Publish metrics using artifact and namespace
|
189
|
-
peak metrics publish --artifact-path <path> --namespace <namespace>
|
211
|
+
peak metrics publish --artifact-path <path> --namespace <namespace> --namespace-description "Metrics for pricing"
|
212
|
+
|
190
213
|
# Publish metrics using collection id and namespace
|
191
|
-
peak metrics publish --collection-id <collection-id> --namespace <namespace>
|
214
|
+
peak metrics publish --collection-id <collection-id> --namespace <namespace> --namespace-description "Metrics for pricing"
|
192
215
|
```
|
193
216
|
|
194
217
|
\b
|
@@ -208,6 +231,7 @@ def publish(
|
|
208
231
|
|
209
232
|
user_options: Dict[str, Any] = variables_to_dict(
|
210
233
|
namespace,
|
234
|
+
namespace_description,
|
211
235
|
)
|
212
236
|
|
213
237
|
body: Dict[str, Any] = {}
|
@@ -358,7 +382,9 @@ def list_metrics(
|
|
358
382
|
ctx: typer.Context,
|
359
383
|
page_size: Optional[int] = args.PAGE_SIZE,
|
360
384
|
page_number: Optional[int] = args.PAGE_NUMBER,
|
385
|
+
publication_id: Optional[str] = _PUBLICATION_ID,
|
361
386
|
namespace: Optional[str] = _NAMESPACE,
|
387
|
+
search_term: Optional[str] = _SEARCH_TERM,
|
362
388
|
type: Optional[str] = _METRIC_TYPES, # noqa: A002
|
363
389
|
paging: Optional[bool] = PAGING, # noqa: ARG001
|
364
390
|
output_type: Optional[OutputTypes] = OUTPUT_TYPES, # noqa: ARG001
|
@@ -368,7 +394,7 @@ def list_metrics(
|
|
368
394
|
\b
|
369
395
|
📝 ***Example usage:***<br/>
|
370
396
|
```bash
|
371
|
-
peak metrics list --page-size 25 --page-number 1 --namespace <namespace> --type <type>
|
397
|
+
peak metrics list --page-size 25 --page-number 1 --namespace <namespace> --type <type> --search-term <search_term> --publication-id <publication_id>
|
372
398
|
```
|
373
399
|
|
374
400
|
\b
|
@@ -429,11 +455,12 @@ def list_metrics(
|
|
429
455
|
response = metric_client.list(
|
430
456
|
page_size=page_size,
|
431
457
|
page_number=page_number,
|
458
|
+
publication_id=publication_id,
|
432
459
|
namespace=namespace,
|
460
|
+
search_term=search_term,
|
433
461
|
type=type,
|
434
462
|
return_iterator=False,
|
435
463
|
)
|
436
|
-
|
437
464
|
writer.write(response)
|
438
465
|
|
439
466
|
|
@@ -676,6 +703,11 @@ def list_namespaces(
|
|
676
703
|
{
|
677
704
|
"namespaces": [
|
678
705
|
{
|
706
|
+
"description": "Default namespace",
|
707
|
+
"metadata": {
|
708
|
+
"owner": "abc",
|
709
|
+
"environment": "development"
|
710
|
+
},
|
679
711
|
"name": "default",
|
680
712
|
"models": [
|
681
713
|
{
|
@@ -705,3 +737,71 @@ def list_namespaces(
|
|
705
737
|
return_iterator=False,
|
706
738
|
)
|
707
739
|
writer.write(response)
|
740
|
+
|
741
|
+
|
742
|
+
@app.command(short_help="Update a namespace.")
|
743
|
+
def update_namespace(
|
744
|
+
ctx: typer.Context,
|
745
|
+
file: Annotated[
|
746
|
+
Optional[str],
|
747
|
+
typer.Argument(
|
748
|
+
...,
|
749
|
+
help="Path to the file that defines the body for this operation, supports both `yaml` file or a `jinja` template.",
|
750
|
+
),
|
751
|
+
] = None,
|
752
|
+
params_file: Optional[str] = args.TEMPLATE_PARAMS_FILE,
|
753
|
+
params: Optional[List[str]] = args.TEMPLATE_PARAMS,
|
754
|
+
namespace: Optional[str] = typer.Option(None, help="The name of the namespace to update."),
|
755
|
+
description: Optional[str] = _NAMESPACE_DESCRIPTION,
|
756
|
+
dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
|
757
|
+
output_type: Optional[OutputTypesNoTable] = OUTPUT_TYPES, # noqa: ARG001
|
758
|
+
) -> None:
|
759
|
+
"""***Update*** a namespace with a new description and metadata.
|
760
|
+
|
761
|
+
\b
|
762
|
+
📝 ***Example usage:***
|
763
|
+
```bash
|
764
|
+
peak metrics update-namespace update-namespace.yaml --namespace new_namespace --description "Updated description"
|
765
|
+
```
|
766
|
+
|
767
|
+
\b
|
768
|
+
🆗 ***Response:***
|
769
|
+
```json
|
770
|
+
{
|
771
|
+
"namespace": "new_namespace",
|
772
|
+
"description": "Updated description",
|
773
|
+
"message": "Updated namespace new_namespace",
|
774
|
+
"metadata": {
|
775
|
+
"key": "value"
|
776
|
+
}
|
777
|
+
}
|
778
|
+
```
|
779
|
+
"""
|
780
|
+
metrics_client: Metric = ctx.obj["client"]
|
781
|
+
writer: Writer = ctx.obj["writer"]
|
782
|
+
|
783
|
+
body: Dict[str, Any] = {}
|
784
|
+
if file:
|
785
|
+
body = helpers.template_handler(file=file, params_file=params_file, params=params)
|
786
|
+
|
787
|
+
cli_options: Dict[str, Any] = variables_to_dict(
|
788
|
+
namespace,
|
789
|
+
description,
|
790
|
+
)
|
791
|
+
|
792
|
+
updated_body = combine_dictionaries(body or {}, cli_options)
|
793
|
+
|
794
|
+
if not updated_body.get("namespace") and not namespace:
|
795
|
+
error_message = "Namespace must be provided either through file or CLI option."
|
796
|
+
raise typer.BadParameter(error_message)
|
797
|
+
|
798
|
+
final_namespace = updated_body.pop("namespace", namespace)
|
799
|
+
metadata = updated_body.get("metadata")
|
800
|
+
|
801
|
+
with writer.pager():
|
802
|
+
response = metrics_client.update_namespace(
|
803
|
+
namespace=final_namespace,
|
804
|
+
description=updated_body.get("description"),
|
805
|
+
metadata=metadata,
|
806
|
+
)
|
807
|
+
writer.write(response)
|
@@ -79,6 +79,12 @@ def create(
|
|
79
79
|
id (string): ID of the app spec to be deployed.
|
80
80
|
release (map | required: false):
|
81
81
|
version (string): A valid semantic release version of the app spec.
|
82
|
+
includes (list(map) | required: false): List of blocks to include in the deployment. These blocks should not be part of the app spec.
|
83
|
+
- id (string): ID of the block to include.
|
84
|
+
releaseVersion (string): Release version of the block.
|
85
|
+
excludes (list(map) | required: false): List of blocks that are part of the app spec which should be excluded from the deployment.
|
86
|
+
- id (string): ID of the block to exclude.
|
87
|
+
releaseVersion (string): Release version of the block.
|
82
88
|
```
|
83
89
|
|
84
90
|
\b
|
@@ -362,6 +368,13 @@ def create_revision(
|
|
362
368
|
version (string): A valid semantic release version of the app spec.
|
363
369
|
revision (map | required: false):
|
364
370
|
notes (string | required: false): Notes for the deployment revision.
|
371
|
+
blocksConfig (map | required: false):
|
372
|
+
includes (list(map) | required: false): List of blocks to include in the deployment. These blocks should not be part of the app spec.
|
373
|
+
- id (string): ID of the block to include.
|
374
|
+
releaseVersion (string): Release version of the block.
|
375
|
+
excludes (list(map) | required: false): List of blocks that are part of the app spec which should be excluded from the deployment.
|
376
|
+
- id (string): ID of the block to exclude.
|
377
|
+
releaseVersion (string): Release version of the block.
|
365
378
|
|
366
379
|
```
|
367
380
|
|
peak/metrics/metrics.py
CHANGED
@@ -56,6 +56,8 @@ class Metric(BaseClient):
|
|
56
56
|
The metrics can be published either by passing artifact and namespace,
|
57
57
|
or by passing collection_id and namespace. If both artifact and collection_id
|
58
58
|
are provided, artifact takes priority. If the namespace is not provided, the 'default' namespace is used.
|
59
|
+
You can optionally include `namespaceMetadata` and `namespaceDescription` in the body
|
60
|
+
to provide additional context about the namespace.
|
59
61
|
|
60
62
|
REFERENCE:
|
61
63
|
🔗 `API Documentation <https://service.peak.ai/semantic-layer/api-docs/index.htm#/Metrics/post_api_v1_metrics>`__
|
@@ -74,6 +76,8 @@ class Metric(BaseClient):
|
|
74
76
|
|
75
77
|
{
|
76
78
|
"namespace": "string",
|
79
|
+
"namespaceMetadata": { "key": "value" },
|
80
|
+
"namespaceDescription": "Optional description"
|
77
81
|
}
|
78
82
|
|
79
83
|
Raises:
|
@@ -84,10 +88,12 @@ class Metric(BaseClient):
|
|
84
88
|
UnprocessableEntityException: The server was unable to process the request.
|
85
89
|
InternalServerErrorException: The server failed to process the request.
|
86
90
|
"""
|
91
|
+
if body and "namespaceMetadata" in body:
|
92
|
+
body["namespaceMetadata"] = json.dumps(body["namespaceMetadata"])
|
93
|
+
|
87
94
|
if artifact:
|
88
95
|
method, endpoint = HttpMethods.POST, f"{self.BASE_ENDPOINT}/metrics"
|
89
96
|
path = self.__get_artifact_details(artifact)
|
90
|
-
|
91
97
|
return self.session.create_request( # type: ignore[no-any-return]
|
92
98
|
endpoint,
|
93
99
|
method,
|
@@ -111,7 +117,7 @@ class Metric(BaseClient):
|
|
111
117
|
|
112
118
|
def query(
|
113
119
|
self,
|
114
|
-
measures: List[str],
|
120
|
+
measures: Optional[List[str]] = None,
|
115
121
|
namespace: Optional[str] = None,
|
116
122
|
generate_sql: Optional[bool] = False, # noqa: FBT002
|
117
123
|
dimensions: Optional[List[str]] = None,
|
@@ -128,7 +134,7 @@ class Metric(BaseClient):
|
|
128
134
|
🔗 `API Documentation <https://service.peak.ai/semantic-layer/api-docs/index.htm#/Query/get_api_v1_metrics_query>`__
|
129
135
|
|
130
136
|
Args:
|
131
|
-
measures (List[str]): An array of measures to include in the query. Measures represent quantitative metrics such as sums or counts.
|
137
|
+
measures (List[str] | None): An array of measures to include in the query. Measures represent quantitative metrics such as sums or counts.
|
132
138
|
namespace (str | None): The namespace associated with the metrics. If not provided, the default namespace is used.
|
133
139
|
generate_sql (bool | None): Indicates whether to return the SQL query instead of data. If `true`, the response will include the SQL query used to retrieve the metrics. Default is `false`.
|
134
140
|
dimensions (List[str] | None): An array of dimensions to include in the query. Dimensions represent qualitative categories such as time, location, or product names.
|
@@ -183,7 +189,9 @@ class Metric(BaseClient):
|
|
183
189
|
self,
|
184
190
|
page_size: Optional[int] = None,
|
185
191
|
page_number: Optional[int] = None,
|
192
|
+
publication_id: Optional[str] = None,
|
186
193
|
namespace: Optional[str] = None,
|
194
|
+
search_term: Optional[str] = None,
|
187
195
|
type: Optional[str] = None, # noqa: A002
|
188
196
|
*,
|
189
197
|
return_iterator: Literal[False],
|
@@ -194,7 +202,9 @@ class Metric(BaseClient):
|
|
194
202
|
self,
|
195
203
|
page_size: Optional[int] = None,
|
196
204
|
page_number: Optional[int] = None,
|
205
|
+
publication_id: Optional[str] = None,
|
197
206
|
namespace: Optional[str] = None,
|
207
|
+
search_term: Optional[str] = None,
|
198
208
|
type: Optional[str] = None, # noqa: A002
|
199
209
|
*,
|
200
210
|
return_iterator: Literal[True] = True,
|
@@ -204,7 +214,9 @@ class Metric(BaseClient):
|
|
204
214
|
self,
|
205
215
|
page_size: Optional[int] = None,
|
206
216
|
page_number: Optional[int] = None,
|
217
|
+
publication_id: Optional[str] = None,
|
207
218
|
namespace: Optional[str] = None,
|
219
|
+
search_term: Optional[str] = None,
|
208
220
|
type: Optional[str] = None, # noqa: A002
|
209
221
|
*,
|
210
222
|
return_iterator: bool = True,
|
@@ -217,7 +229,9 @@ class Metric(BaseClient):
|
|
217
229
|
Args:
|
218
230
|
page_size (int | None): The number of images per page.
|
219
231
|
page_number (int | None): The page number to retrieve. Only used when `return_iterator` is False.
|
232
|
+
publication_id (str | None): The publication ID to retrieve metrics from. If not provided, all metrics are retrieved.
|
220
233
|
namespace (str | None): The namespace associated with the metrics. If not provided, the default namespace is used.
|
234
|
+
search_term (str | None): The search term to filter the metrics by. If not provided, all metrics are retrieved.
|
221
235
|
type (str | None): The type of metrics to retrieve. If not provided, all metrics are retrieved. Available types are `cube`, `view`, `dimension`, `measure`, `segment` and `all`.
|
222
236
|
return_iterator (bool): Whether to return an iterator object or list of metrics for a specified page number, defaults to True.
|
223
237
|
|
@@ -236,7 +250,9 @@ class Metric(BaseClient):
|
|
236
250
|
method, endpoint = HttpMethods.GET, f"{self.BASE_ENDPOINT}/metrics"
|
237
251
|
params = {
|
238
252
|
"pageSize": page_size,
|
253
|
+
"publicationId": publication_id,
|
239
254
|
"namespace": namespace,
|
255
|
+
"searchTerm": search_term,
|
240
256
|
"type": type,
|
241
257
|
}
|
242
258
|
|
@@ -537,6 +553,50 @@ class Metric(BaseClient):
|
|
537
553
|
params={**params, "pageNumber": page_number},
|
538
554
|
)
|
539
555
|
|
556
|
+
def update_namespace(
|
557
|
+
self,
|
558
|
+
namespace: str,
|
559
|
+
description: Optional[str] = None,
|
560
|
+
metadata: Optional[Dict[str, Any]] = None,
|
561
|
+
) -> Dict[str, Any]:
|
562
|
+
"""Update a namespace with a new description and metadata.
|
563
|
+
|
564
|
+
REFERENCE:
|
565
|
+
🔗 `API Documentation <https://service.peak.ai/semantic-layer/api-docs/index.htm#/Namespaces/patch_api_v1_namespaces__namespace_>`__
|
566
|
+
|
567
|
+
Args:
|
568
|
+
namespace (str): The name of the namespace to update.
|
569
|
+
description (str | None): The new description for the namespace.
|
570
|
+
metadata (Dict[str, Any] | None): The new metadata for the namespace.
|
571
|
+
|
572
|
+
Returns:
|
573
|
+
Dict[str, Any]: A dictionary containing details about the updated namespace.
|
574
|
+
|
575
|
+
Raises:
|
576
|
+
InvalidParameterException: The given request parameters are invalid.
|
577
|
+
UnauthorizedException: The credentials are invalid.
|
578
|
+
ForbiddenException: The user does not have permission to perform the operation.
|
579
|
+
NotFoundException: The given namespace does not exist.
|
580
|
+
UnprocessableEntityException: The server was unable to process the request.
|
581
|
+
InternalServerErrorException: The server failed to process the request.
|
582
|
+
"""
|
583
|
+
if not namespace:
|
584
|
+
raise InvalidParameterException(message="Namespace must be provided.")
|
585
|
+
|
586
|
+
method, endpoint = HttpMethods.PATCH, f"{self.BASE_ENDPOINT}/namespaces/{namespace}"
|
587
|
+
body = {}
|
588
|
+
if description is not None:
|
589
|
+
body["description"] = description
|
590
|
+
if metadata is not None:
|
591
|
+
body["metadata"] = json.dumps(metadata)
|
592
|
+
|
593
|
+
return self.session.create_request( # type: ignore[no-any-return]
|
594
|
+
endpoint,
|
595
|
+
method,
|
596
|
+
content_type=ContentType.APPLICATION_JSON,
|
597
|
+
body=body,
|
598
|
+
)
|
599
|
+
|
540
600
|
|
541
601
|
def get_client(session: Optional[Session] = None) -> Metric:
|
542
602
|
"""Returns a Metrics client, If no session is provided, a default session is used.
|
peak/press/apps.py
CHANGED
@@ -690,7 +690,19 @@ class App(BaseClient):
|
|
690
690
|
"id": "string(required)",
|
691
691
|
"release": {
|
692
692
|
"version": "string(required)",
|
693
|
-
}
|
693
|
+
},
|
694
|
+
"includes": [
|
695
|
+
{
|
696
|
+
"id": "string",
|
697
|
+
"releaseVersion": "string"
|
698
|
+
}
|
699
|
+
],
|
700
|
+
"excludes": [
|
701
|
+
{
|
702
|
+
"id": "string",
|
703
|
+
"releaseVersion": "string"
|
704
|
+
}
|
705
|
+
]
|
694
706
|
}
|
695
707
|
}
|
696
708
|
|
@@ -923,6 +935,20 @@ class App(BaseClient):
|
|
923
935
|
"revision": {
|
924
936
|
"notes": "string",
|
925
937
|
},
|
938
|
+
"blocksConfig": {
|
939
|
+
"includes": [
|
940
|
+
{
|
941
|
+
"id": "string",
|
942
|
+
"releaseVersion": "string"
|
943
|
+
}
|
944
|
+
],
|
945
|
+
"excludes": [
|
946
|
+
{
|
947
|
+
"id": "string",
|
948
|
+
"releaseVersion": "string"
|
949
|
+
}
|
950
|
+
]
|
951
|
+
},
|
926
952
|
"appParameters": {
|
927
953
|
"build": {
|
928
954
|
"param_name": "param_value (string | number | boolean | array)"
|
@@ -53,3 +53,9 @@ body:
|
|
53
53
|
id: 0bddb4c6-40c5-45c3-b477-fceb2c051609
|
54
54
|
release:
|
55
55
|
version: 1.0.0
|
56
|
+
# Block inclusion/exclusion configuration
|
57
|
+
includes:
|
58
|
+
- id: block-1
|
59
|
+
releaseVersion: "1.0.0" # including a block
|
60
|
+
excludes:
|
61
|
+
- id: block-3 # Excluding block-3 from deployment
|
@@ -42,3 +42,10 @@ body:
|
|
42
42
|
notes: This is the initial revision
|
43
43
|
release:
|
44
44
|
version: 2.0.0
|
45
|
+
# Added blocks configuration for revision
|
46
|
+
blocksConfig:
|
47
|
+
includes:
|
48
|
+
- id: block-1
|
49
|
+
releaseVersion: "2.0.0" # including a block
|
50
|
+
excludes:
|
51
|
+
- id: block-3 # Excluding block-3 in this revision
|
peak/tools/logging/logger.py
CHANGED
@@ -239,7 +239,7 @@ def _handle_and_patch_processor_factory_kwargs(
|
|
239
239
|
|
240
240
|
def get_logger(
|
241
241
|
name: Optional[str] = None,
|
242
|
-
level: Optional[LogLevel] =
|
242
|
+
level: Optional[LogLevel] = None,
|
243
243
|
custom_processors_factory: Optional[Callable[..., List[structlog.types.Processor | Any]]] = None,
|
244
244
|
disable_masking: Optional[bool] = False, # noqa: FBT002
|
245
245
|
handlers: Optional[List[LogHandler]] = None,
|
@@ -271,11 +271,18 @@ def get_logger(
|
|
271
271
|
Raises:
|
272
272
|
ValueError: If the `file_name` is not provided for FILE handler or if `multiple renderers` are found in the `processor`(s) list returned by the `custom_processors_factory`.
|
273
273
|
"""
|
274
|
-
|
275
|
-
level.value
|
276
|
-
|
277
|
-
|
278
|
-
|
274
|
+
if level is not None:
|
275
|
+
_log_level = level.value
|
276
|
+
elif os.getenv("LOG_LEVEL") is not None and os.getenv("LOG_LEVEL", "INFO").upper() in LOG_LEVEL_NAMES_TO_LOG_LEVEL:
|
277
|
+
_log_level = LOG_LEVEL_NAMES_TO_LOG_LEVEL.get(
|
278
|
+
os.getenv("LOG_LEVEL", "INFO").upper(), # type: ignore # noqa: PGH003
|
279
|
+
"INFO",
|
280
|
+
).value
|
281
|
+
elif os.getenv("DEBUG", "false").lower() == "true":
|
282
|
+
_log_level = logging.DEBUG
|
283
|
+
else:
|
284
|
+
_log_level = LogLevel.INFO.value
|
285
|
+
|
279
286
|
_processors: list[structlog.types.Processor | Any] = (
|
280
287
|
_handle_and_patch_processor_factory_kwargs(custom_processors_factory, disable_masking=disable_masking, **kwargs)
|
281
288
|
if custom_processors_factory is not None
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: peak-sdk
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.17.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
|
@@ -106,7 +106,7 @@ Follow these steps to create a virtual environment using Python's built-in `venv
|
|
106
106
|
This should return a response of the following format
|
107
107
|
|
108
108
|
```bash
|
109
|
-
peak-cli==1.
|
109
|
+
peak-cli==1.17.0
|
110
110
|
Python==3.12.3
|
111
111
|
System==Darwin(23.6.0)
|
112
112
|
```
|
@@ -122,7 +122,7 @@ Follow these steps to create a virtual environment using Python's built-in `venv
|
|
122
122
|
This should print the version of the SDK
|
123
123
|
|
124
124
|
```
|
125
|
-
1.
|
125
|
+
1.17.0
|
126
126
|
```
|
127
127
|
|
128
128
|
### Using the SDK and CLI
|
@@ -1,6 +1,6 @@
|
|
1
1
|
peak/__init__.py,sha256=UaVwsRIPq0Wuti8j2x4ijGRVYywglfjvZGz6ALBA7Oo,1284
|
2
2
|
peak/_metadata.py,sha256=8w0pXN03pDvh1toM-divY6HNVF8znTqGGG2T9Q4hEl4,30672
|
3
|
-
peak/_version.py,sha256=
|
3
|
+
peak/_version.py,sha256=Hw1o3JR05IC6kt3op9K3WGBGESgn4GVuhnMLvFnZ7fQ,887
|
4
4
|
peak/auth.py,sha256=A6nM9VGUdPJpFTFmb1zeeHjhKfBIsAyIMmnF9ajZkgs,904
|
5
5
|
peak/base_client.py,sha256=UO25ZViCQfKbBEDEfCdKS-eLXaVzb1aGnYDntBZ77ko,1808
|
6
6
|
peak/callbacks.py,sha256=WRVxSpg0Ur3uzG1aqxX4dQ5YV_Dr4GBrwYddppztcdM,3775
|
@@ -9,10 +9,10 @@ peak/cli/args.py,sha256=6vFvxburNhVZ3MOEhGsbXCb2IwURCf_nqcmnEUvsqzg,6166
|
|
9
9
|
peak/cli/cli.py,sha256=ybm87AO0JNTMiIPpaWZRXHwfV76oHOjhDFDlHPo3KI4,2531
|
10
10
|
peak/cli/helpers.py,sha256=Jon5yCgXUbRHJddi0Wj0mny3OIWpfaJxV4zW_jLuoFU,8629
|
11
11
|
peak/cli/metrics/__init__.py,sha256=O2Nxt8hTbW7E6IdFR5_cuL8WTiEk2Hf9QFNo29bpwfY,894
|
12
|
-
peak/cli/metrics/metrics.py,sha256=
|
12
|
+
peak/cli/metrics/metrics.py,sha256=E_uVPkE0RTKypeMCw9UdNdl2YWiOW-BgXjvPkiXhbHs,29952
|
13
13
|
peak/cli/press/__init__.py,sha256=Uiir3EoPCWk_zoEk-RitATS20RxDLqiW8Iz5jybrDts,898
|
14
14
|
peak/cli/press/apps/__init__.py,sha256=Z_-egO6FtdFqAgy5KmUUY-F9ELaGcvJYd5yMbyHoCh4,1459
|
15
|
-
peak/cli/press/apps/deployments.py,sha256=
|
15
|
+
peak/cli/press/apps/deployments.py,sha256=I7RC9YgAJnXBD6PhzjMgqchqGRrQVSDi5EbP3D39yFI,19889
|
16
16
|
peak/cli/press/apps/specs.py,sha256=9veK_CGrOUTpNEMIn1j-xrkcW8giY4E9LuQLpBuH8DQ,19635
|
17
17
|
peak/cli/press/blocks/__init__.py,sha256=gv42qPm2SMBOZ4j3jVYs_02CWZsWaDzNUnGmcLpOKPc,1499
|
18
18
|
peak/cli/press/blocks/deployments.py,sha256=WnTogya42FVyRR_180ZQJ6KmlRUEJDyOL64kppimbdU,21953
|
@@ -39,10 +39,10 @@ peak/handler.py,sha256=u5ti9ed_nj1Vgi9dUcO9yFxIZNH8i5OL63p3jRV18aU,17229
|
|
39
39
|
peak/helpers.py,sha256=eWDObQg_Dm8yUcgKr40f1Ghy5qPe5AyyoZlTKPneXj8,10339
|
40
40
|
peak/logger.py,sha256=9f5F5yskpMWifnKaHLsQuKAGdaBZ4aDWWaygvTjjU34,1548
|
41
41
|
peak/metrics/__init__.py,sha256=nW_9D_UHYo52OZ-aKYW0S-t8bouj-W9D9olPmYJYVi4,1057
|
42
|
-
peak/metrics/metrics.py,sha256=
|
42
|
+
peak/metrics/metrics.py,sha256=e3PxdBOsfQvUkz3LJcfXOP_lP9kb4MaejRBtL-H3QXc,27430
|
43
43
|
peak/output.py,sha256=opIOxagBEXEe-V2Gtx96DuvZ4mdUwjkKt3P5dDY_VME,6971
|
44
44
|
peak/press/__init__.py,sha256=-Okc8-phtD8IGOP1YES3fKA7kRXla1mTLBk0uWVAObo,1112
|
45
|
-
peak/press/apps.py,sha256=
|
45
|
+
peak/press/apps.py,sha256=nnYOYbRtdrkC159wBLpXMaRsZffudZ3jrLagvY_-Z4U,51699
|
46
46
|
peak/press/blocks.py,sha256=9XLt2iiQBFa3ON9BddVZ1vp-kRNjij2JOfn069SAO-g,97610
|
47
47
|
peak/press/deployments.py,sha256=ZUcuUMygIEswGXleZAF8wkjzSXSl21jGERvIXJ__dcw,10969
|
48
48
|
peak/press/specs.py,sha256=SiSQcXXlPXQQ38AuUqfUmAW8tkuOXlSjwsWDrhNwSmQ,10915
|
@@ -57,10 +57,11 @@ peak/resources/users.py,sha256=b2TTDvWVmfSxdkQrjaSjZya7coe-5LO_X3BqiAd67lU,3428
|
|
57
57
|
peak/resources/webapps.py,sha256=dmMmm78dSR4nzI3YenwcaPRUKe15Wp6D5BwzZ3fNokw,13719
|
58
58
|
peak/resources/workflows.py,sha256=bua9jd_i2foawq9MDb7BsXqPEOi9lfl3R3vCwZZ3qrY,80131
|
59
59
|
peak/sample_yaml/metrics/create_collection.yaml,sha256=Vai6OWLPp1_ZhDWwN4ziMIFsJRmoqLZIIqC2sMgBSWw,148
|
60
|
-
peak/sample_yaml/metrics/publish.yaml,sha256=
|
60
|
+
peak/sample_yaml/metrics/publish.yaml,sha256=lEIJhtP9TMq1XoRdqs-En0uC5PNovnn3RDdlSyYWqB0,199
|
61
61
|
peak/sample_yaml/metrics/query.yaml,sha256=0RKgPjVvDxEHZcB9yj9sKan1vOiIw5_utRn682eYdag,463
|
62
|
-
peak/sample_yaml/
|
63
|
-
peak/sample_yaml/press/apps/deployments/
|
62
|
+
peak/sample_yaml/metrics/update-namespace.yaml,sha256=-fsUAJ5ziVJHx7wKj3ZBC8gAdulHcJ85PZCWbasCl9c,166
|
63
|
+
peak/sample_yaml/press/apps/deployments/create_app_deployment.yaml,sha256=rjM3Uec4pIFCCS51Fq0kElnxqSqzdV2n2DY6wYlpFlM,1456
|
64
|
+
peak/sample_yaml/press/apps/deployments/create_app_deployment_revision.yaml,sha256=C4lt_gNKECuKonJShtpGCT0KT8HYyzPwNswlqsN8_Ho,1163
|
64
65
|
peak/sample_yaml/press/apps/deployments/update_app_deployment_metadata.yaml,sha256=RBrAnxULPXYTrYY7T6l-L5_Q1E8LJ6RwVwOkw4zn5w0,302
|
65
66
|
peak/sample_yaml/press/apps/specs/create_app_spec.yaml,sha256=s7Wa8a3OEalt6oPc_dDcTXstF7x5PMZ8lBYuNMaFIX4,3263
|
66
67
|
peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml,sha256=8dI4n6LQfbi2LR_8IJOPe7NrMLdEoa2zHTbhemZGBCs,2928
|
@@ -119,11 +120,11 @@ peak/tools/__init__.py,sha256=Gi4ItzHzE1Y__5ZWmjii7w2QTQofZiOPmP6pWvhLh14,1048
|
|
119
120
|
peak/tools/logging/__init__.py,sha256=DqaklhDtjwPPufuqOC-7Yyqiyy3KoB6bFgf9-k7dOSc,1513
|
120
121
|
peak/tools/logging/log_handler.py,sha256=6mFcdRbV8fwK3IJXNbSwO5kXKwm2rFqjCzfpXYaXYIg,1406
|
121
122
|
peak/tools/logging/log_level.py,sha256=FVe94CEtow3nfHhNr5oQk0gEt2_5mpfaiV-xTfagXIQ,2665
|
122
|
-
peak/tools/logging/logger.py,sha256=
|
123
|
+
peak/tools/logging/logger.py,sha256=DHe--A2J7RRb5N-u0Gb3bbEApPyoUD060A1IeNvJ87Y,15986
|
123
124
|
peak/tools/logging/utils.py,sha256=XRQ0nw_lmV_iiRel-o83EE84UTjvrzLTt4H7BHlPbLg,3330
|
124
125
|
peak/validators.py,sha256=mY17UDGKJ879wY3EApqrGVs3hJvRkPhgwftvmvnKAdI,2715
|
125
|
-
peak_sdk-1.
|
126
|
-
peak_sdk-1.
|
127
|
-
peak_sdk-1.
|
128
|
-
peak_sdk-1.
|
129
|
-
peak_sdk-1.
|
126
|
+
peak_sdk-1.17.0.dist-info/LICENSE,sha256=W0jszenKx7YdFA7BDnyg8xDKXzCP8AperJb_PHh9paQ,11340
|
127
|
+
peak_sdk-1.17.0.dist-info/METADATA,sha256=WeVvPweqWyYP4k6pLKxjStuc5NLAL9_VyHnKwIwOKqU,7935
|
128
|
+
peak_sdk-1.17.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
129
|
+
peak_sdk-1.17.0.dist-info/entry_points.txt,sha256=zHCEjuOTjkfmqivgEZQsPGm4zFA4W3Q_vKCjPr7W6lE,47
|
130
|
+
peak_sdk-1.17.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|