Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
d905882
grass.experimental: Add object to access modules as functions
wenzeslaus Apr 18, 2023
aaef183
Support verbosity, overwrite and region freezing
wenzeslaus Apr 21, 2023
54db575
Raise exception instead of calling handle_errors
wenzeslaus Apr 22, 2023
82f5894
Allow to specify stdin and use a new instance of Tools itself to exec…
wenzeslaus Apr 22, 2023
0f1e210
Add ignore errors, r_mapcalc example, draft tests
wenzeslaus Apr 22, 2023
f4e3fed
Add test for exceptions
wenzeslaus Apr 24, 2023
04087e8
Add tests and Makefile
wenzeslaus May 4, 2023
6ab8e40
Convert values to ints and floats in keyval
wenzeslaus May 4, 2023
744cfac
Do not overwrite by default to follow default behavior in GRASS GIS
wenzeslaus May 4, 2023
24c27e6
Add doc, remove old code and todos
wenzeslaus Jun 3, 2023
ff187a6
Add to top Makefile
wenzeslaus Jun 3, 2023
22773c8
Add docs for tests
wenzeslaus Jun 3, 2023
2911065
Allow test to fail because of the missing seed parameter (so results …
wenzeslaus Jun 4, 2023
3ac46c3
Merge branch 'main' into add-session-tools-object
echoix Nov 11, 2024
bd3667b
Lock with both timeout and max number of tries
wenzeslaus Mar 24, 2025
2a7439f
Timeout in CLI, sleep times as increased initial sleep time, removing…
wenzeslaus Mar 24, 2025
f754f59
Actually measure the elapsed time in addition to counting. While coun…
wenzeslaus Mar 24, 2025
7b0f1d5
Add CLI for direct lock-unlock procedure
wenzeslaus Mar 24, 2025
a1203fa
Doc timeout
wenzeslaus Mar 24, 2025
cb02a58
Create a function to unlock a mapset
wenzeslaus Mar 24, 2025
3e748e4
Add opt-in lock-unlock to the init function in Python
wenzeslaus Mar 24, 2025
fd1e285
Add env to locking functions
wenzeslaus Mar 25, 2025
34ee30b
Add force unlock to Python API
wenzeslaus Mar 25, 2025
35c1ea2
Add tests for Python API
wenzeslaus Mar 25, 2025
c542bf4
Messages which work in CLI and Python with focus on the mapset and go…
wenzeslaus Mar 25, 2025
d1ccdcb
Add Python doc
wenzeslaus Mar 25, 2025
782f7d0
Doc for CLI
wenzeslaus Mar 25, 2025
34b127b
Disable lock test on Windows if they require actual lock to succeed.
wenzeslaus Mar 25, 2025
0a2887f
Use minimal __main__.py without the __name__ check according to Pytho…
wenzeslaus Apr 23, 2025
bf761ca
Add Tools from add-session-tools-object
wenzeslaus Apr 23, 2025
e7e248b
grass.script: Reveal the failed type passed to decode
wenzeslaus Apr 23, 2025
42353aa
grass.script: Add separate function to sort through run_command style…
wenzeslaus Apr 23, 2025
b568813
Allow for optional output capture (error handling and printing still …
wenzeslaus Apr 23, 2025
b047ac0
Pass return value
wenzeslaus Apr 23, 2025
f5305ac
grass.experimental: StandaloneTools API which uses r.pack as input/ou…
wenzeslaus Apr 23, 2025
437d46e
Allow for optional output capture (error handling and printing still …
wenzeslaus Apr 23, 2025
2b5b1b7
Pass return value
wenzeslaus Apr 23, 2025
cb8f483
Merge branch 'main' into add-session-tools-object
wenzeslaus Apr 23, 2025
ddad2e0
Allow for testing by having a list of arguments as a parameter. Also …
wenzeslaus Apr 24, 2025
a958142
Merge remote-tracking branch 'upstream/main' into add-session-tools-o…
wenzeslaus Apr 25, 2025
61972d4
Access JSON as dict directly without an attribute using getitem. Sugg…
wenzeslaus Apr 25, 2025
c86d8ff
Fix whitespace and regexp
wenzeslaus Apr 25, 2025
3b995c9
Represent not captured stdout as None, not empty string.
wenzeslaus Apr 25, 2025
14b6a05
Merge upstream updates of locking and CLI
wenzeslaus Apr 29, 2025
70c29ed
Use tools not modules in the new example
wenzeslaus Apr 29, 2025
4e068ba
Merge lock-with-wait-and-timeout to get the latest CLI
wenzeslaus Apr 29, 2025
d8c354d
Merge remote-tracking branch 'upstream/main' into add-session-tools-o…
wenzeslaus Apr 29, 2025
4cc5a32
Add run subcommand to have a CLI use case for the tools. It runs one …
wenzeslaus Apr 29, 2025
459b2ad
Update function name
wenzeslaus Apr 30, 2025
513c9f8
Add prototype code for numpy support
wenzeslaus Jun 2, 2025
24ef6b9
Merge main branch
wenzeslaus Jun 2, 2025
300ecab
Merge numpy API protortype from tools branch
wenzeslaus Jun 2, 2025
fc2d686
Add prototype of .pack reader, prefix-shortcut syntax, handle errors …
wenzeslaus Jun 2, 2025
cca1a37
Try to suggest better function call rather than raising JSON decode e…
wenzeslaus Jun 3, 2025
98718d6
Support multiple NumPy arrays as input and output
wenzeslaus Jun 3, 2025
a873696
Refactor pack and object handling from Tools, use pack handler in Sta…
wenzeslaus Jun 3, 2025
dfd687a
Support pack files and NumPy accross interfaces (both classes, all th…
wenzeslaus Jun 3, 2025
23c143e
Handle access to tools as methods (bound functions) in a separate obj…
wenzeslaus Jun 9, 2025
9653cf0
Avoid using run_command for more control over the exceptions, provide…
wenzeslaus Jun 9, 2025
6e107fa
Initial code for auto-region from numpy
wenzeslaus Jun 9, 2025
faed523
Update r.univar JSON output indexing
wenzeslaus Jun 9, 2025
f689ed9
Allow for region to be set and kept by user
wenzeslaus Jun 9, 2025
122a56d
Add the .grr extension
wenzeslaus Jun 9, 2025
e94c1f2
Add tests for numpy and pack workflows
wenzeslaus Jun 9, 2025
1fe17d8
Merge remote-tracking branch 'upstream/main' into cli-with-pack
wenzeslaus Jun 9, 2025
4a1e374
Make the special features standalone objects used by composition
wenzeslaus Jun 11, 2025
651df11
Merge remote-tracking branch 'upstream/main' into add-session-tools-o…
wenzeslaus Jun 11, 2025
ce7c53e
Remove NumPy
wenzeslaus Jun 11, 2025
bd12384
More robust version of getting the parsed CLI from --json
wenzeslaus Jul 2, 2025
4958982
Merge code-wise with main
wenzeslaus Sep 2, 2025
52b29d8
Make the code functional again and align with the grass.tools code. C…
wenzeslaus Sep 2, 2025
0b3f412
Remove rasters which are copies of pack files
wenzeslaus Sep 3, 2025
bd5c6f6
Clean up the tmp files, further sync with grass.tools
wenzeslaus Sep 3, 2025
4d14a47
Merge remote-tracking branch 'upstream/main' into add-pack-files-io-t…
wenzeslaus Sep 3, 2025
faf96a1
Use g.list with JSON in tests
wenzeslaus Sep 3, 2025
1c0bc05
Merge remote-tracking branch 'upstream/main' into add-pack-files-io-t…
wenzeslaus Sep 10, 2025
fc48944
Start the import-export machinery only when there are files in the pa…
wenzeslaus Sep 10, 2025
998255f
Integrate pack code into grass.tools
wenzeslaus Sep 10, 2025
353152d
Move code out of the Tools class, clean up code around ImporterExport…
wenzeslaus Sep 10, 2025
fa1c2a3
Merge remote-tracking branch 'upstream/main' into add-pack-files-io-t…
wenzeslaus Sep 10, 2025
fcbf52f
Doc for tests
wenzeslaus Sep 10, 2025
2eaba0e
Use tmp_path for files in tests. Test supported path representations.
wenzeslaus Sep 10, 2025
b162e39
Remove last piece of grass.experimental.tools from CLI
wenzeslaus Sep 10, 2025
821a1b9
Merge main branch code-wise
wenzeslaus Sep 10, 2025
a148d08
Update the names (but code does not run)
wenzeslaus Sep 10, 2025
adf447f
Integrate pack IO code
wenzeslaus Sep 10, 2025
11006e8
Add full env and session handling
wenzeslaus Sep 11, 2025
cb801c2
Merge remote-tracking branch 'upstream/main' into cli-with-pack
wenzeslaus Sep 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions python/grass/app/tests/grass_app_cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,21 @@ def test_subcommand_run_tool_regular_run():
def test_subcommand_run_tool_failure_run():
"""Check that a tool produces non-zero return code"""
assert main(["run", "g.region", "raster=does_not_exist"]) == 1


def test_subcommand_run_tool_pack(rows_raster_file3x2, tmp_path):
"""Check that a tool accepts and produces a raster pack file"""
output = tmp_path / "output.grass_raster"
assert (
main(
[
"run",
"r.mapcalc.simple",
"expression=2 * A",
f"a={rows_raster_file3x2}",
f"output={output}",
]
)
== 0
)
assert output.exists()
46 changes: 46 additions & 0 deletions python/grass/experimental/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ def xy_session_for_module(tmp_path_factory):
yield session


@pytest.fixture
def xy_dataset_session(tmp_path):
"""Creates a session with a mapset which has vector with a float column"""
gs.core._create_location_xy(tmp_path, "test") # pylint: disable=protected-access
with gs.setup.init(tmp_path / "test") as session:
yield session


@pytest.fixture
def unique_id():
"""A unique alphanumeric identifier"""
Expand Down Expand Up @@ -69,3 +77,41 @@ def xy_mapset_non_permament(xy_session): # pylint: disable=redefined-outer-name
"test1", create=True, env=xy_session.env
) as session:
yield session


@pytest.fixture
def rows_raster_file3x3(tmp_path):
project = tmp_path / "xy_test3x3"
gs.create_project(project)
with gs.setup.init(project, env=os.environ.copy()) as session:
gs.run_command("g.region", rows=3, cols=3, env=session.env)
gs.mapcalc("rows = row()", env=session.env)
output_file = tmp_path / "rows3x3.grass_raster"
gs.run_command(
"r.pack",
input="rows",
output=output_file,
flags="c",
superquiet=True,
env=session.env,
)
return output_file


@pytest.fixture
def rows_raster_file4x5(tmp_path):
project = tmp_path / "xy_test4x5"
gs.create_project(project)
with gs.setup.init(project, env=os.environ.copy()) as session:
gs.run_command("g.region", rows=4, cols=5, env=session.env)
gs.mapcalc("rows = row()", env=session.env)
output_file = tmp_path / "rows4x5.grass_raster"
gs.run_command(
"r.pack",
input="rows",
output=output_file,
flags="c",
superquiet=True,
env=session.env,
)
return output_file
Loading
Loading