vega / vl-convert

Utilities for converting Vega-Lite specs from the command line and Python
BSD 3-Clause "New" or "Revised" License
84 stars 9 forks source link

Feature Request: make `vl-convert` binaries available with python library install #151

Open janrito opened 4 months ago

janrito commented 4 months ago

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

jonmmease commented 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)

janrito commented 4 months ago

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

jonmmease commented 4 months ago

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.

janrito commented 4 months ago

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()))"