Three additions to support interactive/notebook-style harness building:
- Graph cache invalidation: _invalidate_graph() called from all mutating
methods so svg/png output reflects latest state after mutations
- bom_list_dicts(): JSON-serializable BOM export as list of dicts
- parse(harness=, populate_bom=): append YAML fragments to existing
harness for cell-by-cell building with deferred BOM population
Templates persist on the Harness object across parse() calls so
component definitions in one fragment are available to connections
in later fragments.
Includes 24 new tests covering all three features plus full incremental
workflow simulation. All 122 tests pass.
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.
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.
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.
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.
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
- 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
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.
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.
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.
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>
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>
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>
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>
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>
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>
This happened to be a regression for WireViz-Web [1], which aims to do
as much in memory as possible.
[1] https://github.com/daq-tools/wireviz-web.
kvid rebased and mixed original commit with similar change by Daniel Rojas
Co-authored-by: Andreas Motl <andreas.motl@panodata.org>
Co-authored-by: kvid <kvid@users.noreply.github.com>
Remove unused attribute
Remove unused `&&` in GitHub workflow
Remove duplicate `category` attribute
Removed from `Connector` class since it is already defined in the `Component` superclass.
Remove unnecessary casting of `int` to `float`
https://github.com/wireviz/WireViz/pull/251#discussion_r1359000766
Continue work on BOM handling (WIP)
Bug: 0x112233:0x445566 in YAML input didn't convert such colors
to #112233:#445566 and the strings where just passed as uppercase
to the .gv file. Hence Graphviz printed warnings about unknown
colors and used black as color instead.
Add test for int as string. Re-ordered if statements to give an
exception when a color has an unknown type.