Hi, I’m wondering whether it’s necessary or desirable to add dependencies which are in the standard library?
The example in the docs shows adding Random to a project.toml but is this necessary?
- Couldn’t you just add an import Random to the Module.jl without adding to [deps]?
- Are there any downsides to adding everything? Over-specifying dependencies.
- Should I add Base to deps if I import it and extend :+, :-, abs for a type?
To the best of my knowledge:
- The code loading stuff checks all
imported packages against the
Project.toml file. Another way to think about it is that a package’s
Project.toml file is the “source of truth” defining its dependencies.
- You don’t have to add everything, just the immediate dependencies (e.g. if you need to
import A and
A depends on
B: you just need to
Pkg will take care of handling recursive dependencies.
The long term plan is for standard libraries to behave like regular packages as much as possible.