WireViz icon indicating copy to clipboard operation
WireViz copied to clipboard

[feature] ability to import external yaml files for sharing connector and cable definitions

Open gmkado opened this issue 4 years ago • 27 comments

I would love to be able to have all my connector definitions in a single file and include it into my cable drawing yamls. This would allow for things like a shared "library" of connectors that can be shared across a company.

From my searches online there are ways to do this with pyyaml:

  • https://stackoverflow.com/questions/528281/how-can-i-include-a-yaml-file-inside-another
  • https://gist.github.com/joshbode/569627ced3076931b02f
  • https://pypi.org/project/pyyaml-include/

I tried adding this code to the wireviz.py dev build but keep running into yaml syntax errors. My knowledge of yaml parsing is pretty limited.

gmkado avatar Mar 04 '21 22:03 gmkado

Thank you for your effort, but please also try including your library using the existing command line option --prepend-file. Does that solve your issue? If not, please describe use cases where more or different features are required.

kvid avatar Mar 05 '21 00:03 kvid

oops, should have read the docs better. Thanks this does the trick!

gmkado avatar Mar 09 '21 01:03 gmkado

Hmm I'm going to re-open this because the --prepend-file leaves something to be desired. Ideally you would be able to keep common connector and cable definitions in a separate folder and point to it. But doing this breaks paths to image files referenced by the definitions.

gmkado avatar Mar 12 '21 00:03 gmkado

Hmm I'm going to re-open this because the --prepend-file leaves something to be desired. Ideally you would be able to keep common connector and cable definitions in a separate folder and point to it. But doing this breaks paths to image files referenced by the definitions.

The PR #189 already implements relative image paths differently, but your use case is still an issue and I describe the root cause in https://github.com/formatc1702/WireViz/pull/189#discussion_r593457127.

kvid avatar Mar 12 '21 22:03 kvid

There has been some progress in #189 regarding this issue, @gmkado please have a look and feel free to post feedback.

17o2 avatar Oct 02 '21 16:10 17o2

What about having something like this:

templates:
  includes:
    - includes/DB9.yaml
    - includes/molex.yaml
    - include/inline_headers.yaml

This would make it explicit that this specific harness file depends on a list of "libraries"

Thanks for your work on this tool! It's really great at making harness drawings more efficient!

liambeguin avatar Nov 17 '21 15:11 liambeguin