Skip to content

refactor(explain): move HTML renderer into the soil_id package - #396

Merged
johannesparty merged 1 commit into
mainfrom
feat/explain-html-renderer
Sep 25, 2026
Merged

johannesparty merged 1 commit into
mainfrom
feat/explain-html-renderer

Conversation

@johannesparty

Copy link
Copy Markdown
Contributor

Moves render_html from scripts/render_soil_explain.py (not shipped in the wheel) into an importable soil_id/render_explain.py, so downstream services can from soil_id.render_explain import render_html. The script becomes a thin CLI wrapper.

  • Rendering code moved verbatim (byte-identical) — the US explain-HTML snapshot is unaffected.
  • scripts/render_soil_explain.py keeps CLI concerns (file/URL loading, extract_trace, browser preview) and imports render_html from the package.
  • Tests repointed to soil_id.render_explain.
  • Full suite: 182 passed, 31 snapshots; ruff clean.

Enables the terraso-backend /explain/…html endpoint to render server-side.

Stacked on feat/shallow-demote-horizon.

🤖 Generated with Claude Code

@johannesparty
johannesparty force-pushed the feat/shallow-demote-horizon branch from 0d44759 to df79e37 Compare September 25, 2026 18:19
@johannesparty
johannesparty force-pushed the feat/explain-html-renderer branch from 5004f55 to 21dcf66 Compare September 25, 2026 18:19
@johannesparty
johannesparty force-pushed the feat/shallow-demote-horizon branch from df79e37 to a746a2d Compare September 25, 2026 18:55
Base automatically changed from feat/shallow-demote-horizon to main September 25, 2026 18:59
render_html lived in scripts/render_soil_explain.py, which isn't shipped in
the wheel — so downstream services (e.g. the terraso-backend explain endpoint)
couldn't import it. Move the renderer to an importable soil_id/render_explain.py
(auto-included via packages=["soil_id"]); the script becomes a thin CLI wrapper
that imports render_html from there.

The rendering code is moved verbatim (byte-identical), so the US explain-HTML
snapshot is unaffected. Tests repointed to soil_id.render_explain.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@johannesparty
johannesparty force-pushed the feat/explain-html-renderer branch from 21dcf66 to 1d7cb78 Compare September 25, 2026 18:59
@johannesparty
johannesparty merged commit 5f51f39 into main Sep 25, 2026
4 checks passed
@johannesparty
johannesparty deleted the feat/explain-html-renderer branch September 25, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants