Adding Feature Flags and optional dependency?
Closed this issue · 3 comments
Hi,
This is an amazing package with high quality code. However, I find it hard to include it in my work for the following reasons:
- I am trying to slim down my binary and if more statistical distributions are needed, I want to add them incrementally by adding more features.
- For my purpose, I almost never need multivariable distributions. I am already depending on Faer crate for linear algebra and I do not want another package for the same stuff. Again, I think nalgebra should be an optional dependency.
I am using statrs's code right now, which I copied. I am creditting the project. I mostly only need survival functions so I stripped down the code.
You can find my project here: https://github.com/abstractqqq/polars_ds_extension
I'd consider multivariate as a feature; nalgebra is a big compile compared to the rest of statrs, @henryjac thoughts?
@abstractqqq Are there not other options than per distribution features for slimming down binary size for your cdylib? I don't know much about it, but is there not a way to ensure your API can't expose certain parts of statrs
in a way that rustc
can figure out what doesn't need to be built into the binary?
Additionally, as I have minimal exposure to building a library to call from C, I'd deeply appreciate reading suggestions for my learning.
Thank you for responding. I am also not an expert in compilation. Still, I think nalgebra is only used in multivariate case and so multivariate can be behind a feature flag... Coming from Python, the pain of depending on both tensorflow and pytorch is just too much... It would be great if there is a "NumPy" in Rust and then it can be added as a dependency without question. But right now I think for higher dimension matrix and linear algebra, Faer is doing better than nalgebra...
FYI, PyO3 is a great project, and they have bindings for the numpy C API
As far as a decision on feature flag, I'm interested, but I want to get some other's perspectives as well.