Repository navigation
feat: upstream batch C — include, twisted pairs, shorts, sheet PDF, errors - #16
Merged
Merged
Conversation
…irs, shorts, sheet PDF
…ireviz#505, wireviz#207, wireviz#508 - every error raised while a connection set is processed is prefixed with 'connection set N (X1 → W1 → X2): '; ValueError/TypeError keep their class, anything else becomes wv_errors.WireVizError(ValueError) - the CLI prints input errors as one line (exit 1); --debug re-raises - a cable without wirecount/colors takes its wire count from the wire numbers used for it (all sets; per template instance) - behavior change: a bare named cable (- B1) uses wires 1..n instead of wire 1 n times; autogenerated '- W.' is unchanged - clearer style: simple and unknown-wire-count messages
…s — wireviz#220 - include: [file, ...] merges connectors and cables by name (main file wins; the same name in two includes is an error naming both files) and appends additional_bom_items; metadata/options/tweak/connections stay main-file only - nested includes, cycle and depth checks; paths relative to the including file, then -I/--include-path / parse(include_paths=...) - relative image paths in an included file resolve against that file - PNG output embeds the merged YAML; untrusted mode refuses include - docs: include and --prepend in syntax.md
…wireviz#353 Cable twisted: [[RD, BK], {wires: [3, 4], rate: 20/m}] lists each group's wires together, framed (solid border; dashed means a shield) with a caption such as 'Twisted pair: 20/m'. Wires are referenced by number, color or label; ports keep the wire number, so edges do not change. Errors for a group under 2 wires, a wire in two groups, unknown wires.
…ireviz#350 Connector shorts: [[1, 2, 3], {YE: [N, AUX]}] draws each short as a solid bar column next to the ports, with a dot at every shorted pin (pins by number or label, optional color). Shorted pins are activated, so they stay visible with hide_disconnected_pins and count as populated. Plain HTML table cells; no gvpr/neato post-processing.
…reviz#32, wireviz#304 - new output format sheet (-f D, <name>.sheet.pdf): the HTML page rendered to one PDF page at the template's sheet size; optional extra wireviz[pdf] (WeasyPrint); its URL fetcher refuses every URL - din-6771 template: flex layout so the diagram scales into the space above the BOM and title block (no overlap), named @page per sheet size (A4 portrait, A3/A2 landscape), A4 when sheetsize is not set - simple template: print CSS fits the diagram to the page - new <!-- %date% --> placeholder; -f P is unchanged (diagram-only PDF) - CI installs Pango and wireviz[pdf] so the sheet tests run
- sheet PDF: WeasyPrint gets a URLFetcher that allows data: URLs only (the refuse-all function dropped every inline image and, on 70, raised for any URL); requires weasyprint>=70; untrusted mode renders in a child process with the render timeout - shorts: at most 64 per connector; spans computed once per connector (was O(pins^2 x shorts)); short colors must resolve to #rrggbb - include: a file reached through two includes (diamond) is merged once; conflicts name the defining files; non-UTF-8 includes name the file; symlinked includes resolve relative paths next to the link - wireviz#508: bare references to named template instances use wires 1..n and feed the wire-count pre-pass; out-of-range errors for a bare cable explain the change; the pre-pass skips malformed entries so the main loop reports them with context - errors: only ValueError/TypeError/plain Exception get connection-set context (other exceptions are bugs and pass through); the CLI prints input and environment errors (incl. missing WeasyPrint or Graphviz) as one line - warnings when shorts (style: simple) or twisted (show_box: false) are not shown; metadata.date wins over the built-in date placeholder; simple template prints at the browser's page size - tests: sheet images and no-fetch, untrusted sheet timeout, WeasyPrint probed per test, not at collection
- sheet PDF child: runs with -c and sys.path[0] set to this package's
root ('python -m' imported a 'wireviz' from the working directory);
memory limited on POSIX; failures raise WireVizRenderError
- connection sets: a set that is not a list, an empty mapping or an
empty list is a clear input error with set context (was IndexError /
RuntimeError without context)
- shorts: pins x shorts over all connectors is capped (100 000 cells),
so YAML aliases cannot multiply the label size
- include: a file reached twice adds its BOM items once (shared set
through the recursion)
- CLI: catches WireVizRenderError and graphviz.ExecutableNotFound, not
every RuntimeError
- %date%: an unquoted YAML date works; null or no metadata.date falls
back to today
- the wireviz#508 hint names the real cable; tests spy the WeasyPrint fetcher
and cover the cwd package, malformed sets, diamond BOM items
…thon 3.10+ WeasyPrint installed but did not load on the runner, so all 8 sheet tests were skipped. CI now installs the missing library and sets WIREVIZ_REQUIRE_PDF, which turns that skip into a failure with the reason (pytest -rs).
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.
Summary
Batch C: larger features from upstream wireviz/WireViz issues. The design is in
docs/plans/2026-10-02-batch-c-design.md; the open decisions were confirmed on 2026-10-02. Based on batch B.connection set 2 (X1 → W1 → X2): ...). The CLI prints input errors as one line;--debugshows the traceback. Newwv_errors.WireVizError.wirecount/colorstakes its wire count from the connections. Behavior change: a cable named alone (- B1) now uses wires 1..n.include:for shared connector/cable libraries, plus-I/--include-path. Merge rules are in syntax.md. Refused in untrusted mode.twisted:shows twisted pairs, triads and groups, framed with a caption.shorts:shows internal jumpers as a bar in the pin table. Shorted pins count as populated.-f D,wireviz[pdf]= WeasyPrint ≥ 70). The din-6771 template no longer overlaps the diagram with the BOM and title block, and it prints at the right page size.The sheet PDF only reads inline
data:content. In untrusted mode it runs in a time-limited child process that cannot import a package from the working directory.Review
Two Code Reviewer rounds (Opus). Every finding is fixed, with tests.
Test plan
wireviz[pdf])🤖 Generated with Claude Code