accli 0.7.10__tar.gz → 0.8.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.
- accli-0.8.0/PKG-INFO +148 -0
- accli-0.8.0/README.md +113 -0
- {accli-0.7.10 → accli-0.8.0}/accli/AcceleratorJobProjectService.py +40 -44
- {accli-0.7.10 → accli-0.8.0}/accli/AcceleratorTaskDispatcher.py +3 -1
- {accli-0.7.10 → accli-0.8.0}/accli/AcceleratorTerminalCliProjectService.py +20 -6
- {accli-0.7.10 → accli-0.8.0}/accli/_version.py +1 -1
- {accli-0.7.10 → accli-0.8.0}/accli/cli.py +69 -4
- accli-0.8.0/accli.egg-info/PKG-INFO +148 -0
- accli-0.7.10/PKG-INFO +0 -96
- accli-0.7.10/README.md +0 -61
- accli-0.7.10/accli.egg-info/PKG-INFO +0 -96
- {accli-0.7.10 → accli-0.8.0}/LICENSE +0 -0
- {accli-0.7.10 → accli-0.8.0}/accli/CsvRegionalTimeseriesValidator.py +0 -0
- {accli-0.7.10 → accli-0.8.0}/accli/__init__.py +0 -0
- {accli-0.7.10 → accli-0.8.0}/accli/__main__.py +0 -0
- {accli-0.7.10 → accli-0.8.0}/accli/common.py +0 -0
- {accli-0.7.10 → accli-0.8.0}/accli/token.py +0 -0
- {accli-0.7.10 → accli-0.8.0}/accli.egg-info/SOURCES.txt +0 -0
- {accli-0.7.10 → accli-0.8.0}/accli.egg-info/dependency_links.txt +0 -0
- {accli-0.7.10 → accli-0.8.0}/accli.egg-info/entry_points.txt +0 -0
- {accli-0.7.10 → accli-0.8.0}/accli.egg-info/requires.txt +0 -0
- {accli-0.7.10 → accli-0.8.0}/accli.egg-info/top_level.txt +0 -0
- {accli-0.7.10 → accli-0.8.0}/pyproject.toml +0 -0
- {accli-0.7.10 → accli-0.8.0}/setup.cfg +0 -0
accli-0.8.0/PKG-INFO
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: accli
|
|
3
|
+
Version: 0.8.0
|
|
4
|
+
Summary: IIASA Accelerator Client
|
|
5
|
+
Author-email: Wrufesh S <wrufesh@gmail.com>
|
|
6
|
+
License: The MIT License (MIT)
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2018 Sebastián Ramírez
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in
|
|
18
|
+
all copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
+
THE SOFTWARE.
|
|
27
|
+
Project-URL: Homepage, https://github.com/iiasa/accli
|
|
28
|
+
Project-URL: Bug Tracker, https://github.com/iiasa/accli/issues
|
|
29
|
+
Classifier: Programming Language :: Python :: 3
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Operating System :: OS Independent
|
|
32
|
+
Requires-Python: >=3.7
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
License-File: LICENSE
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# Accelerator Terminal Client and Python API
|
|
38
|
+
|
|
39
|
+
This package provides:
|
|
40
|
+
|
|
41
|
+
- A **command-line client** (`accli`) for interacting with the **Accelerator**.
|
|
42
|
+
- A **Python API** via the `accli` package.
|
|
43
|
+
|
|
44
|
+
Both interfaces communicate with the Accelerator’s REST API, implemented in the [Control Services Backend](https://github.com/iiasa/control_services_backend).
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 🔐 Authentication
|
|
49
|
+
|
|
50
|
+
This client uses **device authentication** via Auth0.
|
|
51
|
+
|
|
52
|
+
- **OAuth Flow**: [Device Authorization Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/device-authorization-flow)
|
|
53
|
+
- **Token Validity**: 7 days
|
|
54
|
+
- **Access Control**: Role-Based Access Control (RBAC) with stateless tokens
|
|
55
|
+
- **Grants**: Limited and scoped
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 📖 User Guide
|
|
60
|
+
|
|
61
|
+
### ✅ Requirements
|
|
62
|
+
|
|
63
|
+
- Python >= 3.7.17
|
|
64
|
+
|
|
65
|
+
### 📦 Installation
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install accli --user
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### ▶️ Usage
|
|
72
|
+
|
|
73
|
+
#### As a Python Module
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python -m accli
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### As an Executable
|
|
80
|
+
|
|
81
|
+
After installation, the executable might not be in your system `PATH`. You may see a warning like this:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
WARNING: The script accli.exe is installed in 'C:\Users\<user>\AppData\Roaming\Python\Python311\Scripts' which is not on PATH.
|
|
85
|
+
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
To resolve this, add the script's path to your system's environment variables:
|
|
89
|
+
|
|
90
|
+
- [Update PATH on Windows](https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho)
|
|
91
|
+
- [Update PATH on Linux](https://www.geeksforgeeks.org/how-to-set-path-permanantly-in-linux/)
|
|
92
|
+
|
|
93
|
+
> **Note:** On Linux/macOS, you may need to prefix the command with `./`, and on Windows, with `.\`.
|
|
94
|
+
|
|
95
|
+
### 🔍 Help Command
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
accli --help
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Sample Output:**
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
Usage: accli [OPTIONS] COMMAND [ARGS]...
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 👩💻 Developer Guide
|
|
110
|
+
|
|
111
|
+
### 🛠 Build & Upload
|
|
112
|
+
|
|
113
|
+
Follow the official Python packaging tutorial:
|
|
114
|
+
[Packaging Projects – Python.org](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
|
|
115
|
+
|
|
116
|
+
### 🚀 Release Process
|
|
117
|
+
|
|
118
|
+
1. Update the version in `accli/_version.py`
|
|
119
|
+
2. Tag the release:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
python scripts/tag.py
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
3. Build the package:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
python -m build
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
4. Upload to PyPI:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
twine upload -r pypi -u __token__ -p <password-or-token> ./dist/*
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## 🧪 Experimental
|
|
140
|
+
|
|
141
|
+
Consider bundling with Nuitka:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
nuitka --standalone --onefile --static-libpython=yes \
|
|
145
|
+
--include-package=accli \
|
|
146
|
+
--output-dir=build \
|
|
147
|
+
-m accli.cli:app
|
|
148
|
+
```
|
accli-0.8.0/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
|
|
2
|
+
# Accelerator Terminal Client and Python API
|
|
3
|
+
|
|
4
|
+
This package provides:
|
|
5
|
+
|
|
6
|
+
- A **command-line client** (`accli`) for interacting with the **Accelerator**.
|
|
7
|
+
- A **Python API** via the `accli` package.
|
|
8
|
+
|
|
9
|
+
Both interfaces communicate with the Accelerator’s REST API, implemented in the [Control Services Backend](https://github.com/iiasa/control_services_backend).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 🔐 Authentication
|
|
14
|
+
|
|
15
|
+
This client uses **device authentication** via Auth0.
|
|
16
|
+
|
|
17
|
+
- **OAuth Flow**: [Device Authorization Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/device-authorization-flow)
|
|
18
|
+
- **Token Validity**: 7 days
|
|
19
|
+
- **Access Control**: Role-Based Access Control (RBAC) with stateless tokens
|
|
20
|
+
- **Grants**: Limited and scoped
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 📖 User Guide
|
|
25
|
+
|
|
26
|
+
### ✅ Requirements
|
|
27
|
+
|
|
28
|
+
- Python >= 3.7.17
|
|
29
|
+
|
|
30
|
+
### 📦 Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install accli --user
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### ▶️ Usage
|
|
37
|
+
|
|
38
|
+
#### As a Python Module
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
python -m accli
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
#### As an Executable
|
|
45
|
+
|
|
46
|
+
After installation, the executable might not be in your system `PATH`. You may see a warning like this:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
WARNING: The script accli.exe is installed in 'C:\Users\<user>\AppData\Roaming\Python\Python311\Scripts' which is not on PATH.
|
|
50
|
+
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
To resolve this, add the script's path to your system's environment variables:
|
|
54
|
+
|
|
55
|
+
- [Update PATH on Windows](https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho)
|
|
56
|
+
- [Update PATH on Linux](https://www.geeksforgeeks.org/how-to-set-path-permanantly-in-linux/)
|
|
57
|
+
|
|
58
|
+
> **Note:** On Linux/macOS, you may need to prefix the command with `./`, and on Windows, with `.\`.
|
|
59
|
+
|
|
60
|
+
### 🔍 Help Command
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
accli --help
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Sample Output:**
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Usage: accli [OPTIONS] COMMAND [ARGS]...
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 👩💻 Developer Guide
|
|
75
|
+
|
|
76
|
+
### 🛠 Build & Upload
|
|
77
|
+
|
|
78
|
+
Follow the official Python packaging tutorial:
|
|
79
|
+
[Packaging Projects – Python.org](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
|
|
80
|
+
|
|
81
|
+
### 🚀 Release Process
|
|
82
|
+
|
|
83
|
+
1. Update the version in `accli/_version.py`
|
|
84
|
+
2. Tag the release:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
python scripts/tag.py
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
3. Build the package:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
python -m build
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
4. Upload to PyPI:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
twine upload -r pypi -u __token__ -p <password-or-token> ./dist/*
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 🧪 Experimental
|
|
105
|
+
|
|
106
|
+
Consider bundling with Nuitka:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
nuitka --standalone --onefile --static-libpython=yes \
|
|
110
|
+
--include-package=accli \
|
|
111
|
+
--output-dir=build \
|
|
112
|
+
-m accli.cli:app
|
|
113
|
+
```
|
|
@@ -12,6 +12,8 @@ from typing import List, Tuple
|
|
|
12
12
|
|
|
13
13
|
from accli.common import todict
|
|
14
14
|
|
|
15
|
+
ACCLI_DEBUG = os.environ.get('ACCLI_DEBUG', False)
|
|
16
|
+
|
|
15
17
|
class AccAPIError(Exception):
|
|
16
18
|
pass
|
|
17
19
|
|
|
@@ -20,17 +22,15 @@ class AccAPIError(Exception):
|
|
|
20
22
|
# self.response_data = kwargs.pop('response_data')
|
|
21
23
|
# super().__init__(*args, **kwargs)
|
|
22
24
|
|
|
23
|
-
class UnhealthyControlServerError(Exception):
|
|
24
|
-
pass
|
|
25
25
|
|
|
26
26
|
retries = urllib3.util.Retry(total=10, backoff_factor=1)
|
|
27
27
|
|
|
28
28
|
http_client = urllib3.poolmanager.PoolManager(
|
|
29
|
-
num_pools=20, retries=retries
|
|
29
|
+
num_pools=20, retries=retries, maxsize=2000, block=True
|
|
30
30
|
)
|
|
31
31
|
|
|
32
32
|
http_client_wo_cert_verification = urllib3.poolmanager.PoolManager(
|
|
33
|
-
cert_reqs="CERT_NONE", num_pools=20, retries=retries
|
|
33
|
+
cert_reqs="CERT_NONE", num_pools=20, retries=retries, maxsize=2000, block=True
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
class AcceleratorJobProjectService:
|
|
@@ -38,7 +38,7 @@ class AcceleratorJobProjectService:
|
|
|
38
38
|
self,
|
|
39
39
|
user_token,
|
|
40
40
|
server_url='http://accelerator-api.iiasa.ac.at',
|
|
41
|
-
verify_cert=
|
|
41
|
+
verify_cert=(not ACCLI_DEBUG)
|
|
42
42
|
):
|
|
43
43
|
|
|
44
44
|
self.user_token = user_token
|
|
@@ -168,32 +168,32 @@ class AcceleratorJobProjectService:
|
|
|
168
168
|
return resp
|
|
169
169
|
|
|
170
170
|
def check_job_health(self):
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
raise UnhealthyControlServerError(str(err))
|
|
171
|
+
|
|
172
|
+
res = self.http_client_request(
|
|
173
|
+
"GET",
|
|
174
|
+
f"{self.cli_base_url}/is-healthy/",
|
|
175
|
+
headers=self.common_request_headers
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
if res.data:
|
|
179
|
+
res = todict(res.data)
|
|
181
180
|
|
|
182
181
|
is_healthy = res['is_healthy']
|
|
183
182
|
return is_healthy
|
|
184
183
|
|
|
185
184
|
def add_log_file(self, data: bytes, filename):
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if res.data:
|
|
193
|
-
res = todict(res.data)
|
|
194
|
-
except Exception as err:
|
|
195
|
-
raise UnhealthyControlServerError(str(err))
|
|
185
|
+
|
|
186
|
+
res = self.http_client_request(
|
|
187
|
+
"GET",
|
|
188
|
+
f"{self.cli_base_url}/presigned-log-upload-url/?filename={filename}",
|
|
189
|
+
headers=self.common_request_headers
|
|
190
|
+
)
|
|
196
191
|
|
|
192
|
+
if res.data:
|
|
193
|
+
res = todict(res.data)
|
|
194
|
+
else:
|
|
195
|
+
raise ValueError(f"Unable to get presign url in response: {res.data}")
|
|
196
|
+
|
|
197
197
|
upload_url = res['upload_url']
|
|
198
198
|
app_bucket_id = res['app_bucket_id']
|
|
199
199
|
res_filename = res['filename']
|
|
@@ -206,23 +206,19 @@ class AcceleratorJobProjectService:
|
|
|
206
206
|
verify=False,
|
|
207
207
|
)
|
|
208
208
|
|
|
209
|
-
try:
|
|
210
|
-
self.http_client_request(
|
|
211
|
-
"POST",
|
|
212
|
-
f"{self.cli_base_url}/register-log-file/",
|
|
213
|
-
json=dict(
|
|
214
|
-
filename=res_filename,
|
|
215
|
-
app_bucket_id=app_bucket_id
|
|
216
|
-
),
|
|
217
|
-
headers=self.common_request_headers
|
|
218
|
-
)
|
|
219
|
-
except Exception as err:
|
|
220
|
-
raise UnhealthyControlServerError(str(err))
|
|
221
|
-
|
|
222
|
-
if not is_healthy:
|
|
223
|
-
raise UnhealthyControlServerError('Unhealthy control server.')
|
|
224
|
-
|
|
225
209
|
|
|
210
|
+
self.http_client_request(
|
|
211
|
+
"POST",
|
|
212
|
+
f"{self.cli_base_url}/register-log-file/",
|
|
213
|
+
json=dict(
|
|
214
|
+
filename=res_filename,
|
|
215
|
+
app_bucket_id=app_bucket_id
|
|
216
|
+
),
|
|
217
|
+
headers=self.common_request_headers
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
return is_healthy
|
|
221
|
+
|
|
226
222
|
|
|
227
223
|
def get_multipart_put_create_signed_url(
|
|
228
224
|
self,
|
|
@@ -739,7 +735,7 @@ class Fs:
|
|
|
739
735
|
accelerator_job_service = AcceleratorJobProjectService(
|
|
740
736
|
user_token,
|
|
741
737
|
server_url=server_url,
|
|
742
|
-
verify_cert=
|
|
738
|
+
verify_cert=(not ACCLI_DEBUG)
|
|
743
739
|
)
|
|
744
740
|
|
|
745
741
|
accelerator_job_service.add_filestream_as_job_output(
|
|
@@ -763,7 +759,7 @@ class Fs:
|
|
|
763
759
|
accelerator_job_service = AcceleratorJobProjectService(
|
|
764
760
|
user_token,
|
|
765
761
|
server_url=server_url,
|
|
766
|
-
verify_cert=
|
|
762
|
+
verify_cert=(not ACCLI_DEBUG)
|
|
767
763
|
)
|
|
768
764
|
|
|
769
765
|
return accelerator_job_service.get_file_url_from_repo(
|
|
@@ -805,7 +801,7 @@ class Fs:
|
|
|
805
801
|
accelerator_job_service = AcceleratorJobProjectService(
|
|
806
802
|
user_token,
|
|
807
803
|
server_url=server_url,
|
|
808
|
-
verify_cert=
|
|
804
|
+
verify_cert=(not ACCLI_DEBUG)
|
|
809
805
|
)
|
|
810
806
|
|
|
811
807
|
return accelerator_job_service.enumerate_files_by_prefix(
|
|
@@ -15,6 +15,8 @@ from accli.token import (
|
|
|
15
15
|
get_project_slug
|
|
16
16
|
)
|
|
17
17
|
|
|
18
|
+
ACCLI_DEBUG = os.environ.get('ACCLI_DEBUG', False)
|
|
19
|
+
|
|
18
20
|
FOLDER_JOB_REPO_URL = 'https://github.com/IIASA-Accelerator/wkube-job.git'
|
|
19
21
|
|
|
20
22
|
|
|
@@ -73,7 +75,7 @@ def push_folder_job(dir):
|
|
|
73
75
|
term_cli_project_service = AcceleratorTerminalCliProjectService(
|
|
74
76
|
user_token=access_token,
|
|
75
77
|
server_url=server_url,
|
|
76
|
-
verify_cert=
|
|
78
|
+
verify_cert=(not ACCLI_DEBUG)
|
|
77
79
|
)
|
|
78
80
|
|
|
79
81
|
repo_dir = tempfile.mkdtemp()
|
|
@@ -9,6 +9,8 @@ from rich.progress import Progress
|
|
|
9
9
|
|
|
10
10
|
from accli.common import todict
|
|
11
11
|
|
|
12
|
+
ACCLI_DEBUG = os.environ.get('ACCLI_DEBUG', False)
|
|
13
|
+
|
|
12
14
|
class AccAPIError(Exception):
|
|
13
15
|
|
|
14
16
|
def __init__(self, message, response, status_code):
|
|
@@ -21,11 +23,11 @@ class AccAPIError(Exception):
|
|
|
21
23
|
retries = urllib3.util.Retry(total=10, backoff_factor=1)
|
|
22
24
|
|
|
23
25
|
http_client = urllib3.poolmanager.PoolManager(
|
|
24
|
-
num_pools=20, retries=retries
|
|
26
|
+
num_pools=20, retries=retries, maxsize=2000, block=True
|
|
25
27
|
)
|
|
26
28
|
|
|
27
29
|
http_client_wo_cert_verification = urllib3.poolmanager.PoolManager(
|
|
28
|
-
cert_reqs="CERT_NONE", num_pools=20, retries=retries
|
|
30
|
+
cert_reqs="CERT_NONE", num_pools=20, retries=retries, maxsize=2000, block=True
|
|
29
31
|
)
|
|
30
32
|
|
|
31
33
|
class AcceleratorTerminalCliProjectService:
|
|
@@ -33,7 +35,7 @@ class AcceleratorTerminalCliProjectService:
|
|
|
33
35
|
self,
|
|
34
36
|
user_token,
|
|
35
37
|
server_url,
|
|
36
|
-
verify_cert=
|
|
38
|
+
verify_cert=(not ACCLI_DEBUG)
|
|
37
39
|
):
|
|
38
40
|
|
|
39
41
|
self.user_token = user_token
|
|
@@ -91,11 +93,11 @@ class AcceleratorTerminalCliProjectService:
|
|
|
91
93
|
|
|
92
94
|
return todict(res.data)
|
|
93
95
|
|
|
94
|
-
def get_file_url_from_repo(self, filename):
|
|
96
|
+
def get_file_url_from_repo(self, filename, token_pass=""):
|
|
95
97
|
project_slug = filename.split('/')[0]
|
|
96
98
|
res = self.http_client_request(
|
|
97
99
|
"GET",
|
|
98
|
-
f"{self.cli_base_url}/{project_slug}/get-file-download-url/?filename={filename}",
|
|
100
|
+
f"{self.cli_base_url}/{project_slug}/get-file-download-url/?filename={filename}&token_pass={token_pass}",
|
|
99
101
|
headers=self.common_request_headers
|
|
100
102
|
)
|
|
101
103
|
if res.data:
|
|
@@ -361,5 +363,17 @@ class AcceleratorTerminalCliProjectService:
|
|
|
361
363
|
)
|
|
362
364
|
|
|
363
365
|
raise err
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
def enumerate_files_by_prefix(self, prefix, token_pass=""):
|
|
369
|
+
project_slug = prefix.split('/')[0]
|
|
364
370
|
|
|
365
|
-
|
|
371
|
+
b64_encoded_prefix = base64.b64encode(prefix.encode()).decode()
|
|
372
|
+
|
|
373
|
+
res = self.http_client_request(
|
|
374
|
+
"GET",
|
|
375
|
+
f"{self.cli_base_url}/{project_slug}/enumerate-all-files/{b64_encoded_prefix}/?token_pass={token_pass}",
|
|
376
|
+
headers=self.common_request_headers
|
|
377
|
+
)
|
|
378
|
+
if res.data:
|
|
379
|
+
return todict(res.data)
|
|
@@ -3,6 +3,7 @@ import click
|
|
|
3
3
|
import glob
|
|
4
4
|
import os
|
|
5
5
|
import typer
|
|
6
|
+
from pathlib import Path
|
|
6
7
|
import requests
|
|
7
8
|
import warnings
|
|
8
9
|
import importlib.util
|
|
@@ -20,6 +21,8 @@ from rich.progress import Progress, SpinnerColumn, TextColumn, ProgressColumn, B
|
|
|
20
21
|
|
|
21
22
|
warnings.filterwarnings('ignore')
|
|
22
23
|
|
|
24
|
+
ACCLI_DEBUG = os.environ.get('ACCLI_DEBUG', False)
|
|
25
|
+
|
|
23
26
|
app = typer.Typer(
|
|
24
27
|
add_completion=False,
|
|
25
28
|
pretty_exceptions_show_locals=False,
|
|
@@ -61,7 +64,8 @@ def login(
|
|
|
61
64
|
|
|
62
65
|
token_response = requests.post(
|
|
63
66
|
f"{server}/v1/oauth/device/token/",
|
|
64
|
-
json={"device_authorization_code": device_authorization_code}
|
|
67
|
+
json={"device_authorization_code": device_authorization_code},
|
|
68
|
+
verify=(not ACCLI_DEBUG)
|
|
65
69
|
)
|
|
66
70
|
|
|
67
71
|
print("")
|
|
@@ -83,7 +87,7 @@ def upload_file(project_slug, accelerator_filename, local_filepath, progress, ta
|
|
|
83
87
|
term_cli_project_service = AcceleratorTerminalCliProjectService(
|
|
84
88
|
user_token=access_token,
|
|
85
89
|
server_url=server_url,
|
|
86
|
-
verify_cert=
|
|
90
|
+
verify_cert=(not ACCLI_DEBUG)
|
|
87
91
|
)
|
|
88
92
|
|
|
89
93
|
stat = term_cli_project_service.get_file_stat(project_slug, f"{folder_name}/{accelerator_filename}")
|
|
@@ -161,7 +165,7 @@ def validate(
|
|
|
161
165
|
term_cli_project_service = AcceleratorTerminalCliProjectService(
|
|
162
166
|
user_token="",
|
|
163
167
|
server_url=server,
|
|
164
|
-
verify_cert=
|
|
168
|
+
verify_cert=(not ACCLI_DEBUG)
|
|
165
169
|
)
|
|
166
170
|
|
|
167
171
|
validate = CsvRegionalTimeseriesValidator(
|
|
@@ -187,7 +191,7 @@ def dispatch(
|
|
|
187
191
|
term_cli_project_service = AcceleratorTerminalCliProjectService(
|
|
188
192
|
user_token=access_token,
|
|
189
193
|
server_url=server_url,
|
|
190
|
-
verify_cert=
|
|
194
|
+
verify_cert=(not ACCLI_DEBUG)
|
|
191
195
|
)
|
|
192
196
|
|
|
193
197
|
base_dir = os.getcwd()
|
|
@@ -219,5 +223,66 @@ def dispatch(
|
|
|
219
223
|
|
|
220
224
|
print(f"Dispatched root job #ID: {root_job_id}")
|
|
221
225
|
|
|
226
|
+
@app.command()
|
|
227
|
+
def copy(
|
|
228
|
+
acc_src: Annotated[str, typer.Argument(help="Source path in Accelerator project space")],
|
|
229
|
+
destination: Annotated[str, typer.Option(..., "-d", help="Destination directory")] = "./",
|
|
230
|
+
token_pass: Annotated[str, typer.Option(..., "-t", help="Destination directory")] = "",
|
|
231
|
+
):
|
|
232
|
+
access_token = get_token()
|
|
233
|
+
server_url = get_server_url()
|
|
222
234
|
|
|
235
|
+
term_cli_project_service = AcceleratorTerminalCliProjectService(
|
|
236
|
+
user_token=access_token,
|
|
237
|
+
server_url=server_url,
|
|
238
|
+
verify_cert=(not ACCLI_DEBUG),
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
dest_path = Path(destination).expanduser().resolve()
|
|
242
|
+
dest_path.mkdir(parents=True, exist_ok=True)
|
|
243
|
+
|
|
244
|
+
filenames: list[str] = term_cli_project_service.enumerate_files_by_prefix(acc_src, token_pass=token_pass)
|
|
245
|
+
|
|
246
|
+
with Progress(
|
|
247
|
+
TextColumn("[progress.description]{task.description}"),
|
|
248
|
+
BarColumn(),
|
|
249
|
+
TaskProgressColumn(),
|
|
250
|
+
TimeElapsedColumn(),
|
|
251
|
+
transient=True,
|
|
252
|
+
) as progress:
|
|
223
253
|
|
|
254
|
+
for filename in filenames:
|
|
255
|
+
local_file = dest_path / filename
|
|
256
|
+
local_file.parent.mkdir(parents=True, exist_ok=True)
|
|
257
|
+
|
|
258
|
+
final_file = local_file
|
|
259
|
+
partial_file = local_file.with_suffix(local_file.suffix + ".part")
|
|
260
|
+
|
|
261
|
+
if final_file.exists():
|
|
262
|
+
typer.echo(f"Skipping {final_file} (already exists)")
|
|
263
|
+
continue
|
|
264
|
+
|
|
265
|
+
typer.echo(f"Downloading {filename} -> {final_file}")
|
|
266
|
+
try:
|
|
267
|
+
file_url = term_cli_project_service.get_file_url_from_repo(filename, token_pass=token_pass)
|
|
268
|
+
with requests.get(file_url, stream=True, verify=(not ACCLI_DEBUG)) as r:
|
|
269
|
+
r.raise_for_status()
|
|
270
|
+
total = int(r.headers.get("Content-Length", 0))
|
|
271
|
+
|
|
272
|
+
task = progress.add_task(
|
|
273
|
+
f"[cyan]Downloading {filename}", total=total or None
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
with open(partial_file, "wb") as f:
|
|
277
|
+
for chunk in r.iter_content(chunk_size=8192):
|
|
278
|
+
if chunk:
|
|
279
|
+
f.write(chunk)
|
|
280
|
+
progress.update(task, advance=len(chunk))
|
|
281
|
+
|
|
282
|
+
partial_file.rename(final_file)
|
|
283
|
+
typer.echo(f"✔ Downloaded {final_file}")
|
|
284
|
+
|
|
285
|
+
except Exception as e:
|
|
286
|
+
if partial_file.exists():
|
|
287
|
+
partial_file.unlink()
|
|
288
|
+
typer.echo(f"✖ Failed to download {filename}: {e}", err=True)
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: accli
|
|
3
|
+
Version: 0.8.0
|
|
4
|
+
Summary: IIASA Accelerator Client
|
|
5
|
+
Author-email: Wrufesh S <wrufesh@gmail.com>
|
|
6
|
+
License: The MIT License (MIT)
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2018 Sebastián Ramírez
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in
|
|
18
|
+
all copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
+
THE SOFTWARE.
|
|
27
|
+
Project-URL: Homepage, https://github.com/iiasa/accli
|
|
28
|
+
Project-URL: Bug Tracker, https://github.com/iiasa/accli/issues
|
|
29
|
+
Classifier: Programming Language :: Python :: 3
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Operating System :: OS Independent
|
|
32
|
+
Requires-Python: >=3.7
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
License-File: LICENSE
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# Accelerator Terminal Client and Python API
|
|
38
|
+
|
|
39
|
+
This package provides:
|
|
40
|
+
|
|
41
|
+
- A **command-line client** (`accli`) for interacting with the **Accelerator**.
|
|
42
|
+
- A **Python API** via the `accli` package.
|
|
43
|
+
|
|
44
|
+
Both interfaces communicate with the Accelerator’s REST API, implemented in the [Control Services Backend](https://github.com/iiasa/control_services_backend).
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 🔐 Authentication
|
|
49
|
+
|
|
50
|
+
This client uses **device authentication** via Auth0.
|
|
51
|
+
|
|
52
|
+
- **OAuth Flow**: [Device Authorization Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/device-authorization-flow)
|
|
53
|
+
- **Token Validity**: 7 days
|
|
54
|
+
- **Access Control**: Role-Based Access Control (RBAC) with stateless tokens
|
|
55
|
+
- **Grants**: Limited and scoped
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 📖 User Guide
|
|
60
|
+
|
|
61
|
+
### ✅ Requirements
|
|
62
|
+
|
|
63
|
+
- Python >= 3.7.17
|
|
64
|
+
|
|
65
|
+
### 📦 Installation
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install accli --user
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### ▶️ Usage
|
|
72
|
+
|
|
73
|
+
#### As a Python Module
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python -m accli
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### As an Executable
|
|
80
|
+
|
|
81
|
+
After installation, the executable might not be in your system `PATH`. You may see a warning like this:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
WARNING: The script accli.exe is installed in 'C:\Users\<user>\AppData\Roaming\Python\Python311\Scripts' which is not on PATH.
|
|
85
|
+
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
To resolve this, add the script's path to your system's environment variables:
|
|
89
|
+
|
|
90
|
+
- [Update PATH on Windows](https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho)
|
|
91
|
+
- [Update PATH on Linux](https://www.geeksforgeeks.org/how-to-set-path-permanantly-in-linux/)
|
|
92
|
+
|
|
93
|
+
> **Note:** On Linux/macOS, you may need to prefix the command with `./`, and on Windows, with `.\`.
|
|
94
|
+
|
|
95
|
+
### 🔍 Help Command
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
accli --help
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Sample Output:**
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
Usage: accli [OPTIONS] COMMAND [ARGS]...
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 👩💻 Developer Guide
|
|
110
|
+
|
|
111
|
+
### 🛠 Build & Upload
|
|
112
|
+
|
|
113
|
+
Follow the official Python packaging tutorial:
|
|
114
|
+
[Packaging Projects – Python.org](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
|
|
115
|
+
|
|
116
|
+
### 🚀 Release Process
|
|
117
|
+
|
|
118
|
+
1. Update the version in `accli/_version.py`
|
|
119
|
+
2. Tag the release:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
python scripts/tag.py
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
3. Build the package:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
python -m build
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
4. Upload to PyPI:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
twine upload -r pypi -u __token__ -p <password-or-token> ./dist/*
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## 🧪 Experimental
|
|
140
|
+
|
|
141
|
+
Consider bundling with Nuitka:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
nuitka --standalone --onefile --static-libpython=yes \
|
|
145
|
+
--include-package=accli \
|
|
146
|
+
--output-dir=build \
|
|
147
|
+
-m accli.cli:app
|
|
148
|
+
```
|
accli-0.7.10/PKG-INFO
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: accli
|
|
3
|
-
Version: 0.7.10
|
|
4
|
-
Summary: IIASA Accelerator Client
|
|
5
|
-
Author-email: Wrufesh S <wrufesh@gmail.com>
|
|
6
|
-
License: The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2018 Sebastián Ramírez
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in
|
|
18
|
-
all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
-
THE SOFTWARE.
|
|
27
|
-
Project-URL: Homepage, https://github.com/iiasa/accli
|
|
28
|
-
Project-URL: Bug Tracker, https://github.com/iiasa/accli/issues
|
|
29
|
-
Classifier: Programming Language :: Python :: 3
|
|
30
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
-
Classifier: Operating System :: OS Independent
|
|
32
|
-
Requires-Python: >=3.7
|
|
33
|
-
Description-Content-Type: text/markdown
|
|
34
|
-
License-File: LICENSE
|
|
35
|
-
|
|
36
|
-
# Accelerator terminal client and Python API
|
|
37
|
-
|
|
38
|
-
Provides a command-line client for interacting with the Accelerator as well as a Python API in the form of the `accli` package. These communicate with the rest API of the Accelerator [Control Services Backend](https://github.com/iiasa/control_services_backend).
|
|
39
|
-
|
|
40
|
-
Uses device authentication:
|
|
41
|
-
- Part 0Auth: [Device Authentication Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/device-authorization-flow).
|
|
42
|
-
- Auth valid for 7 days.
|
|
43
|
-
- Grants are limited.
|
|
44
|
-
- Access via RBAC:
|
|
45
|
-
* Stateless tokens.
|
|
46
|
-
|
|
47
|
-
## User Guide
|
|
48
|
-
|
|
49
|
-
**Requirements**
|
|
50
|
-
* Python >=3.7.17
|
|
51
|
-
|
|
52
|
-
**Installation**
|
|
53
|
-
|
|
54
|
-
`pip install accli --user`
|
|
55
|
-
|
|
56
|
-
**Usage as module**
|
|
57
|
-
|
|
58
|
-
`python -m accli`
|
|
59
|
-
|
|
60
|
-
**Usage as executable**
|
|
61
|
-
|
|
62
|
-
*You might receive following similar warning during installation*
|
|
63
|
-
```
|
|
64
|
-
WARNING: The script accli.exe is installed in 'C:\Users\singhr\AppData\Roaming\Python\Python311\Scripts' which is not on PATH.
|
|
65
|
-
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
*You could also add executable directory path in PATH environment variable. Please follow following links for instruction on adding executable directory path to PATH environemnt variable.*
|
|
69
|
-
|
|
70
|
-
[Updating PATH on windows](https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho)
|
|
71
|
-
|
|
72
|
-
[Updating PATH on linux](https://www.geeksforgeeks.org/how-to-set-path-permanantly-in-linux/)
|
|
73
|
-
|
|
74
|
-
**Command**
|
|
75
|
-
|
|
76
|
-
`accli --help`
|
|
77
|
-
|
|
78
|
-
*Output*
|
|
79
|
-
|
|
80
|
-
`Usage: accli [OPTIONS] COMMAND [ARGS]...`
|
|
81
|
-
|
|
82
|
-
*Note: You may need to prepend the command with either `./`(in linux) or `.\`(in winodws).*
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
## Developer Guide
|
|
86
|
-
**General build and upload instructions**
|
|
87
|
-
Please follow [this link.](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
|
|
88
|
-
|
|
89
|
-
**Release process**
|
|
90
|
-
1. Commit with right version on accli/_version.py
|
|
91
|
-
2. Run 'python scripts/tag.py'
|
|
92
|
-
3. `python -m build`
|
|
93
|
-
4. `twine upload -r pypi -u __token__ -p <password-or-token> ./dist/*`
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
#TODO nuitka --standalone --onefile --static-libpython=yes --include-package=accli --output-dir=build -m accli.cli:app
|
accli-0.7.10/README.md
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# Accelerator terminal client and Python API
|
|
2
|
-
|
|
3
|
-
Provides a command-line client for interacting with the Accelerator as well as a Python API in the form of the `accli` package. These communicate with the rest API of the Accelerator [Control Services Backend](https://github.com/iiasa/control_services_backend).
|
|
4
|
-
|
|
5
|
-
Uses device authentication:
|
|
6
|
-
- Part 0Auth: [Device Authentication Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/device-authorization-flow).
|
|
7
|
-
- Auth valid for 7 days.
|
|
8
|
-
- Grants are limited.
|
|
9
|
-
- Access via RBAC:
|
|
10
|
-
* Stateless tokens.
|
|
11
|
-
|
|
12
|
-
## User Guide
|
|
13
|
-
|
|
14
|
-
**Requirements**
|
|
15
|
-
* Python >=3.7.17
|
|
16
|
-
|
|
17
|
-
**Installation**
|
|
18
|
-
|
|
19
|
-
`pip install accli --user`
|
|
20
|
-
|
|
21
|
-
**Usage as module**
|
|
22
|
-
|
|
23
|
-
`python -m accli`
|
|
24
|
-
|
|
25
|
-
**Usage as executable**
|
|
26
|
-
|
|
27
|
-
*You might receive following similar warning during installation*
|
|
28
|
-
```
|
|
29
|
-
WARNING: The script accli.exe is installed in 'C:\Users\singhr\AppData\Roaming\Python\Python311\Scripts' which is not on PATH.
|
|
30
|
-
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
*You could also add executable directory path in PATH environment variable. Please follow following links for instruction on adding executable directory path to PATH environemnt variable.*
|
|
34
|
-
|
|
35
|
-
[Updating PATH on windows](https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho)
|
|
36
|
-
|
|
37
|
-
[Updating PATH on linux](https://www.geeksforgeeks.org/how-to-set-path-permanantly-in-linux/)
|
|
38
|
-
|
|
39
|
-
**Command**
|
|
40
|
-
|
|
41
|
-
`accli --help`
|
|
42
|
-
|
|
43
|
-
*Output*
|
|
44
|
-
|
|
45
|
-
`Usage: accli [OPTIONS] COMMAND [ARGS]...`
|
|
46
|
-
|
|
47
|
-
*Note: You may need to prepend the command with either `./`(in linux) or `.\`(in winodws).*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## Developer Guide
|
|
51
|
-
**General build and upload instructions**
|
|
52
|
-
Please follow [this link.](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
|
|
53
|
-
|
|
54
|
-
**Release process**
|
|
55
|
-
1. Commit with right version on accli/_version.py
|
|
56
|
-
2. Run 'python scripts/tag.py'
|
|
57
|
-
3. `python -m build`
|
|
58
|
-
4. `twine upload -r pypi -u __token__ -p <password-or-token> ./dist/*`
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
#TODO nuitka --standalone --onefile --static-libpython=yes --include-package=accli --output-dir=build -m accli.cli:app
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: accli
|
|
3
|
-
Version: 0.7.10
|
|
4
|
-
Summary: IIASA Accelerator Client
|
|
5
|
-
Author-email: Wrufesh S <wrufesh@gmail.com>
|
|
6
|
-
License: The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2018 Sebastián Ramírez
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in
|
|
18
|
-
all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
-
THE SOFTWARE.
|
|
27
|
-
Project-URL: Homepage, https://github.com/iiasa/accli
|
|
28
|
-
Project-URL: Bug Tracker, https://github.com/iiasa/accli/issues
|
|
29
|
-
Classifier: Programming Language :: Python :: 3
|
|
30
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
-
Classifier: Operating System :: OS Independent
|
|
32
|
-
Requires-Python: >=3.7
|
|
33
|
-
Description-Content-Type: text/markdown
|
|
34
|
-
License-File: LICENSE
|
|
35
|
-
|
|
36
|
-
# Accelerator terminal client and Python API
|
|
37
|
-
|
|
38
|
-
Provides a command-line client for interacting with the Accelerator as well as a Python API in the form of the `accli` package. These communicate with the rest API of the Accelerator [Control Services Backend](https://github.com/iiasa/control_services_backend).
|
|
39
|
-
|
|
40
|
-
Uses device authentication:
|
|
41
|
-
- Part 0Auth: [Device Authentication Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/device-authorization-flow).
|
|
42
|
-
- Auth valid for 7 days.
|
|
43
|
-
- Grants are limited.
|
|
44
|
-
- Access via RBAC:
|
|
45
|
-
* Stateless tokens.
|
|
46
|
-
|
|
47
|
-
## User Guide
|
|
48
|
-
|
|
49
|
-
**Requirements**
|
|
50
|
-
* Python >=3.7.17
|
|
51
|
-
|
|
52
|
-
**Installation**
|
|
53
|
-
|
|
54
|
-
`pip install accli --user`
|
|
55
|
-
|
|
56
|
-
**Usage as module**
|
|
57
|
-
|
|
58
|
-
`python -m accli`
|
|
59
|
-
|
|
60
|
-
**Usage as executable**
|
|
61
|
-
|
|
62
|
-
*You might receive following similar warning during installation*
|
|
63
|
-
```
|
|
64
|
-
WARNING: The script accli.exe is installed in 'C:\Users\singhr\AppData\Roaming\Python\Python311\Scripts' which is not on PATH.
|
|
65
|
-
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
*You could also add executable directory path in PATH environment variable. Please follow following links for instruction on adding executable directory path to PATH environemnt variable.*
|
|
69
|
-
|
|
70
|
-
[Updating PATH on windows](https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho)
|
|
71
|
-
|
|
72
|
-
[Updating PATH on linux](https://www.geeksforgeeks.org/how-to-set-path-permanantly-in-linux/)
|
|
73
|
-
|
|
74
|
-
**Command**
|
|
75
|
-
|
|
76
|
-
`accli --help`
|
|
77
|
-
|
|
78
|
-
*Output*
|
|
79
|
-
|
|
80
|
-
`Usage: accli [OPTIONS] COMMAND [ARGS]...`
|
|
81
|
-
|
|
82
|
-
*Note: You may need to prepend the command with either `./`(in linux) or `.\`(in winodws).*
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
## Developer Guide
|
|
86
|
-
**General build and upload instructions**
|
|
87
|
-
Please follow [this link.](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
|
|
88
|
-
|
|
89
|
-
**Release process**
|
|
90
|
-
1. Commit with right version on accli/_version.py
|
|
91
|
-
2. Run 'python scripts/tag.py'
|
|
92
|
-
3. `python -m build`
|
|
93
|
-
4. `twine upload -r pypi -u __token__ -p <password-or-token> ./dist/*`
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
#TODO nuitka --standalone --onefile --static-libpython=yes --include-package=accli --output-dir=build -m accli.cli:app
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|