Open janrito opened 4 months ago
Thanks for the suggestion @janrito. Yeah, we could add Python CLI interface to the vl-convert-python
package, copying the API of native CLI.
Just in case it wasn't obvious, we do include the CLI binaries as GitHub release artifacts (https://github.com/vega/vl-convert/releases/tag/v1.2.3)
i wonder if you can take an approach like this https://simonwillison.net/2022/May/23/bundling-binary-tools-in-python-wheels/
https://github.com/ziglang/zig-pypi/blob/main/README.pypi.md
I don't think we'd want to double the size of the package by including a separate binary build of the CLI version of vl-convert. But I think we could include a Python CLI interface (e.g. using click) that would provide the same functionality as the binary vl-convert CLI.
This is what I'm doing in the meantime:
#!/bin/sh
set -x -e
# file: vl2png.sh
# Reads a vega-lite spec from stdin and writes a PNG to stdout
# It is equivalent to:
# vl-convert vl2png
python -c "import sys; import vl_convert; sys.stdout.buffer.write(vl_convert.vegalite_to_png(sys.stdin.read()))"
It would be really nice if we could install the python library and have the
vl-convert
utilities available without having to have cargo and rust installed