You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2025/03/03 18:59:37 UTC

(airavata) 01/06: fix bugs in airavata-jupyter-magic package

This is an automated email from the ASF dual-hosted git repository.

lahirujayathilake pushed a commit to branch cybershuttle-dev
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 5ab0aaff6a748c3cd7b421b5e40013aef3a52504
Author: yasith <ya...@icloud.com>
AuthorDate: Wed Feb 26 20:00:00 2025 -0600

    fix bugs in airavata-jupyter-magic package
---
 .../airavata-jupyter-magic/airavata_magics.py      | 28 ++++++++++++++--------
 .../airavata-jupyter-magic/pyproject.toml          | 11 +++++----
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/modules/agent-framework/airavata-jupyter-magic/airavata_magics.py b/modules/agent-framework/airavata-jupyter-magic/airavata_magics.py
index d55b531e9c..c787a847d0 100644
--- a/modules/agent-framework/airavata-jupyter-magic/airavata_magics.py
+++ b/modules/agent-framework/airavata-jupyter-magic/airavata_magics.py
@@ -1,16 +1,22 @@
 import base64
 import binascii
 import json
+import os
 import time
 from pathlib import Path
 from typing import NamedTuple
+
 import jwt
-import os
 import requests
+from device_auth import DeviceFlowAuthenticator
+from IPython.core.getipython import get_ipython
 from IPython.core.magic import register_cell_magic, register_line_magic
 from IPython.display import HTML, Image, display
-from device_auth import DeviceFlowAuthenticator
 
+# autorun when imported
+ipython = get_ipython()
+if ipython is None:
+    raise RuntimeError("airavata_magics requires an interactive ipython session")
 
 AgentInfo = NamedTuple('AgentInfo', [
     ('agentId', str),
@@ -393,11 +399,13 @@ def pull_remote(line):
         file.write(response.content)
     print(f"[{response.status_code}] Downloaded remote:{remot_path} to local:{local_path}")
 
-# autorun when imported
-ipython.register_magic_function(cs_login)
-ipython.register_magic_function(init_remote)
-ipython.register_magic_function(status_remote)
-ipython.register_magic_function(terminate_remote)
-ipython.register_magic_function(run_remote)
-ipython.register_magic_function(push_remote)
-ipython.register_magic_function(pull_remote)
+print(r"""
+Loaded airavata magics:
+  %cs_login
+  %init_remote
+  %%run_remote
+  %status_remote
+  %terminate_remote
+  %push_remote
+  %pull_remote
+""")
diff --git a/modules/agent-framework/airavata-jupyter-magic/pyproject.toml b/modules/agent-framework/airavata-jupyter-magic/pyproject.toml
index 08e967aad3..29e184c20d 100644
--- a/modules/agent-framework/airavata-jupyter-magic/pyproject.toml
+++ b/modules/agent-framework/airavata-jupyter-magic/pyproject.toml
@@ -4,10 +4,12 @@ build-backend = "setuptools.build_meta"
 
 [project]
 name = "airavata-jupyter-magic"
-version = "0.1.0"
+version = "1.0.3"
 description = "Jupyter magics for running notebook cells on remote HPC resources. Powered by Apache Airavata."
 authors = [
-    { name = "Your Name", email = "your.email@example.com" }
+    { name = "Yasith Jayawardana", email = "yasith@gatech.edu" },
+    { name = "Dimuthu Wannipurage", email = "dimuthuw@gatech.edu" },
+    { name = "Lahiru Jayathilake", email = "ljayathilake3@gatech.edu" }
 ]
 license = { text = "Apache-2.0" }
 readme = "README.md"
@@ -20,9 +22,8 @@ dependencies = [
 [project.optional-dependencies]
 dev = ["black", "flake8"]
 
-[tool.setuptools.packages.find]
-where = ["."]
-include = ["*.py"]
+[tool.setuptools]
+py-modules = ["airavata_magics", "device_auth"]
 
 [project.urls]
 Homepage = "https://github.com/apache/airavata"