accli 1.0.0__tar.gz → 1.0.2__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
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: accli
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -32,6 +32,13 @@ Classifier: Operating System :: OS Independent
32
32
  Requires-Python: >=3.7
33
33
  Description-Content-Type: text/markdown
34
34
  License-File: LICENSE
35
+ Requires-Dist: urllib3>=1.26.5
36
+ Requires-Dist: typer[all]>=0.4.0
37
+ Requires-Dist: tinydb>=4.5.2
38
+ Requires-Dist: requests>=2.25.1
39
+ Requires-Dist: jsonschema>=4.5.1
40
+ Requires-Dist: pydantic>=2.0
41
+ Dynamic: license-file
35
42
 
36
43
 
37
44
  # Accelerator Terminal Client and Python API
@@ -141,8 +148,10 @@ Follow the official Python packaging tutorial:
141
148
  Consider bundling with Nuitka:
142
149
 
143
150
  ```bash
144
- nuitka --standalone --onefile --static-libpython=yes \
151
+ nuitka --standalone --onefile \
145
152
  --include-package=accli \
146
- --output-dir=build \
147
- -m accli.cli:app
153
+ --include-module=accli \
154
+ --no-prefer-source-code \
155
+ --nofollow-import-to=inspect,token,tokenize,linecache \
156
+ accli/cli.py
148
157
  ```
@@ -106,8 +106,10 @@ Follow the official Python packaging tutorial:
106
106
  Consider bundling with Nuitka:
107
107
 
108
108
  ```bash
109
- nuitka --standalone --onefile --static-libpython=yes \
109
+ nuitka --standalone --onefile \
110
110
  --include-package=accli \
111
- --output-dir=build \
112
- -m accli.cli:app
111
+ --include-module=accli \
112
+ --no-prefer-source-code \
113
+ --nofollow-import-to=inspect,token,tokenize,linecache \
114
+ accli/cli.py
113
115
  ```
@@ -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 = "v1.0.0"
3
+ VERSION = "v1.0.2"
@@ -9,6 +9,7 @@ import warnings
9
9
  import importlib.util
10
10
  from rich import print
11
11
  from typing_extensions import Annotated
12
+ from contextlib import contextmanager
12
13
 
13
14
  from accli.token import save_token_details, get_token, get_server_url, set_github_app_token, set_project_slug
14
15
 
@@ -40,6 +41,17 @@ def get_size(path):
40
41
  return size
41
42
 
42
43
 
44
+ @contextmanager
45
+ def pushd(new_dir):
46
+ """Temporarily change the working directory."""
47
+ prev_dir = os.getcwd()
48
+ os.chdir(new_dir)
49
+ try:
50
+ yield
51
+ finally:
52
+ os.chdir(prev_dir)
53
+
54
+
43
55
  @app.command()
44
56
  def about():
45
57
  print("[bold cyan]This is a terminal client for Accelerator hosted on https://accelerator.iiasa.ac.at . [/bold cyan]\n")
