Skip to content

grass.temporal: Add registered_maps_grouped() and honor dbif mapsets in tlist() - #7714

Merged
petrasovaa merged 1 commit into
OSGeo:mainfrom
petrasovaa:temporal-gui-helper
Jul 15, 2026
Merged

petrasovaa merged 1 commit into
OSGeo:mainfrom
petrasovaa:temporal-gui-helper

Conversation

@petrasovaa

Copy link
Copy Markdown
Contributor

Adds a helper to grass.temporal.gui_support helpful for the Data Catalog STDS integration (#861, follow-up to #7608), where listing dataset contents with one t.rast.list call per dataset is too slow.

  • New registered_maps_grouped(dbif=None): returns the maps registered in space time datasets, grouped by dataset type and dataset id, ordered by start time. One SQL query per mapset instead of one tool call per dataset.
    This also gives the caller the set of maps registered in any dataset (e.g., to hide or gray them out at the mapset level).
  • Fix tlist() to iterate the mapsets of the passed connection instead of re-deriving the search path. Passing a connection created with mapsets="*" now works for tlist()/tlist_grouped(); behavior with the default connection is unchanged, so existing callers are unaffected.

New pytest file covers temporal ordering (deliberately opposite to alphabetical order), relative time, maps in multiple datasets, cross-mapset registration, mapset scoping (search path, named mapsets, *), and that listing with tgis.init(skip_db_init=True) does not create a temporal database as a side effect.

Written with the help of Claude Code.

@saket0187, @ninsbl I am hoping this could be helpful for loading the maps quickly.

…in tlist()

Add a gui_support helper that returns the maps registered in all space
time datasets of the mapsets covered by the given database connection,
grouped by dataset type and dataset id, ordered by start time. This
gives the Data Catalog a cheap way to show dataset contents and to
identify maps registered in any dataset without calling t.rast.list
per dataset.

Fix tlist() to iterate the mapsets of the passed connection instead of
re-deriving the search path, so tlist_grouped() works with a
connection created with mapsets=*. Default behavior is unchanged.

The tests also cover mapsets without a temporal database, a project
without any temporal database, and verify that listing with
tgis.init(skip_db_init=True) does not create a temporal database.

Written with the help of Claude Code.
Comment thread python/grass/temporal/gui_support.py Resolved
Comment thread python/grass/temporal/gui_support.py Resolved
@petrasovaa
petrasovaa merged commit c7fc4ea into OSGeo:main Jul 15, 2026
26 checks passed
@petrasovaa
petrasovaa deleted the temporal-gui-helper branch July 15, 2026 21:11
@github-actions github-actions Bot added this to the 8.6.0 milestone Jul 15, 2026
wenzeslaus added a commit that referenced this pull request Jul 16, 2026
…7732)

The temporal tests needs separate environment like all the other tests, but env can't be explicitly passes as for the rest of the API, so this uses pytest's monkeypatch to work around that.

The module-scoped fixture created its sessions with gs.setup.init()
without env, which sets the session up in the global os.environ. init()
prepends the GRASS executable paths to PATH on every call and never
removes them again, so PATH kept growing for the rest of the pytest
process, and later tests which copy os.environ inherited it. On Windows
this made r.coin fail on main since #7714 was merged: r.coin runs r.stats
in a subprocess, and supposedly, cmd.exe could no longer resolve it on the inherited
PATH, so r.coin reported an empty table.

Create the sessions with env=os.environ.copy() instead. tgis reads the
session from os.environ, so mirror the second session there with
monkeypatch, which restores the environment once the module is done. This
is what test_project_without_temporal_database in the same file already
does. The ultimate fix is for tgis to accept env, which would remove the
need for the monkey patch.

Additionally, document the rule and the tgis exception in AGENTS.md.

The investigation of the CI failure and this patch were done with the
assistance of Claude Code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries Python Related code is in Python tests Related to Test Suite

Development

Successfully merging this pull request may close these issues.

2 participants