599 Commits

Author SHA1 Message Date
Daniel Rojas
2400193435 Add check for outdated connector attributes
Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
701815874c Remove references for unsupported output formats
Remove the references in the CLI help, but keep the placeholders elsewhere in the code as a TODO
2025-03-01 19:41:27 +01:00
Daniel Rojas
0fed30aa05 Apply suggestions from code review
Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
9d1700c4a0 Improve gracefulness when invoking wireviz.parse() without file_out
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>
2025-03-01 19:41:27 +01:00
Daniel Rojas
7077543600 Adjust tutorial08.yml 2025-03-01 19:41:27 +01:00
Daniel Rojas
fee05a71fc Do not allow negative qty_multiplier
Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
e756d62e50 Add unpopulated option to additional components qty multiplier
Co-authored-by: Jeremy Ruhland (hatchery) <jeremy@goopypanther.org>

squash me
2025-03-01 19:41:27 +01:00
Daniel Rojas
c376c491d4 Update syntax description 2025-03-01 19:41:27 +01:00
Daniel Rojas
d8c6230b85 Add warning about unconnected components 2025-03-01 19:41:27 +01:00
Daniel Rojas
a7e667e9b7 Update changelog
Use version from v0.4.1 master branch.
Fix missing link to v0.4.1 (L8) so it's not forgotten.
2025-03-01 19:41:27 +01:00
Daniel Rojas
400c242c90 Move parse_number_and_unit() and NumberAndUnit definition to wv_utils.py
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)
2025-03-01 19:41:27 +01:00
KV
6f6235ad25 Split out class AdditionalBomItem from AdditionalComponent
https://github.com/wireviz/WireViz/pull/251#discussion_r1359055105

No output changed for any examples/tutorial/tests input.
2025-03-01 19:41:27 +01:00
KV
51f730f28c Rename fill_partnumbers() to __post_init__()
https://github.com/wireviz/WireViz/pull/251#discussion_r1358992408
2025-03-01 19:41:27 +01:00
KV
bc01e7c59e Add PN string in gv_additional_component_table() 2025-03-01 19:41:27 +01:00
KV
e4ecf97c1a Avoid wrong function name in warnings 2025-03-01 19:41:27 +01:00
KV
f5f3842fa5 Handle also int colors in colon separated string
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.
2025-03-01 19:41:27 +01:00
KV
c47de6be53 Include "tests" folders in the build tool groups
Allow absent "prefix" in group entries to simplify the code
2025-03-01 19:41:27 +01:00
KV
d0e25864b3 Change BOM output file extension from .bom.tsv to .tsv
Complementary changes to the commit with the same title
earlier in the same PR. Avoid refering to the old filenames.
2025-03-01 19:41:27 +01:00
KV
e7902e8f8e Change version string to comply with PEP440
It seems "-dev" (normalized to ".dev") should only be directly followed
by a number for different deveopment releases of the same version.
See full description: https://peps.python.org/pep-0440/
2025-03-01 19:41:27 +01:00
Daniel Rojas
c33a19708c Refactor code (squashed commit)
Refactor connector node generation

Further refactor connector node generation

Rebuild demos

Generate gauge string inside Cable object

WIP: refactor cable node generation

Implement HTML indentation

WIP

More WIP

Remove old stuff, slightly simplify code

Outsource `gv_pin_table()`, simplify padding

Add TODOs

Outsource `set_dot_basics()` and `apply_dot_tweaks()`

Make setting HTML tag attributes easier through `kwargs`

Fix and simplify bgcolor logic

Reactivate cable edge generation

Outsource `gv_edge_wire()`

Make connecting things more object-oriented

Alphabetize HTML tags, improve bgcolor rendering

Make mates object-oriented

Run `autoflake -i`

Run `autoflake -i --remove-all-unused-imports`

Streamline assignment of ports to simple connectors

Implement color objects

Use color objects in WireViz

Re-sort `wv_colors.py`

