peak-sdk 1.0.0__tar.gz

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 (50) hide show
  1. peak_sdk-1.0.0/LICENSE +201 -0
  2. peak_sdk-1.0.0/PKG-INFO +199 -0
  3. peak_sdk-1.0.0/peak/__init__.py +36 -0
  4. peak_sdk-1.0.0/peak/_version.py +21 -0
  5. peak_sdk-1.0.0/peak/auth.py +22 -0
  6. peak_sdk-1.0.0/peak/base_client.py +52 -0
  7. peak_sdk-1.0.0/peak/cli/__init_.py +20 -0
  8. peak_sdk-1.0.0/peak/cli/args.py +84 -0
  9. peak_sdk-1.0.0/peak/cli/cli.py +56 -0
  10. peak_sdk-1.0.0/peak/cli/helpers.py +187 -0
  11. peak_sdk-1.0.0/peak/cli/press/__init__.py +21 -0
  12. peak_sdk-1.0.0/peak/cli/press/apps/__init__.py +40 -0
  13. peak_sdk-1.0.0/peak/cli/press/apps/deployments.py +238 -0
  14. peak_sdk-1.0.0/peak/cli/press/apps/specs.py +387 -0
  15. peak_sdk-1.0.0/peak/cli/press/blocks/__init__.py +40 -0
  16. peak_sdk-1.0.0/peak/cli/press/blocks/deployments.py +240 -0
  17. peak_sdk-1.0.0/peak/cli/press/blocks/specs.py +492 -0
  18. peak_sdk-1.0.0/peak/cli/press/deployments.py +78 -0
  19. peak_sdk-1.0.0/peak/cli/press/specs.py +131 -0
  20. peak_sdk-1.0.0/peak/cli/resources/__init__.py +21 -0
  21. peak_sdk-1.0.0/peak/cli/resources/artifacts.py +310 -0
  22. peak_sdk-1.0.0/peak/cli/resources/images.py +886 -0
  23. peak_sdk-1.0.0/peak/cli/resources/webapps.py +356 -0
  24. peak_sdk-1.0.0/peak/cli/resources/workflows.py +703 -0
  25. peak_sdk-1.0.0/peak/cli/ruff.toml +11 -0
  26. peak_sdk-1.0.0/peak/cli/version.py +49 -0
  27. peak_sdk-1.0.0/peak/compression.py +162 -0
  28. peak_sdk-1.0.0/peak/config.py +24 -0
  29. peak_sdk-1.0.0/peak/constants.py +105 -0
  30. peak_sdk-1.0.0/peak/exceptions.py +217 -0
  31. peak_sdk-1.0.0/peak/handler.py +358 -0
  32. peak_sdk-1.0.0/peak/helpers.py +184 -0
  33. peak_sdk-1.0.0/peak/logger.py +48 -0
  34. peak_sdk-1.0.0/peak/press/__init__.py +28 -0
  35. peak_sdk-1.0.0/peak/press/apps.py +669 -0
  36. peak_sdk-1.0.0/peak/press/blocks.py +707 -0
  37. peak_sdk-1.0.0/peak/press/deployments.py +145 -0
  38. peak_sdk-1.0.0/peak/press/specs.py +260 -0
  39. peak_sdk-1.0.0/peak/py.typed +0 -0
  40. peak_sdk-1.0.0/peak/resources/__init__.py +28 -0
  41. peak_sdk-1.0.0/peak/resources/artifacts.py +343 -0
  42. peak_sdk-1.0.0/peak/resources/images.py +675 -0
  43. peak_sdk-1.0.0/peak/resources/webapps.py +278 -0
  44. peak_sdk-1.0.0/peak/resources/workflows.py +625 -0
  45. peak_sdk-1.0.0/peak/session.py +259 -0
  46. peak_sdk-1.0.0/peak/telemetry.py +201 -0
  47. peak_sdk-1.0.0/peak/template.py +231 -0
  48. peak_sdk-1.0.0/peak/validators.py +48 -0
  49. peak_sdk-1.0.0/pypi-home.md +163 -0
  50. peak_sdk-1.0.0/pyproject.toml +233 -0
