Closed davidpham87 closed 3 months ago
Hi @davidpham87, glad Kaleido has been helpful for you.
The core of Kaleido is a command-line C++ application, but it's not very user friendly. It inputs JSON to standard in and outputs JSON to standard out. There's some more info at https://github.com/plotly/Kaleido/wiki/Language-Wrapper-Architecture.
One thing that wouldn't be too hard would be to add a Python-based CLI wrapper using click. Would this approach work for you? If so, we would need to decide whether to add it to the kaleido
or plotly
Python packages.
Another option would be to write a pure shell wrapper for the C++ executable using jq
. This would avoid introducing a Python dependency, but I'm much less likely to tackle this myself.
Hi @jonmmease
Thanks a lot for your swift answer!
My use case would be to either give the path of a json plotly configuration or to inline it as well. I would embed it into bigger programs written in Clojure/ClojureScript/NodeJs. It would nice to have the C++ executable exposed at least, so that we could experiment and is also the most simple (in the sense of not entangled and could be composed in many other applications). The python wrapper is probably the easiest solution, and would already help the community.
Hi @davidpham87,
Ok, if your goal is to programmatically call Kaleido from another programming language, then the current command-line JSON interface may actually be what you want to use. You can download the C++ executable (without Python dependencies) from the release page (https://github.com/plotly/Kaleido/releases/tag/v0.0.1). Here you want the kaleido_*-0.0.1.zip
files.
Then you can call this executable as a subprocess of nodejs and communicate with it over standard-in/standard-out according to https://github.com/plotly/Kaleido/wiki/Language-Wrapper-Architecture. This has already been done by the plotly rust library (https://github.com/igiagkiozis/plotly/blob/master/plotly_kaleido/src/lib.rs), and there is a WIP wrapper for the plotly F# library at https://gist.github.com/jonmmease/2616440ebea523b83f25100f5c6a9a7f.
You're welcome to do this as a one-off for your application, but it would also be great if you were interested in creating a standalone kaleido npm package that bundles the C++ executable for each platform and includes the wrapper for communicating with it.
Since you mentioned NodeJS and ClojureScript I assume you're mostly interested in the JavaScript ecosystem, but if you're also interested in the Clojure JVM ecosystem then I wanted to mention that the Plotly Scala library is considering Kaleido integration in https://github.com/alexarchambault/plotly-scala/issues/207. In that case it might make sense to work together with them to create a pure Java wrapper that is easy to call from Scala or Clojure.
Hope that helps!
Hi @jonmmease
Thanks for your answer. I will double check all your solutions. Thanks a lot!
Thanks for your interest in Kaleido. We are currently working on an overhaul that might address your issue - we hope to have news in a few weeks and will post an update then. Thanks - @gvwilson
Hello,
Thanks a lot for the tool. I wondered if there was a CLI version available?
Best regards, David