From 67e0180b668e5e13c7549d36e0fac0086a66d7b7 Mon Sep 17 00:00:00 2001 From: Akshad Sonawane Date: Sat, 21 Mar 2026 21:07:26 +0000 Subject: [PATCH 1/2] utils: migrate set_target_region to Tools API --- python/grass/jupyter/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/grass/jupyter/utils.py b/python/grass/jupyter/utils.py index 95d4a0ce4d5..3c039a4c208 100644 --- a/python/grass/jupyter/utils.py +++ b/python/grass/jupyter/utils.py @@ -357,15 +357,14 @@ def set_target_region(src_env, tgt_env): to_proj = get_location_proj_string(env=tgt_env) new_region = reproject_region(region, from_proj, to_proj) # Set region to match original region extent - gs.run_command( - "g.region", + tools = Tools(env=tgt_env) + tools.g_region( n=new_region["north"], s=new_region["south"], e=new_region["east"], w=new_region["west"], rows=new_region["rows"], cols=new_region["cols"], - env=tgt_env, ) From 566723831dde82ed1cac74316e57350fc54bc222 Mon Sep 17 00:00:00 2001 From: Akshad Sonawane Date: Fri, 27 Mar 2026 19:47:29 +0000 Subject: [PATCH 2/2] tests: add basic sanity test for set_target_region --- python/grass/jupyter/tests/test_utils.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 python/grass/jupyter/tests/test_utils.py diff --git a/python/grass/jupyter/tests/test_utils.py b/python/grass/jupyter/tests/test_utils.py new file mode 100644 index 00000000000..661a803d641 --- /dev/null +++ b/python/grass/jupyter/tests/test_utils.py @@ -0,0 +1,5 @@ +def test_set_target_region_exists(): + """Basic sanity test to ensure function is callable.""" + from grass.jupyter.utils import set_target_region + + assert callable(set_target_region)