601 Commits

Author SHA1 Message Date
cfc25dfabf Add url/href support for clickable SVG nodes and BOM links (port of upstream PR #168)
Some checks failed
Create Examples / build (ubuntu-22.04, 3.7) (push) Has been cancelled
Create Examples / build (ubuntu-22.04, 3.8) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.10) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.11) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.12) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.9) (push) Has been cancelled
Add `url` field to Component, WireClass, and Cable with per-wire URL
support for bundles. URLs produce clickable href attributes on GraphViz
nodes/edges and appear as a linked column in HTML BOM output.
v0.5-dev.2026-02-13.2
2026-02-13 05:06:51 -07:00
3d639f6ec2 Add configurable output DPI setting (port of upstream PR #379)
Some checks are pending
Create Examples / build (ubuntu-22.04, 3.7) (push) Waiting to run
Create Examples / build (ubuntu-22.04, 3.8) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.10) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.11) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.12) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.9) (push) Waiting to run
Adds output_dpi field to Options (default 96.0) and passes it to the
GraphViz graph attributes. Higher DPI produces sharper PNG/PDF renders,
useful for print-quality harness documentation.
2026-02-13 03:52:30 -07:00
79be720eab Add <!-- %revision% --> template placeholder (port of upstream PR #492)
Adds a _get_latest_revision() helper that extracts the last entry from
metadata.revisions. Allows templates to show the current revision
indicator without rendering the full revision table.
2026-02-13 03:51:37 -07:00
254be36948 Fix SVG MIME type for embedded images (port of upstream PR #443)
SVG images embedded in connector/cable nodes failed to display because
the MIME type was image/svg instead of image/svg+xml per W3C spec.
2026-02-13 03:50:58 -07:00
4da9fe4886 Merge pin safety fixes into testing/web-ui-features
Some checks failed
Create Examples / build (ubuntu-22.04, 3.7) (push) Has been cancelled
Create Examples / build (ubuntu-22.04, 3.8) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.10) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.11) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.12) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.9) (push) Has been cancelled
Port of v0.4.1 pin safety work (#432) to v0.5-dev architecture:
- normalize_pin() for int/str coercion at YAML boundary
- resolve_pin() for label-to-number resolution
- GraphViz port index fix for loops/shorts on non-sequential pins
- Apollo review hardening (duplicate detection, min pin count, float/bool rejection)
- Unique port names for multi-short rendering
- 52 new tests (71 total)
v0.5-dev.2026-02-13
2026-02-13 03:48:54 -07:00
17ef5806f1 Address Apollo review deferred items (S2, I4, S5)
Some checks failed
Create Examples / build (ubuntu-22.04, 3.7) (push) Has been cancelled
Create Examples / build (ubuntu-22.04, 3.8) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.10) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.11) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.12) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.9) (push) Has been cancelled
S2: Replace type() == list with isinstance() for list-to-dict conversion.

I4: Fix duplicate GraphViz port names when a pin appears in multiple
shorts. Port names now encode short column index (p{idx}j{col}) so
each cell in the shorts grid has a unique port. Edge generation in
gv_connector_shorts() updated to match.

S5: Add rendering tests for multi-pin loop edge chains and multi-short
port name uniqueness.
2026-02-13 03:12:14 -07:00
6198f7352a Port pin safety fixes from v0.4.1 to v0.5-dev (issue #432)
Some checks are pending
Create Examples / build (ubuntu-22.04, 3.7) (push) Waiting to run
Create Examples / build (ubuntu-22.04, 3.8) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.10) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.11) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.12) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.9) (push) Waiting to run
Add normalize_pin() for consistent int/str coercion at YAML boundary,
resolve_pin() for label-to-number resolution, and fix GraphViz port
index rendering for loops and shorts on non-sequential connectors.

Key changes:
- wv_utils: add normalize_pin(), reject floats/bools, refactor expand()
- wv_dataclasses: normalize pins/pinlabels/wirelabels in __post_init__,
  add Connector.resolve_pin(), resolve loop/short pins through labels,
  detect duplicate pins and minimum pin count in loops/shorts
