Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wireviz version to latest #1779

Open
rwarren opened this issue Sep 15, 2024 · 3 comments
Open

Update wireviz version to latest #1779

rwarren opened this issue Sep 15, 2024 · 3 comments

Comments

@rwarren
Copy link

rwarren commented Sep 15, 2024

Kroki currently uses wireviz v0.3.3 (which is not even an official version... see below). The latest version is v0.4.1. Updating would be very nice.


More detail...

The wireviz version currently in use is v0.3.3, per this line:

ARG WIREVIZ_VERSION="0.3.3"

Curiously, v0.3.3 is not even an official wireviz tag!? Officail Wireviz versions jump from v0.3.2 to v0.4, so I'm not sure how v0.3.3 works.

The latest version of wireviz is v0.4.1, and it contains some significant, and long awaited, features.

NOTE: You can't even run basic wireviz tutorials with the v0.3.x version included with Kroki! For example the syntax for this wireviz tutorial currently fails with the syntax below (also available at the kroki.io renderer here):

connectors:
  X1:
    pinlabels: [+12V, GND, GND, +5V]
    type: Molex 8981
    subtype: female
  F1:
    style: simple
    type: Crimp ferrule
    subtype: 0.5 mm²
    color: OG # optional color

cables:
  W1:
    category: bundle # bundle
    length: 0.3
    gauge: 0.5 mm2
    colors: [YE, BK, BK, RD] # custom colors, wirecount is implicit

connections:
  -
    - F1. # a new ferrule is auto-generated for each of the four wires
    - W1: [1-4]
    - X1: [1-4]

The problem is the relatively new syntax in connections: with F1.. Drop the . and it renders... but not as it should.

@ggrossetie
Copy link
Member

ggrossetie commented Sep 15, 2024

We are using a fork: https://github.com/yuzutech/WireViz mainly because we are consuming wireviz as a binary CLI (and not as a Python library).

$ echo 'yaml definition' | wireviz -f svg - -o -

My pull request didn't get merged (wireviz/WireViz#321) but it seems that it's now possible to specify an output file. Not sure if outputting to stdout and reading the content from stdin are supported though...

@sgorsh
Copy link

sgorsh commented Oct 31, 2024

I've created Python wrapper for WireViz with no changes to existing WireViz files:
https://github.com/sgorsh/WireViz/

Binary for Kroki can be downloaded here:
https://github.com/sgorsh/WireViz/releases/tag/v0.4.1-kroki

You can merge this into https://github.com/yuzutech/WireViz/. This method should allow seamless upgrade of WireViz. I would create a pull request but I'm not familiar enough with CI scripts for your repo. Wrapper also supports WireViz version output with wireviz -v.

Here's a test output with local Kroki server and WireWiz v0.4 features (https://github.com/sgorsh/WireViz/blob/master/examples/ex12.yml):
image

@ggrossetie
Copy link
Member

@sgorsh That's neat, thanks!

Ideally, I would like to delete my fork and use the upstream version directly. Could you please open an issue on the upstream project to gradually implement this features upstream?

Would it be possible to use the pip package instead of copying/forking the project? As far as I understand, all the custom code is inside `wireviz_kroki.py ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants