Avoid unnecesary Statistics import

Hello!

I am using a function from the integrated stdlib Statistics in my package. Do I have to check Statistics as a dependency explicitly? Shouldn’t it always be present because it is shipped with Julia?

The message I get everytime I precompile the package is this:

Warning: Package PPS does not have Statistics in its dependencies:
│ - If you have PPS checked out for development and have
│   added Statistics as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with PPS
└ Loading Statistics into PPS from project dependency, future warnings for PPS are suppressed.

What should I do?

Thanks!

Yes, you have to add standard libraries as a dependency.

It is not unnecessary if you use it in your code. Yes it is part of the standard library, but its functionality is only available after you load it via using Statistics. Since it is part of the standard library, it is not really contributing to dependency bloat.

Thank you both!

I was trying to avoid bloat indeed, but now it seems it is the way to go. Thanks again!

I have the same issue and already load Statistics:

module mypackage

using Dates
using Statistics

include(“source1.jl”)
end

In mytest.jl (located in the project folder as shown) I import mypackage:

using Revise
using mypackage

mypackage/
├─ src/
│ ├─ mypackage.jl
│ ├─ source1.jl
├─ .gitignore
├─ README.md
├─ mytest.jl

With the project directory active, you have to ]add Statistics

1 Like