Drilldown Architecture

This example shows how needsvg diagrams can link directly to each other, creating a true drill-down experience. Each SVG layer is wrapped in an .. arch:: need element with an ID. Stage boxes use ref() to link to the arch element of the next layer, so clicking a box jumps straight to the detail SVG.

Tip

The pattern:

  1. Define an .. arch:: element for each SVG layer (e.g. ARCH_PIPELINE, ARCH_BUILD).

  2. Place the .. needsvg:: block inside the arch element’s content.

  3. In the SVG, link boxes to the next layer with ref('ARCH_BUILD') etc.

  4. Add a back-link in each detail SVG: ref('ARCH_PIPELINE').

  5. Add sibling links so users can jump between peer layers.

No JavaScript, no custom code – just sphinx-needs anchors.

Level 1 – CI Pipeline

Requirement: CI Pipeline PIPE_CI
is implemented by: STAGE_BUILD, STAGE_TEST, STAGE_DEPLOY

The continuous-integration pipeline that validates every commit.

Requirement: Build stage STAGE_BUILD
implements: PIPE_CI
is implemented by: JOB_LINT, JOB_COMPILE

Compile the project and produce distributable artefacts.

Requirement: Test stage STAGE_TEST
implements: PIPE_CI
is implemented by: JOB_UNIT, JOB_DOCS

Run the full test suite against the built artefacts.

Requirement: Deploy stage STAGE_DEPLOY
implements: PIPE_CI
is implemented by: JOB_PAGES, JOB_RELEASE

Publish documentation and release artefacts.

Architecture View: CI Pipeline Overview ARCH_PIPELINE
is implemented by: ARCH_BUILD, ARCH_TEST, ARCH_DEPLOY

Top-level view of the three pipeline stages. Click a stage to drill down.


Level 2 – Build Stage

Requirement: Lint job JOB_LINT
implements: STAGE_BUILD
is implemented by: STEP_RUFF, STEP_MYPY

Run ruff linter and mypy type-checker.

Requirement: Compile job JOB_COMPILE
implements: STAGE_BUILD
is implemented by: STEP_DEPS, STEP_WHEEL

Build the Python wheel with hatchling.

Architecture View: Build Stage Detail ARCH_BUILD
implements: ARCH_PIPELINE
is implemented by: ARCH_LINT, ARCH_COMPILE

Detail view of the Build stage. Click any job to drill into its steps.


Level 2 – Test Stage

Requirement: Unit tests job JOB_UNIT
implements: STAGE_TEST
is implemented by: STEP_COLLECT, STEP_PYTEST

Run pytest unit tests with coverage.

Requirement: Docs build job JOB_DOCS
implements: STAGE_TEST
is implemented by: STEP_GENERATE, STEP_SPHINX

Build Sphinx documentation and check for warnings.

Architecture View: Test Stage Detail ARCH_TEST
implements: ARCH_PIPELINE
is implemented by: ARCH_UNIT, ARCH_DOCS

Detail view of the Test stage. Click any job to drill into its steps.


Level 2 – Deploy Stage

Requirement: Publish docs job JOB_PAGES
implements: STAGE_DEPLOY

Deploy Sphinx docs to GitHub Pages.

Requirement: Release job JOB_RELEASE
implements: STAGE_DEPLOY

Tag and publish the Python package.

Architecture View: Deploy Stage Detail ARCH_DEPLOY
implements: ARCH_PIPELINE

Detail view of the Deploy stage.


Level 3 – Lint Job Steps

Requirement: Run ruff STEP_RUFF
implements: JOB_LINT

Execute ruff check across the source tree.

Requirement: Run mypy STEP_MYPY
implements: JOB_LINT

Execute mypy --strict on the package source.

Architecture View: Lint Job Steps Detail ARCH_LINT
implements: ARCH_BUILD

Detail view of the Lint job’s individual steps.

◀ Build Stage CI Pipeline ▸ Build ▸ Lint Job Lint Job -- Steps STEP_RUFF Run ruff STEP_MYPY Run mypy Build jobs: Lint Compile

Level 3 – Compile Job Steps

Requirement: Install dependencies STEP_DEPS
implements: JOB_COMPILE

Install build dependencies via uv pip install.

Requirement: Build wheel STEP_WHEEL
implements: JOB_COMPILE

Run hatchling build to produce the distributable wheel.

Architecture View: Compile Job Steps Detail ARCH_COMPILE
implements: ARCH_BUILD

Detail view of the Compile job’s individual steps.

◀ Build Stage CI Pipeline ▸ Build ▸ Compile Job Compile Job -- Steps STEP_DEPS Install dependencies STEP_WHEEL Build wheel Build jobs: Lint Compile

Level 3 – Unit Test Job Steps

Requirement: Collect tests STEP_COLLECT
implements: JOB_UNIT

Run pytest --collect-only to discover test cases.

Requirement: Run tests with coverage STEP_PYTEST
implements: JOB_UNIT

Execute pytest --cov and generate a coverage report.

Architecture View: Unit Test Job Steps Detail ARCH_UNIT
implements: ARCH_TEST

Detail view of the Unit test job’s individual steps.

◀ Test Stage CI Pipeline ▸ Test ▸ Unit Test Job Unit Test Job -- Steps STEP_COLLECT Collect tests STEP_PYTEST Run tests with coverage Test jobs: Unit Docs

Level 3 – Docs Build Job Steps

Requirement: Generate RST from sources STEP_GENERATE
implements: JOB_DOCS

Auto-generate API docs from Python source with sphinx-apidoc.

Requirement: Sphinx build STEP_SPHINX
implements: JOB_DOCS

Run sphinx-build -W with warnings-as-errors to produce HTML.

Architecture View: Docs Build Job Steps Detail ARCH_DOCS
implements: ARCH_TEST

Detail view of the Docs build job’s individual steps.

◀ Test Stage CI Pipeline ▸ Test ▸ Docs Build Job Docs Build Job -- Steps STEP_GENERATE Generate RST from sources STEP_SPHINX Sphinx build Test jobs: Unit Docs