- wv_graphviz: convert pin IDs to position indices in loop/short edges,
  fix short membership test from pin.index to pin.id
- wv_harness: delegate connect() pin resolution to resolve_pin()
- tests: 50 tests covering resolution, coercion, rendering, validation
2026-02-13 02:09:37 -07:00
5e2634e7b8 Fix package_data for gvpr and empty BOM crash
Some checks are pending
Create Examples / build (ubuntu-latest, 3.9) (push) Waiting to run
Create Examples / build (ubuntu-22.04, 3.7) (push) Waiting to run
Create Examples / build (ubuntu-22.04, 3.8) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.10) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.11) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.12) (push) Waiting to run
- Include *.gvpr files in package_data so wv_gvpr.gvpr ships
  in the wheel distribution (reported by web-ui integration agent)
- Guard generate_html_output() against empty BOM list to prevent
  IndexError when YAML has no connectors/cables
2026-02-13 01:00:07 -07:00
31db67921a Update web-ui handoff with PDF, strip specs, YAML-in-PNG features
Some checks are pending
Create Examples / build (ubuntu-22.04, 3.7) (push) Waiting to run
Create Examples / build (ubuntu-22.04, 3.8) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.10) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.11) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.12) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.9) (push) Waiting to run
Document four new capabilities ported from upstream PRs since the
initial handoff: PDF output (#367), connector strip lengths (#446),
YAML-in-PNG round-trip (#234), and code quality improvements.
Updated dependencies and next-steps checklist.
2026-02-13 00:40:06 -07:00
9ba17ef621 Address code review findings for YAML-in-PNG feature
Some checks are pending
Create Examples / build (ubuntu-22.04, 3.7) (push) Waiting to run
Create Examples / build (ubuntu-22.04, 3.8) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.10) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.11) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.12) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.9) (push) Waiting to run
Critical fixes:
- C1: Preserve existing PNG text metadata when embedding YAML
- C2: Exception handling — metadata failure no longer crashes parse()
- C3: Atomic write via tempfile+rename prevents corruption

Important fixes:
- I1: Size guard (10MB) on read_yaml_from_png for untrusted PNGs
- I2: Existence check and meaningful errors in read_yaml_from_png
- I3: ParsedInput NamedTuple replaces raw 3-tuple return
- I4: Normalize output_formats to tuple to prevent substring matching
- I5: 19-test suite covering round-trip, edge cases, and error paths

Also: removed dead prepend_input parameter (S3), added version tag (S1).
2026-02-13 00:37:19 -07:00
5f54ab1f0d Add strip length specs for connectors (port of upstream PR #446)
Some checks are pending
Create Examples / build (ubuntu-22.04, 3.7) (push) Waiting to run
Create Examples / build (ubuntu-22.04, 3.8) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.10) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.11) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.12) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.9) (push) Waiting to run
Connectors now support a 'strip' property with sleeve and insulation
length specifications, rendered in the diagram node and available in
the data model for BOM/manufacturing use.
2026-02-13 00:29:09 -07:00
c84e6fb3ad Embed YAML source in PNG metadata for round-trip capability (port of upstream PR #234)
PNGs now contain the original YAML harness definition as compressed
iTXT metadata. Use read_yaml_from_png() to extract it — share a PNG,
recipient can regenerate or edit the harness.
2026-02-13 00:27:09 -07:00
d8260b3fde Enable PDF output format (port of upstream PR #367)
GraphViz natively supports PDF rendering, so this just adds "pdf" to
the allowed format list and exposes it via the -f P CLI flag.
2026-02-13 00:25:29 -07:00
26b80f7a0b Add web-ui integration handoff doc for testing/web-ui-features branch
Some checks are pending
Create Examples / build (ubuntu-22.04, 3.7) (push) Waiting to run
Create Examples / build (ubuntu-22.04, 3.8) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.10) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.11) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.12) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.9) (push) Waiting to run
Documents the merged community features (Jinja2 preprocessor, jumper
support) with YAML examples, dependency info, and integration notes.
2026-02-13 00:07:12 -07:00
5ad38e586e Merge feature/jumpers: native jumper wire support for harness diagrams
Some checks are pending
Create Examples / build (ubuntu-22.04, 3.7) (push) Waiting to run
Create Examples / build (ubuntu-22.04, 3.8) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.10) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.11) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.12) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.9) (push) Waiting to run
Major refactor from upstream PR #455 adding jumper wires as a first-class
component type. Includes renamed modules (DataClasses→wv_dataclasses,
Harness→wv_harness), new color system, and updated BOM generation.