peak_sdk-1.0.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.Apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright © 2023 Peak-AI
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.Apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.1
2
+ Name: peak-sdk
3
+ Version: 1.0.0
4
+ Summary: Python SDK for interacting with the Peak platform
5
+ Home-page: https://docs.peak.ai/sdk
6
+ License: Apache-2.0
7
+ Author: Peak
8
+ Author-email: support@peak.ai
9
+ Requires-Python: >=3.8.1,<3.12
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
23
+ Classifier: Typing :: Typed
24
+ Requires-Dist: certifi (>=2023.7.22)
25
+ Requires-Dist: jinja2 (>=3.1,<4.0)
26
+ Requires-Dist: pathspec (>=0.11,<0.12)
27
+ Requires-Dist: pyyaml (>=6.0,<7.0)
28
+ Requires-Dist: requests (>=2.30,<3.0)
29
+ Requires-Dist: requests-toolbelt (>=1.0,<2.0)
30
+ Requires-Dist: shellingham (<1.5.2)
31
+ Requires-Dist: typer[all] (>=0.9,<0.10)
32
+ Requires-Dist: urllib3 (<2)
33
+ Project-URL: Documentation, https://docs.peak.ai/sdk/
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Peak SDK
37
+
38
+ [![PyPI](https://img.shields.io/pypi/v/peak-sdk.svg)](https://pypi.org/project/peak-sdk/)
39
+ [![Python Version](https://img.shields.io/pypi/pyversions/peak-sdk)](https://docs.peak.ai/sdk/#platform-support)
40
+ [![License](https://img.shields.io/pypi/l/peak-sdk)](https://docs.peak.ai/sdk/license.html)
41
+
42
+ ## What is Peak SDK?
43
+
44
+ _Peak SDK_ is a Python-based package which can be used to build AI applications in [Peak](https://peak.ai/) Platform. The _Peak SDK_ provides an efficient code-based interface to manage platform resources (Web Apps, Workflows and Images). It also includes an interface to use Press API which can help you efficiently create, manage and deploy Press Applications on the Peak.
45
+
46
+ ## Getting Started
47
+
48
+ ### Setting up a Virtual Environment
49
+
50
+ To ensure a smooth development experience with _Peak SDK_, we highly recommend creating a Python virtual environment. A virtual environment helps to isolate the dependencies required by your project and prevents conflicts with other projects or the system's global Python environment.
51
+
52
+ Follow these steps to create a virtual environment using Python's built-in `venv` module:
53
+
54
+ 1. Open a terminal.
55
+ 2. Navigate to your project's root directory (where you plan to work with the _Peak SDK_).
56
+ 3. Create a new virtual environment with the following command:
57
+
58
+ ```
59
+ python3 -m venv <venv_name>
60
+ ```
61
+
62
+ 4. Activate the virtual environment by running:
63
+
64
+ ```
65
+ source <venv_name>/bin/activate
66
+ ```
67
+
68
+ 5. You will now be working within the virtual environment, and you can install dependencies and run the project without affecting other projects on your system's Python environment.
69
+
70
+ 6. When you're finished working on your project, you can deactivate the virtual environment using the following command:
71
+
72
+ ```
73
+ deactivate
74
+ ```
75
+
76
+ ### Installation
77
+
78
+ - You can install the _Peak SDK_ with the following command using `pip`
79
+
80
+ ```shell
81
+ pip install peak-sdk
82
+ ```
83
+
84
+ Or if you want to install a specific version
85
+
86
+ ```
87
+ pip install peak-sdk==<version>
88
+ ```
89
+
90
+ - The _Peak SDK_ ships with the CLI as well. Once CLI is installed, you can enable auto-completion for your shell by running `peak --install-completion ${shell-name}` command, where shell can be one of `[bash|zsh|fish|powershell|pwsh]`.
91
+ - Once this has run, we need to add `compinit` to the shell configuration file (like - .zshrc, .bashrc, etc). To do so, you can the following command
92
+ ```
93
+ echo "compinit" >> ~/.zshrc # replace .zshrc with your shell's configuration file
94
+ ```
95
+
96
+ ### Using the SDK/CLI
97
+
98
+ - To start using the SDK and CLI, you'll need either an API Key or an Access Token.
99
+ - If you don't have one yet, sign up for an account on the Peak platform to obtain your API key or Access token.
100
+ - To export it, run the following command in your terminal and replace <api_key> with your actual API key:
101
+ ```
102
+ export API_KEY=<api_key | access_token>
103
+ ```
104
+
105
+ ### Documentation
106
+
107
+ You can access the documentation for the SDK and CLI at [https://docs.peak.ai/sdk/](https://docs.peak.ai/sdk/).
108
+ Here are some quick links to help you navigate easily:
109
+
110
+ - [SDK Reference](https://docs.peak.ai/sdk/reference.html)
111
+ - [CLI Reference](https://docs.peak.ai/sdk/cli/reference.html)
112
+ - [Usage](https://docs.peak.ai/sdk/usage.html)
113
+ - [CLI Usage](https://docs.peak.ai/sdk/cli/usage.html)
114
+ - [Migration Guide](https://docs.peak.ai/sdk/migration-guide.html)
115
+ - [FAQ](https://docs.peak.ai/sdk/faq.html)
116
+
117
+ ### Platform Support
118
+
119
+ <div class="support-matrix" style="background-color:transparent">
120
+ <div class="supported-versions" style="text-align:center">
121
+ <table class="center-table">
122
+ <caption style="text-align:left">
123
+ <strong>Support across <i>Python versions</i> on major </strong><i>64-bit</i><strong> platforms</strong>
124
+ </caption>
125
+ <!-- table content -->
126
+ <thead>
127
+ <tr>
128
+ <th>Python Version</th>
129
+ <th>Linux</th>
130
+ <th>MacOS</th>
131
+ <th>Windows</th>
132
+ </tr>
133
+ </thead>
134
+ <tbody>
135
+ <tr>
136
+ <td>3.8</td>
137
+ <td>🟢</td>
138
+ <td>🟡</td>
139
+ <td>🟤</td>
140
+ </tr>
141
+ <tr>
142
+ <td>3.9</td>
143
+ <td>🟢</td>
144
+ <td>🟡</td>
145
+ <td>🟤</td>
146
+ </tr>
147
+ <tr>
148
+ <td>3.10</td>
149
+ <td>🟢</td>
150
+ <td>🟢</td>
151
+ <td>🟤</td>
152
+ </tr>
153
+ <tr>
154
+ <td>3.11</td>
155
+ <td>🟡</td>
156
+ <td>🟡</td>
157
+ <td>🟤</td>
158
+ </tr>
159
+ </tbody>
160
+ </table>
161
+ </div>
162
+ <div class="legend">
163
+ <table style="text-align:center">
164
+ <caption style="text-align:left">
165
+ <strong>Legend</strong>
166
+ </caption>
167
+ <thead>
168
+ <tr>
169
+ <th>Key</th>
170
+ <th>Status</th>
171
+ <th>Description</th>
172
+ </tr>
173
+ </thead>
174
+ <tbody>
175
+ <tr>
176
+ <td>🟢</td>
177
+ <td>Supported</td>
178
+ <td>regularly tested, and fully supported</td>
179
+ </tr>
180
+ <tr>
181
+ <td>🟡</td>
182
+ <td>Limited Support</td>
183
+ <td>not explicitly tested but should work, and supported on a best-effort basis</td>
184
+ </tr>
185
+ <tr>
186
+ <td>🟤</td>
187
+ <td>Not Tested</td>
188
+ <td>should work, but no guarantees and/or support</td>
189
+ </tr>
190
+ </tbody>
191
+ </table>
192
+ </div>
193
+ </div>
194
+
195
+ ## More Resources
196
+
197
+ - [License](https://docs.peak.ai/sdk/license.html)
198
+ - [Changelog](https://docs.peak.ai/sdk/changelog.html)
199
+
@@ -0,0 +1,36 @@
1
+ #
2
+ # # Copyright © 2023 Peak AI Limited. or its affiliates. All Rights Reserved.
3
+ # #
4
+ # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # # may not use this file except in compliance with the License. A copy of
6
+ # # the License is located at:
7
+ # #
8
+ # # https://github.com/PeakBI/peak-sdk/blob/main/LICENSE
9
+ # #
10
+ # # or in the "license" file accompanying this file. This file is
11
+ # # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # # ANY KIND, either express or implied. See the License for the specific
13
+ # # language governing permissions and limitations under the License.
14
+ # #
15
+ # # This file is part of the peak-sdk.
16
+ # # see (https://github.com/PeakBI/peak-sdk)
17
+ # #
18
+ # # You should have received a copy of the APACHE LICENSE, VERSION 2.0
19
+ # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
+ #
21
+ """This file is part of the peak-sdk framework.
22
+
23
+ Copyright © 2023 Peak AI
24
+
25
+ Unauthorized copying of this file, via any medium is strictly prohibited.
26
+ """
27
+ from __future__ import annotations
28
+
29
+ from typing import List
30
+
31
+ from peak import press, resources
32
+ from peak.session import Session
33
+
34
+ from ._version import __version__
35
+
36
+ __all__: List[str] = ["Session", "press", "resources", "__version__"]
@@ -0,0 +1,21 @@
1
+ #
2
+ # # Copyright © 2023 Peak AI Limited. or its affiliates. All Rights Reserved.
3
+ # #
4
+ # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # # may not use this file except in compliance with the License. A copy of
6
+ # # the License is located at:
7
+ # #
8
+ # # https://github.com/PeakBI/peak-sdk/blob/main/LICENSE
9
+ # #
10
+ # # or in the "license" file accompanying this file. This file is
11
+ # # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # # ANY KIND, either express or implied. See the License for the specific
13
+ # # language governing permissions and limitations under the License.
14
+ # #
15
+ # # This file is part of the peak-sdk.
16
+ # # see (https://github.com/PeakBI/peak-sdk)
17
+ # #
18
+ # # You should have received a copy of the APACHE LICENSE, VERSION 2.0
19
+ # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
+ #
21
+ __version__: str = "1.0.0"
@@ -0,0 +1,22 @@
1
+ #
2
+ # # Copyright © 2023 Peak AI Limited. or its affiliates. All Rights Reserved.
3
+ # #
4
+ # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # # may not use this file except in compliance with the License. A copy of
6
+ # # the License is located at:
7
+ # #
8
+ # # https://github.com/PeakBI/peak-sdk/blob/main/LICENSE
9
+ # #
10
+ # # or in the "license" file accompanying this file. This file is
11
+ # # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # # ANY KIND, either express or implied. See the License for the specific
13
+ # # language governing permissions and limitations under the License.
14
+ # #
15
+ # # This file is part of the peak-sdk.
16
+ # # see (https://github.com/PeakBI/peak-sdk)
17
+ # #
18
+ # # You should have received a copy of the APACHE LICENSE, VERSION 2.0
19
+ # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
+ #
21
+ """Auth Module."""
22
+ raise NotImplementedError
@@ -0,0 +1,52 @@
1
+ #
2
+ # # Copyright © 2023 Peak AI Limited. or its affiliates. All Rights Reserved.
3
+ # #
4
+ # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # # may not use this file except in compliance with the License. A copy of
6
+ # # the License is located at:
7
+ # #
8
+ # # https://github.com/PeakBI/peak-sdk/blob/main/LICENSE
9
+ # #
10
+ # # or in the "license" file accompanying this file. This file is
11
+ # # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # # ANY KIND, either express or implied. See the License for the specific
13
+ # # language governing permissions and limitations under the License.
14
+ # #
15
+ # # This file is part of the peak-sdk.
16
+ # # see (https://github.com/PeakBI/peak-sdk)
17
+ # #
18
+ # # You should have received a copy of the APACHE LICENSE, VERSION 2.0
19
+ # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
+ #
21
+ """Base client class."""
22
+ from __future__ import annotations
23
+
24
+ from typing import List, Optional
25
+
26
+ from peak.session import Session, _get_default_session
27
+
28
+
29
+ class BaseClient:
30
+ """Base client class."""
31
+
32
+ session: Session
33
+
34
+ def __init__(self, session: Optional[Session] = None) -> None:
35
+ """Assigns a session to the client. If no session is provided, a default session is used.
36
+
37
+ Args:
38
+ session (Optional[Session]): Session object of a tenant. Defaults to None.
39
+
40
+ Raises:
41
+ TypeError: If the session object is invalid.
42
+ """
43
+ invalid_session_error = f"Invalid session object, expected Session but got {type(session)}"
44
+ if session is not None:
45
+ if not isinstance(session, Session):
46
+ raise TypeError(invalid_session_error)
47
+ self.session = session
48
+ else:
49
+ self.session = _get_default_session()
50
+
51
+
52
+ __all__: List[str] = ["BaseClient"]
@@ -0,0 +1,20 @@
1
+ #
2
+ # # Copyright © 2023 Peak AI Limited. or its affiliates. All Rights Reserved.
3
+ # #
4
+ # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # # may not use this file except in compliance with the License. A copy of
6
+ # # the License is located at:
7
+ # #
8
+ # # https://github.com/PeakBI/peak-sdk/blob/main/LICENSE
9
+ # #
10
+ # # or in the "license" file accompanying this file. This file is
11
+ # # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # # ANY KIND, either express or implied. See the License for the specific
13
+ # # language governing permissions and limitations under the License.
14
+ # #
15
+ # # This file is part of the peak-sdk.
16
+ # # see (https://github.com/PeakBI/peak-sdk)
17
+ # #
18
+ # # You should have received a copy of the APACHE LICENSE, VERSION 2.0
19
+ # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
+ #
@@ -0,0 +1,84 @@
1
+ #
2
+ # # Copyright © 2023 Peak AI Limited. or its affiliates. All Rights Reserved.
3
+ # #
4
+ # # Licensed under the Apache License, Version 2.0 (the "License"). You
5
+ # # may not use this file except in compliance with the License. A copy of
6
+ # # the License is located at:
7
+ # #
8
+ # # https://github.com/PeakBI/peak-sdk/blob/main/LICENSE
9
+ # #
10
+ # # or in the "license" file accompanying this file. This file is
11
+ # # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
+ # # ANY KIND, either express or implied. See the License for the specific
13
+ # # language governing permissions and limitations under the License.
14
+ # #
15
+ # # This file is part of the peak-sdk.
16
+ # # see (https://github.com/PeakBI/peak-sdk)
17
+ # #
18
+ # # You should have received a copy of the APACHE LICENSE, VERSION 2.0
19
+ # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
+ #
21
+ """CLI arguments."""
22
+ import typer
23
+ from peak.cli.version import display_version
24
+
25
+ VERSION_OPTION = typer.Option(False, "--version", callback=display_version, is_eager=True)
26
+
27
+ TEMPLATE_PATH = typer.Argument(
28
+ ...,
29
+ help="""
30
+ Path to the file that defines the body for this operation, supports both `yaml` file or a `jinja` template.
31
+ """,
32
+ )
33
+
34
+ TEMPLATE_PARAMS_FILE = typer.Option(
35
+ None,
36
+ "--params-file",
37
+ "-v",
38
+ help="Path to the `yaml` file containing the parameter values map for the template file.",
39
+ )
40
+
41
+ TEMPLATE_PARAMS = typer.Option(
42
+ None,
43
+ "--params",
44
+ "-p",
45
+ help="Parameters to be used with the template file. Overrides the parameters in the params file. Parameters should be in the format `key=value`.",
46
+ )
47
+
48
+ PAGE_NUMBER = typer.Option(None, help="The page number to retrieve.")
49
+
50
+ PAGE_SIZE = typer.Option(None, help="Number of entities to include per page.")
51
+
52
+ DATE_FROM = typer.Option(None, help="The date after which the entities should be included (in ISO format).")
53
+
54
+ DATE_TO = typer.Option(None, help="The date till which the entities should be included (in ISO format).")
55
+
56
+ IMAGE_ID = typer.Option(..., help="ID of the image to be used in this operation.")
57
+
58
+ VERSION_ID = typer.Option(..., help="ID of the version to be used in this operation.")
59
+
60
+ SPEC_ID = typer.Option(..., help="ID of the spec to be used in this operation.")
61
+
62
+ RELEASE_VERSION = typer.Option(..., help="Release version to be used in this operation.")
63
+
64
+ SORT_KEYS = typer.Option(
65
+ None,
66
+ help="A comma-separated list of fields to order results by, in the format \\<field\\>:\\<order\\>.",
67
+ )
68
+
69
+ STATUS_FILTER = typer.Option(None, help="A comma-separated list of statuses to filter entities.")
70
+
71
+ NAME_FILTER = typer.Option(None, help="Only return entities whose names begins with the query string.")
72
+
73
+ TITLE_FILTER = typer.Option(None, help="Only return entities whose title begins with the query string.")
74
+
75
+ SCOPES = typer.Option(None, help="A comma-separated list of scopes to only return entities of those scopes.")
76
+
77
+ FEATURED = typer.Option(None, "--featured", help="Whether to only return featured entities.")
78
+
79
+ KIND_FILTER = typer.Option(None, help="Only return entities with the kind specified.")
80
+
81
+ TERM_FILTER = typer.Option(
82
+ None,
83
+ help="Only return entities which contain the term in name, title, description or summary.",
84
+ )