Check documentation examples#

When you change a public API or a documentation example, run the small examples against packages built from your checkout. The runner checks the geometry first join, an eager cuDF geometry query, a coordinate transform, and a transform followed by a geometry join. It records setup time separately from execution time, along with the commit, installed packages, native library digests, input digests and per-example logs.

Run the examples#

Use a clean, committed checkout and follow the build requirements for geometry and proj. The runner creates Python 3.12 environments with uv. Geometry needs its CUDA 13 toolchain and locked libcudf environment; the GPU transform needs CUDA 13 and CuPy. The host selection builds proj without CUDA. It excludes geometry and the GPU transform explicitly. All inputs are checked in. The geometry case prepends the locked native environment’s library directory to the Python process’s loader path. Geometry cases install the locked cudf dependency group and geopandas extra through uv’s project source selection, including the pylibcudf source build.

From the repository root, run either selection:

uv run --project cugeo-geometry --locked --only-group docs python tools/docs_examples.py --mode host --out build/docs-examples-host
uv run --project cugeo-geometry --locked --only-group docs python tools/docs_examples.py --mode gpu --out build/docs-examples-gpu

Each output directory holds results.json, per-example logs, isolated installed packages and build.json records. Reusing that directory verifies its commit, features, package inventory and native artifact digests. A mismatch fails; use a fresh directory for a different commit or feature selection. CI uses --ci-cache to keep prefixes by case and dependency profile under ci_gate’s persistent cache root, outside the runner’s cleaned checkout. A profile change selects a fresh prefix. After a successful automatic build, the runner removes the other managed hash-named prefixes for that case under the cache lock. Pre-hash outputs, unrelated directories and symbolic links stay untouched; explicit --reuse does not prune. For a different commit with the same profile it first verifies the retained artifacts, installed packages and feature selection, then rebuilds through the existing library commands. If the checkout path changes, it discards the generated CMake build trees, which refer to that path, and rebuilds them while retaining the dependency environment and source archives. It never runs the retained package as the new commit before rebuilding. --reuse also fails when a build record is absent. --cases proj-host selects named cases; an empty or unknown selection fails. GPU work runs through geometry’s gpu_run. A missing required GPU is reported as skipped and fails the GPU selection. Execution duration is wall time for the program or Sphinx command, including interpreter startup, parsing, comparisons and GPU admission. Native preparation uses build_native.sh’s CPU allocation, CUGEO_RUNNER_JOB_CPUS when set.

Each case’s libraries list selects the source packages installed together. The build record identifies each package’s commit, features, dependency groups, extras and installed artifacts. Reuse and coverage validation require every selected package; a missing secondary package cannot count as a tested example.

The nightly selection runs these small workflows. Larger feature and installation matrices remain on demand through each library’s own tools. These documentation jobs run outside feature merge requests and merge trains. A failed example job stays red and does not replace the last successful published site. The example job has a provisional two-hour timeout. This is an execution limit, not a qualified nightly runtime budget. For a scheduled or on-demand CI run, select the default branch and set DOCS_EXAMPLES=1. An on-demand run uses GitLab’s Run pipeline page. These pipelines select the docs jobs and Pages, without the product merge gate. The product’s nightly tier runs outside these pipelines (test tiers).

Executed pages#

The Geometry cases exercise three published tutorials.

The proj-host and proj-gpu cases run the host and device groups in Transform coordinate columns already in memory. The proj-device case runs the complete program in Project survey points onto a UTM map. The output matcher allows differences in coordinate display and PROJ versions where marked. Expected statuses and completion messages must match.

The reproject-join case runs the complete program in Reproject locations and join them to service areas. It installs geometry and CUDA-enabled proj from the same commit in one environment, copies the projected coordinates into WKB input, and checks every coordinate/status and the complete ordered polygon-join result against independent PROJ/PostGIS evidence. The runner compares all printed rows exactly.

The raster-warp, raster-align, raster-ortho and raster-chips cases run the CuPy examples of the Raster guide pages warp imagery, align two images, orthorectify an image and batch chip reads on a CUDA build. They share one build directory, raster-cuda, so a run builds cugeo-raster once with the cuda, nvtiff, nvcomp and orthorect features, against the CUDA cugeo-proj of the same commit. The runner installs the nvTIFF and nvCOMP wheels from cugeo-raster’s lock before the build reads their headers, and fails the build when the installed library lacks any of those features. CuPy comes from cugeo-proj’s cu13 extra. A case’s build field names a shared build directory; cases that share one list the same libraries and mode.

Inspect coverage#

The inventory reads Sphinx’s document trees for every published section. It lists each block’s page, line, language, classification and execution evidence. Generate it with:

uv run --project cugeo-geometry --locked --only-group docs python tools/docs_inventory.py --out build/docs-coverage --results build/docs-examples-gpu/results.json

Omit --results for an inventory without execution evidence. A program declaration names a registered source. Its disposition becomes tested-program only when every registered case using that source has a matching successful result; its execution field records the outcome. The inventory verifies that the complete included bytes match that source. Register short Python examples as a Sphinx page/group case. The runner installs the locked docs group in that case’s Python environment and invokes Sphinx’s native doctest builder. testcode blocks share state in page order within their group; testoutput compares output from the preceding test in that group. Receipts identify the page, group, source blocks and native execution counts. Declarations without successful execution evidence remain uncovered.

Use testoutput for checked output. Its disposition becomes expected-output only when Sphinx successfully compares its producer group. An illustrative block uses a class beginning with docs-illustrative- followed by its reason, with words separated by hyphens. Unconverted legacy blocks remain uncovered. Adding a page to pages in tools/docs_examples.json requires classification of every block on that page; every executable group must have a registered case. When its required cases passed, each block must have execution or comparison evidence. Host-only reports leave unselected GPU groups uncovered. Missing pages and empty inventories fail.