@@ -181,7 +193,6 @@ def validate(
181
193
  def dispatch(
182
194
  project_slug: Annotated[str, typer.Argument(help="Unique Accelerator project slug.")],
183
195
  root_task_variable: Annotated[str, typer.Argument(help="Root task variable in workflow_file.")],
184
- server: Annotated[str, typer.Option(..., '-s', help="Accelerator server url.")] = "https://accelerator.iiasa.ac.at",
185
196
  workflow_filename: Annotated[str, typer.Option(..., '-f', help="Python workflow filepath.")] = "wkube.py"
186
197
  ):
187
198
  set_project_slug(project_slug)
@@ -194,32 +205,35 @@ def dispatch(
194
205
  verify_cert=(not ACCLI_DEBUG)
195
206
  )
196
207
 
197
- base_dir = os.getcwd()
198
-
199
- if base_dir.endswith('/'):
200
- workflow_filepath = f"{base_dir}{workflow_filename}"
208
+ # ✅ Resolve the workflow file path properly
209
+ if os.path.isabs(workflow_filename):
210
+ workflow_filepath = workflow_filename
201
211
  else:
202
- workflow_filepath = f"{base_dir}/{workflow_filename}"
212
+ workflow_filepath = os.path.abspath(os.path.join(os.getcwd(), workflow_filename))
203
213
 
204
- spec = importlib.util.spec_from_file_location("workflow", workflow_filepath)
214
+ if not os.path.isfile(workflow_filepath):
215
+ raise FileNotFoundError(f"Workflow file not found: {workflow_filepath}")
205
216
 
206
- module = importlib.util.module_from_spec(spec)
217
+ workflow_dir = os.path.dirname(workflow_filepath)
207
218
 
208
- spec.loader.exec_module(module)
219
+ # ✅ Temporarily switch to the workflow file's directory
220
+ with pushd(workflow_dir):
221
+ # ✅ Import the module dynamically
222
+ spec = importlib.util.spec_from_file_location("workflow", workflow_filepath)
223
+ module = importlib.util.module_from_spec(spec)
224
+ spec.loader.exec_module(module)
209
225
 
210
- job_to_dispatch = getattr(module, root_task_variable)
226
+ job_to_dispatch = getattr(module, root_task_variable, None)
211
227
 
228
+ if not job_to_dispatch:
229
+ raise ValueError(f"No root task variable found with name '{root_task_variable}' in {workflow_filepath}")
212
230
 
213
- if not job_to_dispatch:
214
- raise ValueError(f"No root task variable found with name {root_task_variable}")
215
-
216
- print(job_to_dispatch.description)
217
-
231
+ print(job_to_dispatch.description)
218
232
 
219
- root_job_id = term_cli_project_service.dispatch(
220
- project_slug,
221
- job_to_dispatch.description
222
- )
233
+ root_job_id = term_cli_project_service.dispatch(
234
+ project_slug,
235
+ job_to_dispatch.description
236
+ )
223
237
 
224
238
  print(f"Dispatched root job #ID: {root_job_id}")
225
239
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: accli
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -32,6 +32,13 @@ Classifier: Operating System :: OS Independent
32
32
  Requires-Python: >=3.7
33
33
  Description-Content-Type: text/markdown
34
34
  License-File: LICENSE
35
+ Requires-Dist: urllib3>=1.26.5
36
+ Requires-Dist: typer[all]>=0.4.0
37
+ Requires-Dist: tinydb>=4.5.2
38
+ Requires-Dist: requests>=2.25.1
39
+ Requires-Dist: jsonschema>=4.5.1
40
+ Requires-Dist: pydantic>=2.0
41
+ Dynamic: license-file
35
42
 
36
43
 
37
44
  # Accelerator Terminal Client and Python API
@@ -141,8 +148,10 @@ Follow the official Python packaging tutorial:
141
148
  Consider bundling with Nuitka:
142
149
 
143
150
  ```bash
144
- nuitka --standalone --onefile --static-libpython=yes \
151
+ nuitka --standalone --onefile \
145
152
  --include-package=accli \
146
- --output-dir=build \
147
- -m accli.cli:app
153
+ --include-module=accli \
154
+ --no-prefer-source-code \
155
+ --nofollow-import-to=inspect,token,tokenize,linecache \
156
+ accli/cli.py
148
157
  ```
@@ -4,4 +4,3 @@ tinydb>=4.5.2
4
4
  requests>=2.25.1
5
5
  jsonschema>=4.5.1
6
6
  pydantic>=2.0
7
- gitpython>=3.1.30
@@ -19,7 +19,6 @@ dependencies = [
19
19
  "requests>=2.25.1", # Commonly supported baseline
20
20
  "jsonschema>=4.5.1", # 4.5.1+ is safe across libraries
21
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
22
  ]
24
23
  classifiers = [
25
24
  "Programming Language :: Python :: 3",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes