accli 0.7.3__tar.gz → 0.7.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: accli
3
- Version: 0.7.3
3
+ Version: 0.7.5
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -29,7 +29,7 @@ Project-URL: Bug Tracker, https://github.com/iiasa/accli/issues
29
29
  Classifier: Programming Language :: Python :: 3
30
30
  Classifier: License :: OSI Approved :: MIT License
31
31
  Classifier: Operating System :: OS Independent
32
- Requires-Python: >=3.7.17
32
+ Requires-Python: >=3.7
33
33
  Description-Content-Type: text/markdown
34
34
  License-File: LICENSE
35
35
 
@@ -91,3 +91,6 @@ Please follow [this link.](https://packaging.python.org/en/latest/tutorials/pack
91
91
  2. Run 'python scripts/tag.py'
92
92
  3. `python -m build`
93
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
@@ -56,3 +56,6 @@ Please follow [this link.](https://packaging.python.org/en/latest/tutorials/pack
56
56
  2. Run 'python scripts/tag.py'
57
57
  3. `python -m build`
58
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
@@ -121,6 +121,25 @@ class AcceleratorJobProjectService:
121
121
  if res.data:
122
122
  return todict(res.data)
123
123
 
124
+
125
+ def get_filename_dataset_type(self, filename):
126
+ res = self.http_client_request(
127
+ "GET",
128
+ f"{self.cli_base_url}/filename-dataset-type/?filename={filename}",
129
+ headers=self.common_request_headers
130
+ )
131
+ if res.data:
132
+ return todict(res.data)
133
+
134
+ def get_filename_validation_details(self, filename):
135
+ res = self.http_client_request(
136
+ "GET",
137
+ f"{self.cli_base_url}/filename-validation-detail/?filename={filename}",
138
+ headers=self.common_request_headers
139
+ )
140
+ if res.data:
141
+ return todict(res.data)
142
+
124
143
  def get_bucket_object_validation_details(self, bucket_object_id):
125
144
  res = self.http_client_request(
126
145
  "GET",
@@ -228,7 +247,7 @@ class AcceleratorJobProjectService:
228
247
 
229
248
  def get_multipart_put_update_signed_url(
230
249
  self,
231
- bucket_object_id,
250
+ filename,
232
251
  upload_id,
233
252
  part_number,
234
253
  ):
@@ -236,7 +255,7 @@ class AcceleratorJobProjectService:
236
255
  "GET",
237
256
  f"{self.cli_base_url}/put-update-signed-url",
238
257
  fields=dict(
239
- bucket_object_id=bucket_object_id,
258
+ filename=filename,
240
259
  upload_id=upload_id,
241
260
  part_number=part_number
242
261
  ),
@@ -270,10 +289,11 @@ class AcceleratorJobProjectService:
270
289
 
271
290
  return data['upload_id'], data['app_bucket_id'], data['uniqified_filename']
272
291
 
273
- def get_put_update_multipart_upload_id(self, bucket_object_id):
292
+ def get_put_update_multipart_upload_id(self, filename):
293
+ encoded_filename = quote(filename)
274
294
  res = self.http_client_request(
275
295
  "GET",
276
- f"{self.cli_base_url}/update-multipart-upload-id/{bucket_object_id}",
296
+ f"{self.cli_base_url}/update-multipart-upload-id/?filename={encoded_filename}",
277
297
  headers=self.common_request_headers
278
298
  )
279
299
 
@@ -306,8 +326,34 @@ class AcceleratorJobProjectService:
306
326
 
307
327
  return todict(res.data)
308
328
 
329
+
330
+ def complete_validator_multipart_upload(
331
+ self,
332
+ app_bucket_id,
333
+ filename,
334
+ upload_id,
335
+ parts: List[Tuple[str, str]]
336
+ ):
337
+ headers = {"Content-Type": "application/json"}
338
+
339
+ headers.update(self.common_request_headers)
340
+
341
+ res = self.http_client_request(
342
+ "PUT",
343
+ f"{self.cli_base_url}/complete-validator-multipart-upload",
344
+ json=dict(
345
+ app_bucket_id=app_bucket_id,
346
+ filename=filename,
347
+ upload_id=upload_id,
348
+ parts=base64.b64encode(json.dumps(parts).encode()).decode()
349
+ ),
350
+ headers=headers
351
+ )
352
+
353
+ return todict(res.data)
354
+
309
355
  def complete_update_multipart_upload(
310
- self, bucket_object_id, upload_id, parts: List[Tuple[str, str]]
356
+ self, filename, upload_id, parts: List[Tuple[str, str]]
311
357
  ):
312
358
 
313
359
  headers = {"Content-Type": "application/json"}
@@ -318,13 +364,15 @@ class AcceleratorJobProjectService:
318
364
  "PUT",
319
365
  f"{self.cli_base_url}/complete-update-multipart-upload",
320
366
  json=dict(
321
- bucket_object_id=bucket_object_id,
367
+ filename=filename,
322
368
  upload_id=upload_id,
323
369
  parts=base64.b64encode(json.dumps(parts).encode()).decode()
324
370
  ),
325
371
  headers=headers
326
372
  )
327
373
 
374
+ return todict(res.data)
375
+
328
376
  def abort_create_multipart_upload(self, app_bucket_id, filename, upload_id):
329
377
 
330
378
  headers = {"Content-Type": "application/json"}
@@ -342,7 +390,7 @@ class AcceleratorJobProjectService:
342
390
  headers=headers
343
391
  )
344
392
 
345
- def abort_update_multipart_upload(self, bucket_object_id, upload_id):
393
+ def abort_update_multipart_upload(self, filename, upload_id):
346
394
 
347
395
  headers = {
348
396
  # "Content-Type": "application/json"
@@ -354,7 +402,7 @@ class AcceleratorJobProjectService:
354
402
  "PUT",
355
403
  f"{self.cli_base_url}/abort-update-multipart-upload",
356
404
  json=dict(
357
- bucket_object_id=bucket_object_id,
405
+ filename=filename,
358
406
  upload_id=upload_id
359
407
  ),
360
408
  headers=headers
@@ -512,7 +560,7 @@ class AcceleratorJobProjectService:
512
560
  )
513
561
  raise err
514
562
 
515
- def replace_bucket_object_id_content(self, bucket_object_id, file_stream):
563
+ def replace_bucket_object_id_content(self, filename, file_stream):
516
564
  headers = dict()
517
565
  headers["Content-Type"] = "application/octet-stream"
518
566
 
@@ -552,12 +600,11 @@ class AcceleratorJobProjectService:
552
600
 
553
601
  if not upload_id:
554
602
  upload_id = self.get_put_update_multipart_upload_id(
555
- bucket_object_id,
556
- # headers=headers
603
+ filename
557
604
  )
558
605
 
559
606
  put_presigned_url = self.get_multipart_put_update_signed_url(
560
- bucket_object_id, upload_id, part_number
607
+ filename, upload_id, part_number
561
608
  )
562
609
 
563
610
  part_upload_response = requests.put(
@@ -570,16 +617,18 @@ class AcceleratorJobProjectService:
570
617
  etag = part_upload_response.headers.get("etag").replace('"', "")
571
618
  parts.append((part_number, etag))
572
619
 
573
- result = self.complete_update_multipart_upload(
574
- bucket_object_id,
620
+ created_bucket_object_id = self.complete_update_multipart_upload(
621
+ filename,
575
622
  upload_id,
576
623
  parts,
577
624
  )
625
+
626
+ return created_bucket_object_id
578
627
  except Exception as err:
579
628
  # Cancel if any error
580
629
  if upload_id:
581
630
  self.abort_update_multipart_upload(
582
- bucket_object_id,
631
+ filename,
583
632
  upload_id,
584
633
  )
585
634
 
@@ -648,8 +697,8 @@ class AcceleratorJobProjectService:
648
697
  etag = part_upload_response.headers.get("etag").replace('"', "")
649
698
  parts.append((part_number, etag))
650
699
 
651
- created_bucket_object_id = self.complete_job_multipart_upload(
652
- app_bucket_id, uniqified_filename, upload_id, parts, is_log_file=is_log_file
700
+ created_bucket_object_id = self.complete_validator_multipart_upload(
701
+ app_bucket_id, uniqified_filename, upload_id, parts
653
702
  )
654
703
  return created_bucket_object_id
655
704
 
@@ -1,3 +1,3 @@
1
1
  # Please strictly put double quote to use this info for git tag
2
2
  # Read developer guide for git tag command with regex
3
- VERSION = "v0.7.3"
3
+ VERSION = "v0.7.5"
@@ -47,8 +47,8 @@ def about():
47
47
 
48
48
  @app.command()
49
49
  def login(
50
- server: Annotated[str, typer.Option(..., '-c',help="Accelerator server url.")] = "https://accelerator-api.iiasa.ac.at",
51
- webcli: Annotated[str, typer.Option(..., '-s', help="Accelerator web client for authorization.")] = "https://accelerator.iiasa.ac.at"
50
+ server: Annotated[str, typer.Option(..., '-s',help="Accelerator server url.")] = "https://accelerator-api.iiasa.ac.at",
51
+ webcli: Annotated[str, typer.Option(..., '-c', help="Accelerator web client for authorization.")] = "https://accelerator.iiasa.ac.at"
52
52
  ):
53
53
  print(
54
54
  f"[bold cyan]Welcome to Accelerator Terminal Client.[/bold cyan]\n"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: accli
3
- Version: 0.7.3
3
+ Version: 0.7.5
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -29,7 +29,7 @@ Project-URL: Bug Tracker, https://github.com/iiasa/accli/issues
29
29
  Classifier: Programming Language :: Python :: 3
30
30
  Classifier: License :: OSI Approved :: MIT License
31
31
  Classifier: Operating System :: OS Independent
32
- Requires-Python: >=3.7.17
32
+ Requires-Python: >=3.7
33
33
  Description-Content-Type: text/markdown
34
34
  License-File: LICENSE
35
35
 
@@ -91,3 +91,6 @@ Please follow [this link.](https://packaging.python.org/en/latest/tutorials/pack
91
91
  2. Run 'python scripts/tag.py'
92
92
  3. `python -m build`
93
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
@@ -0,0 +1,7 @@
1
+ urllib3>=1.26.5
2
+ typer[all]>=0.4.0
3
+ tinydb>=4.5.2
4
+ requests>=2.25.1
5
+ jsonschema>=4.5.1
6
+ pydantic>=2.0
7
+ gitpython>=3.1.30
@@ -11,8 +11,16 @@ authors = [
11
11
  description = "IIASA Accelerator Client"
12
12
  readme = "README.md"
13
13
  license = {file = "LICENSE"}
14
- requires-python = ">=3.7.17"
15
- dependencies = ['urllib3', 'typer[all]', 'tinydb', 'requests', 'jsonschema', 'pydantic', 'gitpython']
14
+ requires-python = ">=3.7"
15
+ dependencies = [
16
+ "urllib3>=1.26.5", # 2.0.7 is recent, but 1.26.5+ is widely compatible
17
+ "typer[all]>=0.4.0", # 0.4.0+ is stable and has most features
18
+ "tinydb>=4.5.2", # 4.5.2 is a solid release, avoid tight pin
19
+ "requests>=2.25.1", # Commonly supported baseline
20
+ "jsonschema>=4.5.1", # 4.5.1+ is safe across libraries
21
+ "pydantic>=2.0", # Major version 2 required if you're using v2 features
22
+ "gitpython>=3.1.30" # Minimum stable with good Python 3.7+ support
23
+ ]
16
24
  classifiers = [
17
25
  "Programming Language :: Python :: 3",
18
26
  "License :: OSI Approved :: MIT License",
@@ -30,4 +38,4 @@ version = {attr="accli._version.VERSION"}
30
38
  "Bug Tracker" = "https://github.com/iiasa/accli/issues"
31
39
 
32
40
  [project.scripts]
33
- accli = "accli.cli:app"
41
+ accli = "accli.cli:app"
@@ -1,7 +0,0 @@
1
- urllib3
2
- typer[all]
3
- tinydb
4
- requests
5
- jsonschema
6
- pydantic
7
- gitpython
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes