🧪 TEST: add a Sphinx-Needs kitchen-sink bundle to the example - #20
Draft
ubmarco wants to merge 1 commit into
Draft
🧪 TEST: add a Sphinx-Needs kitchen-sink bundle to the example#20ubmarco wants to merge 1 commit into
ubmarco wants to merge 1 commit into
Conversation
Sphinx-Needs contributes three file references resolved relative to the containing document, and they do not behave alike: reference resolved by dependency path_check needimport:: needs.json relfn2path yes yes needreport :template: relfn2path no no needuml/needarch !include PlantUML process no no `showcase/needs/` covers all three — one page per directive, each next to the file it reads. Unlike the other showcase bundles (one directive each) this is a kitchen sink, because the three cases only make sense side by side. Only `needimport` records a Sphinx dependency, so it is the only one visible to `path_check` and to incremental rebuilds; the docs now state that explicitly rather than leaving readers to assume the check is total. Also: - `report-template.rst` goes in the mount's `exclude`. It is Jinja input, not a document, but wears an `.rst` suffix — without the exclude the directory mount publishes an orphan page of unrendered Jinja. First use of `exclude` in the example. - The host reads its Sphinx-Needs options from the `[needs]` table of the same `ubproject.toml` that declares the mounts, so the shared-TOML convention the README advertises is now demonstrated rather than only described. - `plantuml_output_format = "svg_img"`. Sphinx-Needs stamps a `scale` attribute (100, a no-op) onto every diagram node, and plantuml's PNG path warns about any scaling attribute without Pillow, which fails the `-nW` build. The SVG path does no scaling, so no new dependency. - Non-Bazel coverage in `tests/test_path_directives.py` alongside the existing per-directive tests, so this is not gated behind the Bazel job. The needuml test must render for real (PlantUML resolves `!include` itself and records nothing), so it skips without java/plantuml. The `!include` requires the sphinx-needs fix for useblocks/sphinx-needs#1749, which is unreleased — hence the temporary git dependency, to be swapped for `sphinx-needs>8.3.0` once that ships.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The
showcase/folder has one bundle per file-referencing directive. Sphinx-Needsdid not fit that shape: it contributes three doc-relative file references, and
they do not behave alike.
path_checkneedimport:: needs.jsonrelfn2pathneedreport:template:relfn2pathneeduml/needarch!includeSo
showcase/needs/is a deliberate kitchen sink — one page per directive, eachsitting next to the file it reads — because the three only make sense side by
side.
The middle column is the finding worth surfacing.
path_checkworks offenv.dependencies, which is exactly why it is directive-agnostic — and exactlywhy it cannot see two of these three.
docs/source/configuration.rstnow says sooutright, instead of leaving readers to assume the check is total.
Also in here
excludein the example.report-template.rstis Jinjainput, not a document, but carries the conventional
.rstsuffix — so adirectory mount walks it and publishes an orphan page of unrendered Jinja. The
bundle's
.puml/.jsonfiles need no exclude; their suffixes are not insource_suffix.ubproject.tomlconvention, demonstrated. The host setsneeds_from_toml = "ubproject.toml", so Sphinx-Needs reads[needs]from thesame file whose
[[mounts]]array sphinx-mounts reads. The README hasadvertised this; now the example does it.
plantuml_output_format = "svg_img". Sphinx-Needs stamps ascaleattribute (100 — a no-op) onto every diagram node it generates, and
sphinxcontrib-plantuml's PNG path warns about any scaling attribute unless
Pillow is installed, which fails this
-nWbuild over nothing. The SVG pathdoes no scaling, so this avoids a dependency rather than adding one.
Tests
Both layers, so this is not gated behind the Bazel job:
tests/test_path_directives.py— three new tests next to the existingper-directive ones.
needimportandneedreportstay renderer-independentlike their neighbours; the
needuml!includetest has to render for real(PlantUML resolves that path itself and records nothing Sphinx can assert on),
so it skips without
java/plantuml.tests/test_example.py— asserts each page rendered, the imported needs becamereal needs, the report template was applied, the excluded template published no
page, and that the bundle-local
.pumlreached both rendered SVGs.Verified locally against the patched sphinx-needs: 168 passed (was 163), docs
build clean under
-nW,prek run --all-filespasses.Verified in the other direction too — against unpatched sphinx-needs the new
needuml test and the example build both fail with
plantuml command 'plantuml' cannot be run, which is the #1749 symptom. Theshowcase genuinely exercises the fix rather than merely coexisting with it.