Conversation
src/wireviz/wireviz.py
Outdated
| with open_file_read(args.prepend_file) as fh: | ||
| prepend = fh.read() | ||
| yaml_input = prepend + yaml_input | ||
| if ".png" in args.input_file: |
There was a problem hiding this comment.
Please consider using Pathlib's .suffix attribute for checking the file extension.
src/wireviz/wireviz.py
Outdated
| yaml_input = prepend + yaml_input | ||
| if ".png" in args.input_file: | ||
| yaml_input = read_yaml_from_png(args.input_file.replace('.png','')) | ||
| with open(args.input_file.replace('.png','_out.yaml'),'w') as fh: |
There was a problem hiding this comment.
Consider using wv_helper.py's open_file_read() and open_file_write() functions for file access to ensure UTF-8 encoding
|
I changed the |
|
A thought with regards to the implementation it might be worth either putting this capability behind a command line option, adding a command line option to not add the yaml data into the png (depending on the preference for weither to enable by default or not) or otherwise having a way to get an ouptut without the input embedded. The reasons I can think of for not wanting to add the input into the png are.
Another soloution for both of these would be to trim down/regenerate the yaml added to the png to only that which is needed to generate the diagram but that feels like it could be quite a complicated thing to do. |
|
@Tyler-Ward, really good points, I hadn't thought of those aspects.
A good thing to check, I just ran it with a 4KB prepend & 3.2KB diagram file. The ending png is 213KB with the data, or 211KB without the data. The size difference I'm assuming is the compressed state of the yaml, which results from the line:
I think that is a good point, I'll leave that up to @formatc1702 for comment. I can certainly implement that, but the questions would be:
|
|
The other formats, SVG & HTML also could incorporate these but those implementations are a bit more straightforward because they could just be added as comments if desired, and would be able to be just copy/pasted instead of needing to be read by the library. But since those will not have a compression option built-in, the file size will more likely be 1:1 increase by adding the data. |
Adjusted some typehints that linting was complaining about.
|
Update: Rebased on the latest dev version for easier merging |
|
@Tyler-Ward I just added a command line argument to 'conceal-input' so that this feature can be turned off. |
Is a solution for #233.