# Making my own first project/package - how to update/test dependencies

**URL:** <https://discourse.julialang.org/t/making-my-own-first-project-package-how-to-update-test-dependencies/27338>\
**Category:** New to Julia\
**Tags:** question, package\
**Created:** [August 8, 2019, 10:02pm UTC](https://discourse.julialang.org/t/making-my-own-first-project-package-how-to-update-test-dependencies/27338 "2019-08-08T22:02:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tue](https://avatars.discourse-cdn.com/v4/letter/t/4491bb/32.png) [@tue](https://discourse.julialang.org/u/tue)\
**Post date:** [August 8, 2019, 10:02pm UTC](https://discourse.julialang.org/t/making-my-own-first-project-package-how-to-update-test-dependencies/27338/1 "2019-08-08T22:02:29Z")

</div>

Hi I have made the following the following code:  
[https://github.com/tueboesen/LapNet](https://github.com/tueboesen/LapNet)  
Which have quite a few dependencies in it. The problem is that these dependencies are not reflected in the Project.toml, which only contains Flux (Which I initially added when I started the project and activated it)

What I would like to do now is to somehow run this code in just the packages environment, so it can tell me exactly which dependencies it is missing, so I can go in and add those to the project.toml

Any other suggestions for building my first project on things I should consider or change are very welcome!

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [August 9, 2019, 2:11am UTC](https://discourse.julialang.org/t/making-my-own-first-project-package-how-to-update-test-dependencies/27338/2 "2019-08-09T02:11:13Z")

</div>

Could you explain more why the dependencies are missing?  
I am assuming you did `Pkg.add` for them (in the right environment)?

As for dealing with unregistered dependencies, I am not sure what the answer is. I have asked related questions twice and you may find [this](https://discourse.julialang.org/t/tracking-changes-for-unregistered-packages/27289) and [this](https://discourse.julialang.org/t/packages-for-my-own-code/) useful.

I ended up writing up my own understanding (imperfect!) [here](https://lhendricks.org/julia_notes.pdf) (corrections welcome).

---

<div class="post-metadata">

**Author:** ![tue](https://avatars.discourse-cdn.com/v4/letter/t/4491bb/32.png) [@tue](https://discourse.julialang.org/u/tue)\
**Post date:** [August 9, 2019, 3:25am UTC](https://discourse.julialang.org/t/making-my-own-first-project-package-how-to-update-test-dependencies/27338/3 "2019-08-09T03:25:58Z")

</div>

I added them with Pkg.add, but just into my base Julia installation. (As in I didn’t activate the project first)  
The problem is that now even if I activate the project and instantiate it, it will run just fine on my Julia base. I can’t seem to find a way to run it in it’s on instantiated environment.

I read your posts and while it is similar, yours is significantly more advanced issues at this point. However I found your notes very illuminating, since I have struggled with many of the same things. I didn’t manage to figure out how to use revise or the debugger, but maybe I should give them both another go. (debugger keeps freezing on me whenever I use it, and revise just didn’t seem all that usefull)

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [August 9, 2019, 5:54am UTC](https://discourse.julialang.org/t/making-my-own-first-project-package-how-to-update-test-dependencies/27338/4 "2019-08-09T05:54:16Z")

</div>

Just `pkg> activate` your project and then `pkg> add` the dependencies there.

As for testing, there are various packages to set up a package structure using templates, with support for continuous integration using services like Travis. Eg

> **[GitHub - JuliaCI/PkgTemplates.jl: Create new Julia packages, the easy way](https://github.com/JuliaCI/PkgTemplates.jl)**
>
> Create new Julia packages, the easy way. Contribute to JuliaCI/PkgTemplates.jl development by creating an account on GitHub.

> **[GitHub - tpapp/PkgSkeleton.jl: Generate Julia package skeletons using a...](https://github.com/tpapp/PkgSkeleton.jl)**
>
> Generate Julia package skeletons using a simple template system - GitHub - tpapp/PkgSkeleton.jl: Generate Julia package skeletons using a simple template system

(disclaimer: the last one is mine)

---

<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:** [August 12, 2019, 3:34pm UTC](https://discourse.julialang.org/t/making-my-own-first-project-package-how-to-update-test-dependencies/27338/5 "2019-08-12T15:34:44Z")

</div>

There seems to be a misunderstanding regarding **environment stacks**.

In general, the **active environment** is _not_ the only environment that you can load packages from. The active environment is the environment that is _modified_ when you run `Pkg` operations.

The variable `LOAD_PATH` determines the complete set of packages that are available at any given moment i.e. the environment stack. By default, environment stack looks like this:

```julia
active environment (top of stack)
---
default (or "base") environment
---
stdlibs (bottom of stack)

```

You can see the concrete locations with `Base.load_path()`.

@tue I think you are looking to isolate the active environment? If so, you can do

```julia
empty!(LOAD_PATH)
push!(LOAD_PATH, "@stdlib")
push!(LOAD_PATH, "@")

```

This will make it so you can only load stdlibs or packages from your active environment.

---

<div class="post-metadata">

**Author:** ![tue](https://avatars.discourse-cdn.com/v4/letter/t/4491bb/32.png) [@tue](https://discourse.julialang.org/u/tue)\
**Post date:** [August 12, 2019, 10:05pm UTC](https://discourse.julialang.org/t/making-my-own-first-project-package-how-to-update-test-dependencies/27338/6 "2019-08-12T22:05:23Z")

</div>

I think that is exactly what I’m looking for. Just one quick question before I do this, would my environment be set back to normal when I restart Julia or how would I get it back to normal afterwards again?

---

<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:** [August 13, 2019, 3:01am UTC](https://discourse.julialang.org/t/making-my-own-first-project-package-how-to-update-test-dependencies/27338/7 "2019-08-13T03:01:02Z")

</div>

Yeah, this is only per process (like any regular variable). Restarting julia will reset `LOAD_PATH`.

But a more direct way is:

```julia
LOAD_PATH_BACKUP = copy(LOAD_PATH)
# modify and use modified LOAD_PATH here
# now reset
empty!(LOAD_PATH)
for x in LOAD_PATH_BACKUP
    push!(LOAD_PATH, x)
end

```
