From 07d0a3fb79c84eac4b3b60732b072f1b6d39df6c Mon Sep 17 00:00:00 2001 From: Pavankumar Videm Date: Fri, 3 Oct 2025 17:15:06 +0200 Subject: [PATCH 1/6] Add option to enable GxITs in planemo serve --- planemo/galaxy/config.py | 45 ++++++++++++++++++++++++++-------------- planemo/options.py | 11 ++++++++++ 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/planemo/galaxy/config.py b/planemo/galaxy/config.py index fc4fdb919..b57923f6e 100644 --- a/planemo/galaxy/config.py +++ b/planemo/galaxy/config.py @@ -429,6 +429,16 @@ def config_join(*args): properties["database_connection"] = _database_connection(database_location, **kwds) if kwds.get("mulled_containers", False): properties["mulled_channels"] = kwds.get("conda_ensure_channels", "") + if kwds.get("enable_gxits", True): + properties.update( + dict( + interactivetools_enable="True", + interactivetools_map="database/interactivetools_map.sqlite", + galaxy_infrastructure_url= "http://localhost:8080", + interactivetools_upstream_proxy= "False", + interactivetools_proxy_host="localhost:4002", + ) + ) _handle_kwd_overrides(properties, kwds) @@ -492,23 +502,26 @@ def write_galaxy_config(galaxy_root, properties, env, kwds, template_args, confi env["GRAVITY_STATE_DIR"] = config_join("gravity") with NamedTemporaryFile(suffix=".sock", delete=True) as nt: env["SUPERVISORD_SOCKET"] = nt.name + config = { + "galaxy": properties, + "gravity": { + "galaxy_root": galaxy_root, + "gunicorn": { + "bind": f"{kwds.get('host', 'localhost')}:{template_args['port']}", + "preload": False, + }, + "gx_it_proxy": { + "enable": False, + }, + }, + } + if kwds.get("enable_gxits", True): + config["gravity"]["gx_it_proxy"].update({ + "enable": True, + "port": "4002", + }) write_file( - env["GALAXY_CONFIG_FILE"], - json.dumps( - { - "galaxy": properties, - "gravity": { - "galaxy_root": galaxy_root, - "gunicorn": { - "bind": f"{kwds.get('host', 'localhost')}:{template_args['port']}", - "preload": False, - }, - "gx_it_proxy": { - "enable": False, - }, - }, - } - ), + env["GALAXY_CONFIG_FILE"], json.dumps(config) ) diff --git a/planemo/options.py b/planemo/options.py index 620b0a782..0dc4be514 100644 --- a/planemo/options.py +++ b/planemo/options.py @@ -1429,6 +1429,7 @@ def galaxy_serve_options(): install_prebuilt_client_option(), skip_client_build_option(), shed_install_option(), + enable_interactive_tools(), ) @@ -2261,3 +2262,13 @@ def job_config_init_options(): runner_target_option(), galaxy_version_option(), ) + +def enable_interactive_tools(): + return planemo_option( + "--enable_gxits", + is_flag=True, + default=False, + help=( + "Configure Galaxy to enable interactive tools." + ), + ) \ No newline at end of file From aa50fb74109069d91c7a03623fc6a5fc6bc0b23d Mon Sep 17 00:00:00 2001 From: Pavankumar Videm Date: Fri, 3 Oct 2025 17:20:12 +0200 Subject: [PATCH 2/6] remove spaces around equals --- planemo/galaxy/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/planemo/galaxy/config.py b/planemo/galaxy/config.py index b57923f6e..478e4b4a7 100644 --- a/planemo/galaxy/config.py +++ b/planemo/galaxy/config.py @@ -434,8 +434,8 @@ def config_join(*args): dict( interactivetools_enable="True", interactivetools_map="database/interactivetools_map.sqlite", - galaxy_infrastructure_url= "http://localhost:8080", - interactivetools_upstream_proxy= "False", + galaxy_infrastructure_url="http://localhost:8080", + interactivetools_upstream_proxy="False", interactivetools_proxy_host="localhost:4002", ) ) From e6130887b9707e3225436ae8a692eae034d71d04 Mon Sep 17 00:00:00 2001 From: Pavankumar Videm Date: Tue, 14 Oct 2025 09:28:39 +0200 Subject: [PATCH 3/6] fix linting --- planemo/options.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/planemo/options.py b/planemo/options.py index 0dc4be514..2eb88ba81 100644 --- a/planemo/options.py +++ b/planemo/options.py @@ -2263,6 +2263,7 @@ def job_config_init_options(): galaxy_version_option(), ) + def enable_interactive_tools(): return planemo_option( "--enable_gxits", @@ -2271,4 +2272,4 @@ def enable_interactive_tools(): help=( "Configure Galaxy to enable interactive tools." ), - ) \ No newline at end of file + ) From 99b8788dee23e938d9190f8e0b33982e7b7cdca4 Mon Sep 17 00:00:00 2001 From: Pavankumar Videm Date: Mon, 20 Oct 2025 16:10:38 +0200 Subject: [PATCH 4/6] bind a free random port for gxit and enable GxITs by default --- planemo/galaxy/config.py | 38 +++++++++++++++++++++++++++----------- planemo/options.py | 8 ++++---- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/planemo/galaxy/config.py b/planemo/galaxy/config.py index 478e4b4a7..54bfdee6f 100644 --- a/planemo/galaxy/config.py +++ b/planemo/galaxy/config.py @@ -36,6 +36,7 @@ from packaging.version import parse as parse_version from planemo import git +from planemo import network_util from planemo.config import OptionSource from planemo.database import postgres_singularity from planemo.deps import ensure_dependency_resolvers_conf_configured @@ -429,14 +430,30 @@ def config_join(*args): properties["database_connection"] = _database_connection(database_location, **kwds) if kwds.get("mulled_containers", False): properties["mulled_channels"] = kwds.get("conda_ensure_channels", "") - if kwds.get("enable_gxits", True): + + # Enable GxITs by default + gx_it_port = network_util.get_free_port() + properties.update( + dict( + interactivetools_enable="true", + galaxy_infrastructure_url=f"http://localhost:{port}", + interactivetools_upstream_proxy="false", + interactivetools_proxy_host=f"localhost:{gx_it_port}", + ) + ) + gx_it_config = dict( + enable="true", + port=gx_it_port, + ) + if kwds.get("disable_gxits", True): properties.update( dict( - interactivetools_enable="True", - interactivetools_map="database/interactivetools_map.sqlite", - galaxy_infrastructure_url="http://localhost:8080", - interactivetools_upstream_proxy="False", - interactivetools_proxy_host="localhost:4002", + interactivetools_enable="false", + ) + ) + gx_it_config.update( + dict( + enable="false", ) ) @@ -462,6 +479,7 @@ def config_join(*args): write_galaxy_config( galaxy_root=galaxy_root, properties=properties, + gx_it_config=gx_it_config, env=env, kwds=kwds, template_args=template_args, @@ -491,7 +509,7 @@ def config_join(*args): ) -def write_galaxy_config(galaxy_root, properties, env, kwds, template_args, config_join): +def write_galaxy_config(galaxy_root, properties, gx_it_config, env, kwds, template_args, config_join): if get_galaxy_major_version(galaxy_root) < parse_version("22.01"): # Legacy .ini setup env["GALAXY_CONFIG_FILE"] = config_join("galaxy.ini") @@ -508,11 +526,9 @@ def write_galaxy_config(galaxy_root, properties, env, kwds, template_args, confi "galaxy_root": galaxy_root, "gunicorn": { "bind": f"{kwds.get('host', 'localhost')}:{template_args['port']}", - "preload": False, - }, - "gx_it_proxy": { - "enable": False, + "preload": "false", }, + "gx_it_proxy": gx_it_config, }, } if kwds.get("enable_gxits", True): diff --git a/planemo/options.py b/planemo/options.py index 2eb88ba81..6d3d4681d 100644 --- a/planemo/options.py +++ b/planemo/options.py @@ -1429,7 +1429,7 @@ def galaxy_serve_options(): install_prebuilt_client_option(), skip_client_build_option(), shed_install_option(), - enable_interactive_tools(), + disable_interactive_tools(), ) @@ -2264,12 +2264,12 @@ def job_config_init_options(): ) -def enable_interactive_tools(): +def disable_interactive_tools(): return planemo_option( - "--enable_gxits", + "--disable_gxits", is_flag=True, default=False, help=( - "Configure Galaxy to enable interactive tools." + "Configure Galaxy to disable interactive tools." ), ) From 769e7144c7bf710b228231eba78569f278f0f100 Mon Sep 17 00:00:00 2001 From: Pavankumar Videm Date: Mon, 20 Oct 2025 17:29:12 +0200 Subject: [PATCH 5/6] move the code to write_galaxy_config function --- planemo/galaxy/config.py | 53 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/planemo/galaxy/config.py b/planemo/galaxy/config.py index 54bfdee6f..f78e85813 100644 --- a/planemo/galaxy/config.py +++ b/planemo/galaxy/config.py @@ -431,31 +431,6 @@ def config_join(*args): if kwds.get("mulled_containers", False): properties["mulled_channels"] = kwds.get("conda_ensure_channels", "") - # Enable GxITs by default - gx_it_port = network_util.get_free_port() - properties.update( - dict( - interactivetools_enable="true", - galaxy_infrastructure_url=f"http://localhost:{port}", - interactivetools_upstream_proxy="false", - interactivetools_proxy_host=f"localhost:{gx_it_port}", - ) - ) - gx_it_config = dict( - enable="true", - port=gx_it_port, - ) - if kwds.get("disable_gxits", True): - properties.update( - dict( - interactivetools_enable="false", - ) - ) - gx_it_config.update( - dict( - enable="false", - ) - ) _handle_kwd_overrides(properties, kwds) @@ -479,7 +454,6 @@ def config_join(*args): write_galaxy_config( galaxy_root=galaxy_root, properties=properties, - gx_it_config=gx_it_config, env=env, kwds=kwds, template_args=template_args, @@ -509,7 +483,7 @@ def config_join(*args): ) -def write_galaxy_config(galaxy_root, properties, gx_it_config, env, kwds, template_args, config_join): +def write_galaxy_config(galaxy_root, properties, env, kwds, template_args, config_join): if get_galaxy_major_version(galaxy_root) < parse_version("22.01"): # Legacy .ini setup env["GALAXY_CONFIG_FILE"] = config_join("galaxy.ini") @@ -520,6 +494,31 @@ def write_galaxy_config(galaxy_root, properties, gx_it_config, env, kwds, templa env["GRAVITY_STATE_DIR"] = config_join("gravity") with NamedTemporaryFile(suffix=".sock", delete=True) as nt: env["SUPERVISORD_SOCKET"] = nt.name + # Enable GxITs by default + gx_it_port = network_util.get_free_port() + properties.update( + dict( + interactivetools_enable="true", + galaxy_infrastructure_url=f"http://localhost:{template_args['port']}", + interactivetools_upstream_proxy="false", + interactivetools_proxy_host=f"localhost:{gx_it_port}", + ) + ) + gx_it_config = dict( + enable="true", + port=gx_it_port, + ) + if kwds.get("disable_gxits", True): + properties.update( + dict( + interactivetools_enable="false", + ) + ) + gx_it_config.update( + dict( + enable="false", + ) + ) config = { "galaxy": properties, "gravity": { From 11117c989fb6d131ce601558b666aabda1837333 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Wed, 14 Jan 2026 17:47:31 +0100 Subject: [PATCH 6/6] Fix up linting --- planemo/galaxy/config.py | 21 +++++++++++---------- planemo/options.py | 4 +--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/planemo/galaxy/config.py b/planemo/galaxy/config.py index f78e85813..3036b4e2f 100644 --- a/planemo/galaxy/config.py +++ b/planemo/galaxy/config.py @@ -35,8 +35,10 @@ ) from packaging.version import parse as parse_version -from planemo import git -from planemo import network_util +from planemo import ( + git, + network_util, +) from planemo.config import OptionSource from planemo.database import postgres_singularity from planemo.deps import ensure_dependency_resolvers_conf_configured @@ -431,7 +433,6 @@ def config_join(*args): if kwds.get("mulled_containers", False): properties["mulled_channels"] = kwds.get("conda_ensure_channels", "") - _handle_kwd_overrides(properties, kwds) # TODO: consider following property @@ -531,13 +532,13 @@ def write_galaxy_config(galaxy_root, properties, env, kwds, template_args, confi }, } if kwds.get("enable_gxits", True): - config["gravity"]["gx_it_proxy"].update({ - "enable": True, - "port": "4002", - }) - write_file( - env["GALAXY_CONFIG_FILE"], json.dumps(config) - ) + config["gravity"]["gx_it_proxy"].update( + { + "enable": True, + "port": "4002", + } + ) + write_file(env["GALAXY_CONFIG_FILE"], json.dumps(config)) def _expand_paths(galaxy_root: Optional[str], extra_tools: List[str]) -> List[str]: diff --git a/planemo/options.py b/planemo/options.py index 6d3d4681d..b3a008792 100644 --- a/planemo/options.py +++ b/planemo/options.py @@ -2269,7 +2269,5 @@ def disable_interactive_tools(): "--disable_gxits", is_flag=True, default=False, - help=( - "Configure Galaxy to disable interactive tools." - ), + help=("Configure Galaxy to disable interactive tools."), )