Make green color darker

Break longer lines not caught by `black`

because they were unbroken strings or comments

Make variable name more expressive

Apply dot tweaks last

Remove unused line

Improve subclassing of components, prepare for BOM refactoring

Clean up

Include nested additional components in BOM

do not add autogenerated designators to BOM

Improve BOM generation (TODO: wires from a bundle)

Prepare `harness.populate_bom()`

Change `description` to `type` in additional BOM item YAML

Define CLI epilog str in single statement

Rename modules, adjust imports, move `build_examples.py`

Restructure and update `.gitignore`

Clarify `wireviz.parse()` input types

Implement BOM population (missing: qty multipliers)

Make `pin_objects` and `wire_objects` dictionaries

Compute qty's of additional components (WIP)

Add qty test file

Adapt `tutorial08.yml` (remove `unit` field)

Add `tabulate` to dependency list (might remove later if not needed)

Sort BOM by category, assign BOM IDs

Rename `Options.color_mode` to `.color_output_mod` for consistency

Change BOM output file extension from `.bom.tsv` to `.tsv`

Implement BOM bubbles

Stop recursive nesting of additional components

Add BOM bubble to additional component list (WIP)

Fix gauge conversion

Fix line breaks in code

Optimize BOM bubble geometry

Implement pin color output

Small issue: GraphViz warning
```
Warning: table size too small for content
```

Add some test files to `tests/` directory

Update test files

Allow multiple colors for components

Implement multiple colors for components, improve multicolor table rendering

Fix color cell implementation

Fix node background color rendering

Add test file for node and title bgcolors

WIP: BOM modes

Add TODO for empty connector pin tables

Comment out BOM modes (WIP) and BOM bubbles

Resume work on BOM

Include part number info in BOM table

Fix BOM output in TSV and HTML

Add bundles' wires' part number info to BOM

Add TODOs

Implement bundle part number rendering

Improve conductor table rendering

Fix additional component BOM table layout

Disable CLI BOM output

Add suggestions from #246

Add suggestions from #186

Add .vscode/ to .gitignore

Fix PyLance problems

Update interim version number

Fix zero-size cell for simple connectors without type

Implement additional parameters dict for components

Implement note for additional components

Thicken additional component table

Add placeholder for add.comp. PN info

Apply black
2025-03-01 19:41:27 +01:00
Daniel Rojas
2f737c2371 Prepare for refactoring (squashed commit)
no diff should ocurr as a result of the refactoring

Add `metadata.title` to `demo01.yml`

to avoid diffs later when calling via CLI

Add temporary loop to `demo01`

for debugging purposes

Add `cleanup.sh` (maybe move/delete later? or add commit hook?)

Deprecate Python 3.7, add Python 3.10

Add `devtools.txt`

Add `pyan` to `devtools.txt`

