[GRASS-git] [OSGeo/grass] b6c0c3: grass.tools: Use Tools in v.dissolve (#6148)

Vaclav Petras noreply at github.com
Thu Aug 14 09:14:26 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: b6c0c318984cfd4c0b577551fe81cab0311da467
      https://github.com/OSGeo/grass/commit/b6c0c318984cfd4c0b577551fe81cab0311da467
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2025-08-14 (Thu, 14 Aug 2025)

  Changed paths:
    M scripts/v.dissolve/v.dissolve.py

  Log Message:
  -----------
  grass.tools: Use Tools in v.dissolve (#6148)

This uses grass.tools in the v.dissolve tool for whatever was previously done by the grass.script.run_command functions. There is no strong reason to do this migration except to test grass.tool more and create more examples, but that's a good reason. Nice thing is that simple calls once the Tools object is created are shorter by one line. Tools objects need to be created. (I opted for creating them again in functions as opposed to passing one to all functions.)

To keep the behavior close to the original, some of the Tools objects do not capture stdout and stderr so that it is printed as it would be with run_command. This means that progress messages will be printed from the underlying tools and error messages will be part of that output as well. (This choice might have been different for a newly written tool or for different parts of a tool.) Places which capture stdin for further processing are kept with the defaults, so stderr is captured and will be part of an exception, but will not be visible otherwise (but was previously visible).

Places which use tool wrappers from grass.script are left as is. Replacement of the convenience wrappers is waiting for JSON outputs of specific tools, so the current change is only focusing on run_command and friends.

Running the pytest test takes the same time with the old and new code (20-29s depending on external factors but consistent for both versions).



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list