Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make nalgebra optional #270

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

FreezyLemon
Copy link
Contributor

@FreezyLemon FreezyLemon commented Sep 4, 2024

Closes #196.

With this, users can remove the nalgebra dependency by changing:

[dependencies]
statrs = "0.17"

to

[dependencies]
statrs = { version = "0.17", default-features = false }

This will exclude all distributions depending on nalgebra from compilation (and the public API):

$ cargo public-api --no-default-features | grep -c nalgebra
0

There has been some talk in the linked issue about adding a feature for multivariate distributions, but I think for now it's simple enough to hide all nalgebra-dependent types behind this flag. If it becomes necessary, this can still be changed.

The new feature is enabled by default to avoid breakage when upgrading the package, but it probably wouldn't be a big deal to disable it by default either.

MSRV-related note: The dep: prefix requires 1.60.

The feature is enabled by default to avoid downstream breakage.
Users can disable the default features to remove the nalgebra dependency
at the cost of some distributions which rely on it.

The distributions requiring nalgebra are (currently):
- Dirichlet
- Multinomial
- MultivariateNormal
- MultivariateStudent
Copy link

codecov bot commented Sep 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.62%. Comparing base (aa276c8) to head (bc7d2b6).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #270   +/-   ##
=======================================
  Coverage   90.62%   90.62%           
=======================================
  Files          50       50           
  Lines       11583    11585    +2     
=======================================
+ Hits        10497    10499    +2     
  Misses       1086     1086           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@YeungOnion
Copy link
Contributor

Thanks for this, looks good!

@YeungOnion YeungOnion merged commit f7f2960 into statrs-dev:master Sep 5, 2024
8 checks passed
@FreezyLemon FreezyLemon deleted the make-nalgebra-optional branch September 5, 2024 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding Feature Flags and optional dependency?
2 participants