Skip to content

Docs: consume sphinx-gp-mermaid, drop the vendored renderer#1073

Open
tony wants to merge 4 commits into
masterfrom
mermaid
Open

Docs: consume sphinx-gp-mermaid, drop the vendored renderer#1073
tony wants to merge 4 commits into
masterfrom
mermaid

Conversation

@tony

@tony tony commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace the vendored docs/_ext/mermaid_inline.py with sphinx-gp-mermaid, the gp-sphinx workspace package it was extracted into β€” the same build-time dual light/dark inline-SVG pipeline introduced in Docs: build-time mermaid + tmux-layout diagram renderingΒ #1071, now maintained upstream.
  • Add the package to the dev and docs dependency groups via a [tool.uv.sources] git source pinned to gp-sphinx's mermaid branch until a release ships.
  • Remove the vendored extension, its stylesheet, and its test suite β€” the code and its tests now live in the gp-sphinx workspace.
  • Zero re-render migration: the package kept the cache-key inputs identical, so every existing docs/_mermaid_cache SVG remains a cache hit; adoption never launches Chrome.

Changes

  • pyproject.toml / uv.lock: dependency, git source, and exclude-newer-cooldown exemption alongside the other gp-sphinx-family packages.
  • docs/conf.py: extra_extensions loads sphinx_gp_mermaid. The explicit myst_fence_as_directive=["mermaid"] stays for now β€” the pinned gp-sphinx release predates the upstream auto-routing β€” and drops on the next gp-sphinx bump.
  • docs/AGENTS.md, .gitignore, .github/workflows/docs.yml: authoring guidance and comments retargeted at the package. The pnpm/puppeteer provisioning is unchanged: mermaid-cli remains a docs devDependency here, since the Python package resolves mmdc but does not vendor it.

Rendered markup now uses the package's workspace-namespaced CSS classes (gp-sphinx-diagram* in place of gp-diagram*), shipped by the package itself; visual output is unchanged.

Setup required

Hold merge until gp-sphinx cuts a release containing sphinx-gp-mermaid (companion PR below), then flip the git source to a normal PyPI pin. Merging while pointed at a feature branch would break lock reproducibility once that branch is deleted.

Verification

Zero references to the vendored renderer or its CSS namespace remain:

rg -l 'mermaid_inline|gp-diagram'

Test plan

  • uv run ruff check ., uv run ruff format ., uv run mypy . β€” clean
  • uv run py.test --reruns 0 β€” suite green (the vendored mermaid tests moved upstream with the code)
  • just build-docs β€” every diagram page renders through the package; _mermaid_cache entries hit with no mmdc invocations (mtimes unchanged)
  • Built pages carry gp-sphinx-diagram__variant--theme-{light,dark} figures and link the packaged stylesheet

Companion PR

tony added 3 commits July 1, 2026 19:02
why: The mermaid renderer is moving from docs/_ext into the
sphinx-gp-mermaid workspace package; consume it ahead of a release so
the vendored copy can be dropped.

what:
- sphinx-gp-mermaid in the dev and docs dependency groups
- [tool.uv.sources] git source pinned to gp-sphinx's mermaid branch
  (packages/sphinx-gp-mermaid subdirectory); switch to a PyPI pin when
  the next gp-sphinx release ships
- Exempt the package from the exclude-newer cooldown alongside its
  siblings
why: The vendored docs/_ext/mermaid_inline.py moved into the
sphinx-gp-mermaid workspace package; load the package instead so the
local copy can be dropped.

what:
- extra_extensions: mermaid_inline -> sphinx_gp_mermaid
- Keep the explicit myst_fence_as_directive: the pinned gp-sphinx
  release predates the auto-routing that ships with the package; drop
  it on the next gp-sphinx bump
- Existing _mermaid_cache entries stay valid (identical cache-key
  inputs), so adoption re-renders nothing
why: The renderer now ships as sphinx-gp-mermaid and the docs build
already loads the package, so the docs/_ext copy, its stylesheet, and
its test suite are dead weight.

what:
- Delete docs/_ext/mermaid_inline.py, docs/_static/css/gp-diagram.css,
  and tests/test_docs_mermaid.py (the suite moved to the gp-sphinx
  workspace with the code)
- Retarget the AGENTS.md diagrams convention, .gitignore comment, and
  docs.yml toolchain comment at the package; the pnpm/puppeteer
  provisioning itself is unchanged
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 82.56%. Comparing base (085f9d9) to head (533e6a5).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1073   +/-   ##
=======================================
  Coverage   82.56%   82.56%           
=======================================
  Files          31       31           
  Lines        2770     2770           
  Branches      518      518           
=======================================
  Hits         2287     2287           
  Misses        346      346           
  Partials      137      137           

β˜” View full report in Codecov by Harness.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

tony added a commit that referenced this pull request Jul 2, 2026
why: Verify the sphinx-gp-mermaid renderer on the live site β€” the
production path runs behind Cloudflare (Rocket Loader), which local
builds cannot reproduce.

what:
- Add mermaid to the docs workflow's push trigger
- Force PUBLISH on the mermaid ref so a workflow-only push deploys

Revert this commit before merging #1073.
why: Verify the sphinx-gp-mermaid renderer on the live site β€” the
production path runs behind Cloudflare (Rocket Loader), which local
builds cannot reproduce.

what:
- Add mermaid to the docs workflow's push trigger
- Force PUBLISH on the mermaid ref so a workflow-only push deploys

Revert this commit before merging #1073.
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.

1 participant