Add sample use to `devtools.txt`
2025-03-01 19:41:27 +01:00
KV
e4fe099f8c 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-02-15 00:11:55 +01:00
KV
7cf9244af1 Update setup.py with all tested python versions (#442) 2025-01-27 19:26:58 +01:00
KV
6c87c27cfc 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-01-27 19:26:58 +01:00
Martin Rieder
336bea8b0d Update deprecated GitHub Actions and add Python versions (#408)
Running 6 different Python versions (3.7 to 3.12) in parallel now.
NOTE: This is in conflict with #309, but can be resolved easily in a later PR.

GitHub Actions require an update:
- actions/upload-artifact@v3 is scheduled for deprecation on November
30, 2024.
- Similarly, v1/v2 are scheduled for deprecation on June 30, 2024. 
- Updating this comes with a breaking change in upload-artifact@v4:

Uploading to the same named Artifact multiple times.

Due to how Artifacts are created in this new version, it is no longer
possible to upload to the same named Artifact multiple times. You must
either split the uploads into multiple Artifacts with different names,
or only upload once. Otherwise you will encounter an error.

The artifact .zip files therefore have the python version added to
their name.
2025-01-12 19:38:50 +01:00
Martin Rieder
e8c482e94e
Update deprecated GitHub Actions and add Python versions (#408)
Running 6 different Python versions (3.7 to 3.12) in parallel now.
NOTE: This is in conflict with #309, but can be resolved easily in a later PR.

GitHub Actions require an update:
- actions/upload-artifact@v3 is scheduled for deprecation on November
30, 2024.
- Similarly, v1/v2 are scheduled for deprecation on June 30, 2024. 
- Updating this comes with a breaking change in upload-artifact@v4:

Uploading to the same named Artifact multiple times.

Due to how Artifacts are created in this new version, it is no longer
possible to upload to the same named Artifact multiple times. You must
either split the uploads into multiple Artifacts with different names,
or only upload once. Otherwise you will encounter an error.

The artifact .zip files therefore have the python version added to
their name.
2024-10-14 19:19:49 +02:00
Daniel Rojas
1c4fd68a2e
Release v0.4.1 v0.4.1 2024-07-13 13:23:11 +02:00
Daniel Rojas
542864658f Add v0.4.1 release date 2024-07-13 13:16:08 +02:00
Daniel Rojas
a57c68ae22 Rebuild examples 2024-07-13 13:15:00 +02:00
Daniel Rojas
c73738e041 Bump version to 0.4.1 2024-07-13 13:10:31 +02:00
KV
73f56b2efc Apply black *.py ../../setup.py
black==23.3.0
2024-07-12 19:05:12 +02:00
KV
828de3f118 Apply isort *.py ../../setup.py
isort==5.11.5
2024-07-12 19:04:29 +02:00
KV
38ac23747d Update changelog a bit more 2024-07-12 18:36:35 +02:00
KV
bde949b7d4 Update changelog 2024-07-08 23:19:52 +02:00
KV
ae03bd60e5 Add TODOs about utf-8 encoding/charset (#395) 2024-07-07 16:16:56 +02:00
KV
19cdff1774 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.
2024-07-07 16:16:56 +02:00
KV
ee1bd7801e Provide more information when raising exception 2024-07-05 18:16:34 +02:00
Martin Rieder
f2a1aa8856 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>
2024-07-05 18:16:34 +02:00
Martin Rieder
0e8ab7a668 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
2024-07-05 18:16:34 +02:00
Martin Rieder
42d10dfab4 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
2024-07-05 18:16:34 +02:00
kvid
858b2664db Update src/wireviz/wireviz.py (#383)
Raising TypeError is better than assert. (Black reformatted)

Co-authored-by: Andreas Motl <andreas.motl@panodata.org>
2024-07-05 18:23:32 +02:00
KV
5cedba9def Explain unexpeced top-level type (#383)
Might help in reported issues like #342
2024-07-05 18:16:34 +02:00
KV
6d772cf697 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
2024-07-05 18:16:34 +02:00
KV
c997bfe19b Rename "sheetsize_default" to <!-- %template_sheetsize% --> (#380)
Fixes #377 (makes HTML output template placeholders more consistent)
2024-07-05 18:16:34 +02:00
KV
795f3321a3 Update changelog (WIP) 2024-07-05 18:16:34 +02:00
Daniel Rojas
eed00e1322 Add changelog for v0.4.1 (WIP) 2024-07-05 18:16:34 +02:00
Daniel Rojas
088c6038c7 Add documentation on template separator character 2024-07-05 18:16:34 +02:00
KV
6488eb582b Avoid Graphviz error when hiding all pins (#375)
Fixes #257
2024-07-05 18:16:34 +02:00
KV
668ba72975 Avoid decimal point and trailing zero for integer BOM quantities (#374)
Fixes #340
2024-07-05 18:16:34 +02:00
KV
177eb9e387 Add link from syntax.md to HTML output templates (#371) 2024-07-05 18:23:11 +02:00