diff --git a/.gitignore b/.gitignore index 14edd43..528b7b9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,4 @@ dist/* */*.pyc .idea/ */__pycache__/* -*.pyc -*.pyc +*.ipynb diff --git a/pygeoweaver/__main__.py b/pygeoweaver/__main__.py index f9dc7db..3cab4d5 100644 --- a/pygeoweaver/__main__.py +++ b/pygeoweaver/__main__.py @@ -4,11 +4,11 @@ """ from pygeoweaver import detail_host, detail_process, detail_workflow, export_workflow, \ show_history, import_workflow, list_hosts, list_processes, list_workflows, \ - start, stop, reset_password, run_process, run_worklfow + start, stop, reset_password, run_process, run_worklfow, helpwith, ui def main(): # start geoweaver - start() + # start() # stop geoweaver # stop() # list resources @@ -37,6 +37,8 @@ def main(): # reset localhost password for Geoweaver # reset_password() + ui() + helpwith() if __name__ == "__main__": diff --git a/pygeoweaver/sc_help.py b/pygeoweaver/sc_help.py new file mode 100644 index 0000000..7ad58d0 --- /dev/null +++ b/pygeoweaver/sc_help.py @@ -0,0 +1,16 @@ + + +import subprocess +from pygeoweaver.utils import get_geoweaver_jar_path, get_root_dir + + +def helpwith(command_list: list=[], ): + target_cmd_args = ["java", "-jar", get_geoweaver_jar_path()] + if len(command_list) > 0: + for i in range(len(command_list)-1): + target_cmd_args.append(command_list[i]) + target_cmd_args.append("help") + target_cmd_args.append(command_list[-1]) + else: + target_cmd_args.append("help") + subprocess.run(target_cmd_args, cwd=f"{get_root_dir()}/") \ No newline at end of file diff --git a/pygeoweaver/sc_interface.py b/pygeoweaver/sc_interface.py index b9032c5..0c3758a 100644 --- a/pygeoweaver/sc_interface.py +++ b/pygeoweaver/sc_interface.py @@ -10,3 +10,5 @@ from pygeoweaver.sc_run import * from pygeoweaver.server import * from pygeoweaver.sc_resetpassword import * +from pygeoweaver.sc_help import * +from pygeoweaver.utils import ui diff --git a/pygeoweaver/utils.py b/pygeoweaver/utils.py index 1a0d323..a8f4877 100644 --- a/pygeoweaver/utils.py +++ b/pygeoweaver/utils.py @@ -3,6 +3,19 @@ import requests import platform +from IPython import get_ipython +from IPython.display import IFrame + + +def ui(): + download_geoweaver_jar() # check if geoweaver is initialized + shell_type = str(get_ipython().__class__.__module__) + if shell_type == "google.colab._shell" or shell_type == "ipykernel.zmqshell": + return IFrame(src="http://localhost:8070/Geoweaver/", width='100%', height='500px') + else: + print('Web UI for python bindings can be only used for Colab / Jupyter / Interactive Python shell') + + def get_home_dir(): return os.path.expanduser('~') @@ -28,6 +41,7 @@ def download_geoweaver_jar(overwrite=False): subprocess.run(["chmod", "+x", get_geoweaver_jar_path()], cwd=f"{get_root_dir()}/") return + print("Downloading latest version of Geoweaver...") geoweaver_url = "https://github.com/ESIPFed/Geoweaver/releases/download/latest/geoweaver.jar" r = requests.get(geoweaver_url) @@ -47,4 +61,4 @@ def checkOS(): elif platform.system() == "Darwin": return 2 elif platform == "Windows": - return 3 \ No newline at end of file + return 3 diff --git a/pyproject.toml b/pyproject.toml index 81ebbed..36d2aeb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pygeoweaver" -version = "0.6.4" +version = "0.6.5" authors = [ { name="Geoweaver team", email="geoweaver.app@gmail.com" }, ]