Please don't download binary into user's home directory in `build.rs`
Here: https://github.com/plotly/plotly.rs/blob/main/plotly_kaleido/build.rs
I think this is unhygienic. It is surprising to me that building something would cause files to be added to my home directory. This also breaks when building in a sandboxed environment (which is how I found out).
Plus, it is downloading something that is not strictly needed for the build process. And it is also not going to achieve what I assume is your goal. What if I build on one machine then ship the binary to run somewhere else?
Valid point. This has come up before also in mistral-rs
Will look into it when I have more time available.
Just as a side note, this specific issues is in context of the kaleido feature. If you do not use it, my advice is to build without it. Building without it avoids all the issues you have mentioned.
I am also not a big fan of kaleido to be honest since as you highlight, it introduces an external dependency. I don't use it in my own projects for exactly that reason. That functionality is something I miss in plotly itself and still hope for the ppl at plotly to come up with a better solution for that.
@yshui
I have changes the way Kaleido is downloaded/installed at compile time.
I introduced a new feature flag kaleido_download that allows for opt-in automatic download and install of Kaleido at build time. If only the kaleido feature is enabled, the user is required to manually install Kaleido and provide the path to the installation directory using the environment variable KALEIDO_PATH.
I have not changed the location where Kaleido is installed when kaleido_feature is enabled for a couple of reasons.
- on Linux the preferred locations for installing external stuff would have been
/optor/use/local, both requiring sudo privileges. That would have been ugly in anbuild.rsscript IMO. - also on most Linux-es, an option would have been
~/bin, however that is no different in my perspective than~/.configHence I decided to leave it as is. Whomever dislikes the path, can decide to install Kaleido manually and use the environment variable approach.
Currently this new setup is available on the main branch. I plan to make a new release in the upcoming weeks.