Preserved Jinja2 preprocessor (PR #382) in wv_cli.py alongside jumper changes.
2026-02-13 00:06:17 -07:00
2faaa4dbf7 Merge feature/jinja2-preprocessor: Jinja2 templating for YAML harness definitions
Resolves conflict in wv_cli.py by taking the Jinja2 template rendering
approach, which subsumes plain file reading (upstream PR #382).
2026-02-13 00:00:53 -07:00
Tobias Falk
17407c195f rerun examples
Some checks failed
Create Examples / build (ubuntu-22.04, 3.7) (push) Has been cancelled
Create Examples / build (ubuntu-22.04, 3.8) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.10) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.11) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.12) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.9) (push) Has been cancelled
2025-03-12 23:02:46 +01:00
Tobias Falk
8979227a20 fixed harnes.py 2025-03-12 23:01:39 +01:00
Tobias Falk
7ef8a0fc52 Update Jumper code, thanks @SnowMB 2025-03-12 22:56:10 +01:00
Tobias Falk
3e4353e62a Add Jumper code 2025-03-12 22:38:52 +01:00
Tobias Falk
206be6bbed add ex16 2025-03-12 22:15:53 +01:00
Tobias Falk
cfe9590905 Add Readme text and examples 2025-03-12 22:15:35 +01:00
Tobias Falk
203e947293 Add syntax description 2025-03-12 22:01:48 +01:00
Daniel Rojas
01c3771a9c Merge branch 'refactor/big-refactor-squashed' into dev-refactored 2025-03-01 20:45:43 +01:00
Daniel Rojas
b1d02b9d7f Rebuild examples 2025-03-01 20:35:41 +01:00
Daniel Rojas
0683b446f0 Update GitHub workflow 2025-03-01 20:34:21 +01:00
Daniel Rojas
a4581d0834 Bump version to 0.5-dev+refactor 2025-03-01 20:33:49 +01:00
Daniel Rojas
fe7f4a3329 Apply black 2025-03-01 19:41:28 +01:00
Daniel Rojas
8f0dbe9e7f Add TODOs about utf-8 encoding/charset (#395)
Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:28 +01:00
Daniel Rojas
9fbce3bbf7 Avoid ResourceWarning: unclosed file (#395)
A number of such warnings showed up when running e.g.
PYTHONWARNINGS=always python build_examples.py
PYTHONWARNINGS=always wireviz ../../examples/demo0?.yml
See https://github.com/wireviz/WireViz/pull/309#issuecomment-2170988381

Fix: All open() calls should be in a "with open() as x" statement
to ensure closing the file when exiting the block in any way.
Otherwise, use the new file_read_text() or file_write_text() functions
to read or write the whole utf-8 text file and closing it.

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:28 +01:00
KV
38ca3e2689 Provide more information when raising exception 2025-03-01 19:41:28 +01:00
Martin Rieder
ff6afac510 Update comment in src/wireviz/wireviz.py (#392)
Clarify all exceptions catched, including changes in #392

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:28 +01:00
Martin Rieder
d4902ce87d Catch also ValueError (#392)
In Windows might ValueError be raised instead of the already
catched exceptions in some cases (depending on the Python version)

Fixes point 2 of https://github.com/wireviz/WireViz/pull/318#pullrequestreview-1457016602
2025-03-01 19:41:28 +01:00
Martin Rieder
edc68cf9fb Catch OSError also with errno=None (#392)
In Windows might OSError(errno = None) be raised instead of the already
catched exceptions in some cases (depending on the Python version)

Fixes #391
2025-03-01 19:41:28 +01:00
kvid
018e3de68b Update src/wireviz/wireviz.py (#383)
Raising TypeError is better than assert. (Black reformatted)

Co-authored-by: Andreas Motl <andreas.motl@panodata.org>
2025-03-01 19:41:28 +01:00
KV
07555f2386 Explain unexpeced top-level type (#383)
Might help in reported issues like #342
2025-03-01 19:41:28 +01:00
Daniel Rojas
152f97cc7b Add non-empty label to avoid over-sized loops (#381)
Work-around to improve the #286 use case.
- https://github.com/wireviz/WireViz/issues/286#issuecomment-2094309143
- https://stackoverflow.com/questions/70996779/graphviz-edges-between-cells-in-the-same-html-table-are-too-long

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:28 +01:00
Daniel Rojas
f5c00fa31c Rename "sheetsize_default" to <!-- %template_sheetsize% --> (#380)
Fixes #377 (makes HTML output template placeholders more consistent)

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:28 +01:00
KV
860844574f Add link from syntax.md to HTML output templates (#371) 2025-03-01 19:41:28 +01:00
Daniel Rojas
b06c75bf2f Rename diagram_png_base64 to diagram_png_b64 (#371)
Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:28 +01:00
KV
7420718f10 Add HTML output templates README.md (#371)
Describe the HTML Output Templates, how they are specified,
and placeholder usage within these templates.
2025-03-01 19:41:27 +01:00
Daniel Rojas
812c4aa572 Avoid reading diagram file to embed unless used (#371)
Add local replacement_if_used() that call function to read the file
only when needed and append the return value as replacement.

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
6c30d0c40a Add HTML template placeholder for diagram_png_base64 (#371)
This will enable users to replace the SVG diagram with an embedded PNG,
that is an improved work-around when the SVG output from Graphviz
is not looking good. Suggested as work-around for Graphviz bug in
https://github.com/wireviz/WireViz/issues/175#issuecomment-2132206026

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
287c47a65e Add HTML template placeholders for filename (#371)
This will e.g. enable users to replace the SVG diagram with PNG,
that is needed as a work-around when the SVG output from Graphviz
is not looking good. Suggested as work-around for Graphviz bug in
https://github.com/wireviz/WireViz/issues/175#issuecomment-2132206026

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
ceaad3c39a Update APP_URL (#364)
The project was moved into the new organization 2023-05-30, but old
URLs are still working due to automatic redirects by GitHub.

https://github.com/wireviz/WireViz/issues/316#issuecomment-1568748914

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
32a62a6dd7 Use output_name as default title (#361)
The CLI handling code was redesigned for v0.4 and it seems the code
to assign a default title from v0.3.1 has been messed up. This bug
has not been triggered by build_examples.py due to it seems to call
the parse() function differently.

The output_name should be used as default title when present.

This will fix the #360 bug report.

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
KV
50b190113b Add package_data to to setup() call in setup.py (#347)
Specify all HTML files under templates folder
to be included as package data files.
2025-03-01 19:41:27 +01:00
Daniel Rojas
98e103a0af Handle OSError(errno=EINVAL) that might be raised in Windows (#346)
In Windows might OSError(errno=EINVAL) be raised instead of the already
catched exceptions in some cases (depending on the Python version).

Suggested fix posted by JarrettR in
https://github.com/wireviz/WireViz/issues/344#issuecomment-2113476151

Co-authored-by: kvid <kvid@users.noreply.github.com>
Co-authored-by: JarrettR <jrainier@gmail.com>
2025-03-01 19:41:27 +01:00
KV
e73e189131 Update setup.py with all tested python versions (#442) 2025-03-01 19:41:27 +01:00
KV
7d8999b45e Use ubuntu-latest for the supported Python versions (#442)
Use ubuntu-22.04 only for Python 3.7-3.8
by including them separately into the matrix.
2025-03-01 19:41:27 +01:00