# Packaging best practices for adding dependencies

**URL:** <https://discourse.julialang.org/t/packaging-best-practices-for-adding-dependencies/16793>\
**Category:** General Usage\
**Created:** [October 25, 2018, 5:03pm UTC](https://discourse.julialang.org/t/packaging-best-practices-for-adding-dependencies/16793 "2018-10-25T17:03:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sam1](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@sam1](https://discourse.julialang.org/u/sam1)\
**Post date:** [October 25, 2018, 5:03pm UTC](https://discourse.julialang.org/t/packaging-best-practices-for-adding-dependencies/16793/1 "2018-10-25T17:03:11Z")

</div>

Hi, I’m wondering whether it’s necessary or desirable to add dependencies which are in the standard library?  
The [example](https://docs.julialang.org/en/v1/stdlib/Pkg/#Adding-dependencies-to-the-project-1) in the docs shows adding Random to a project.toml but is this necessary?

1. Couldn’t you just add an import Random to the Module.jl without adding to [deps]?
2. Are there any downsides to adding everything? Over-specifying dependencies.
3. Should I add Base to deps if I import it and extend :+, :-, abs for a type?

---

<div class="post-metadata">

**Author:** ![00vareladavid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00vareladavid/32/23521_2.png) [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Post date:** [October 26, 2018, 12:07am UTC](https://discourse.julialang.org/t/packaging-best-practices-for-adding-dependencies/16793/2 "2018-10-26T00:07:03Z")

</div>

To the best of my knowledge:

1. The code loading stuff checks all `import`ed 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.
2. 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 `add A`. `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.
