# How to use Juno and Julia to develop a project?

**URL:** <https://discourse.julialang.org/t/how-to-use-juno-and-julia-to-develop-a-project/39225>\
**Category:** General Usage\
**Created:** [May 10, 2020, 1:38pm UTC](https://discourse.julialang.org/t/how-to-use-juno-and-julia-to-develop-a-project/39225 "2020-05-10T13:38:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laszlo\_Nagy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laszlo_nagy/32/14565_2.png) [@Laszlo\_Nagy](https://discourse.julialang.org/u/Laszlo_Nagy)\
**Post date:** [May 10, 2020, 1:38pm UTC](https://discourse.julialang.org/t/how-to-use-juno-and-julia-to-develop-a-project/39225/1 "2020-05-10T13:38:07Z")

</div>

I’m about to write my first (test) project with Julia. I have installed Juno and , because I saw that is the “standard” for development. I have entered examples from the official Julia documentation into a REPL prompt so far. Now I need some help to make this more productive.

I’m looking for these functions in Juno:

- Specify a “project”. Not just a plain directory, but a place where environment variables and “run configurations” can be setup etc. In other IDEs (eclipse, pycharm, intellij etc.) there are special files that describe the “current workspace” and its configuration. I’m looking for the same thing in Juno.
- A button or a shortcut to start a (previously configured) “run configuration”. For example, let’s say I’m working on a web service, and there is a main entry point for the project called “run.jl”. How can I create a run configuration/shortcut that I can activate when I want to compile and start it?
- When an exception is thrown, ideally I should be able to click on the source code references on the traceback and navigate to the source code. Is this possible?
- It is not entirely related, but I wonder if I can assign my own shortcuts to functions? For example, I have noticed a “format code” menu in Juno. It works fine, but it does not have a shortcut.

---

<div class="post-metadata">

**Author:** ![pixel27](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pixel27/32/8902_2.png) [@pixel27](https://discourse.julialang.org/u/pixel27)\
**Post date:** [May 10, 2020, 2:06pm UTC](https://discourse.julialang.org/t/how-to-use-juno-and-julia-to-develop-a-project/39225/2 "2020-05-10T14:06:53Z")

</div>

I’m assuming when you say Juno you mean you installed uber-juno in Atom.

1. Run Julia in the parent directory of your “project” folder. Enter “`] generate MyProject`” (Don’t miss the square bracket at the front. This will create a folder called “MyProject” and create the initial Julia project files in it. Open this folder in Atom.
2. Not sure if there is a way to do this. My projects have an “master” file that I run in Julia. It includes all the other files that it needs to do whatever the task is. So when I want to start my program I open that file and Click “Run All” or hit Ctrl+Shift+Enter.
3. Yes you can click on a file path displayed in REPL and Atom will open that file and jump to the line number.
4. Creating shortcuts in Atom: [Basic Customization](https://flight-manual.atom.io/using-atom/sections/basic-customization/#customizing-keybindings)

---

<div class="post-metadata">

**Author:** ![Laszlo\_Nagy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laszlo_nagy/32/14565_2.png) [@Laszlo\_Nagy](https://discourse.julialang.org/u/Laszlo_Nagy)\
**Post date:** [May 10, 2020, 2:13pm UTC](https://discourse.julialang.org/t/how-to-use-juno-and-julia-to-develop-a-project/39225/3 "2020-05-10T14:13:37Z")

</div>

Thank you. About the second point: running a file and running a run configuration is not the same. Imagine a program that has command line options, and uses environment variables etc. A run configuration can run a command, with a given set of environment variables, with the current directory set to a given value etc.

So yes, this is a bit different than just running a single file, but I can find out something around this. 🙂

---

<div class="post-metadata">

**Author:** ![pixel27](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pixel27/32/8902_2.png) [@pixel27](https://discourse.julialang.org/u/pixel27)\
**Post date:** [May 10, 2020, 2:25pm UTC](https://discourse.julialang.org/t/how-to-use-juno-and-julia-to-develop-a-project/39225/4 "2020-05-10T14:25:25Z")

</div>

Yeah I’m not sure how to do that dynamically. That would imply passing parameters to Julia when it’s started in the REPL. You could probably set those parameters under the plugin’s configuration but that would apply to all projects and would not be simple to change if you are jumping back and forth between two different set of arguments.

---

<div class="post-metadata">

**Author:** ![Laszlo\_Nagy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laszlo_nagy/32/14565_2.png) [@Laszlo\_Nagy](https://discourse.julialang.org/u/Laszlo_Nagy)\
**Post date:** [May 10, 2020, 3:38pm UTC](https://discourse.julialang.org/t/how-to-use-juno-and-julia-to-develop-a-project/39225/5 "2020-05-10T15:38:35Z")

</div>

I have created a new project with `] generate MyProject` and opened its directory with Juno. The problem I’m having is that whenever Juno starts a new julia REPL, it is not using this project.

For example, if I do “st” in pkg then I get this:

```julia
(@v1.4) pkg> st
Status `C:\Users\my_user_name\.julia\environments\v1.4\Project.toml`

```

If I try to add a package as a dependency, it will add it to to that project, and not `MyProject`. The REPL needs to be restarted frequently while I’m developing, and I think it should use the project by default that is opened in Juno.

But I don’t see how to set this up?

Thanks

---

<div class="post-metadata">

**Author:** ![Laszlo\_Nagy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laszlo_nagy/32/14565_2.png) [@Laszlo\_Nagy](https://discourse.julialang.org/u/Laszlo_Nagy)\
**Post date:** [May 10, 2020, 4:46pm UTC](https://discourse.julialang.org/t/how-to-use-juno-and-julia-to-develop-a-project/39225/6 "2020-05-10T16:46:11Z")

</div>

Actually, if Atom could set JULIA\_PROJECT environment variable to a predefined value for me, then that would in turn use @ in [Base.LOAD\_PATH](https://docs.julialang.org/en/v1/base/constants/#Base.LOAD_PATH) point to my project.

I found this post [Activate project in Juno/Atom - #2 by pfitzseb](https://discourse.julialang.org/t/activate-project-in-juno-atom/22589/2) that is about the very same thing. That topic was opened more than a year ago. There must already be a way to do this, just I can’t find it.

There is a workaround that actually works: open a shell, set JULIA\_PROJECT env there, and start atom from that environment. It _kind of_ works, but it makes switching projects from Atom impossible.

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [May 10, 2020, 6:51pm UTC](https://discourse.julialang.org/t/how-to-use-juno-and-julia-to-develop-a-project/39225/7 "2020-05-10T18:51:28Z")

</div>

Actually, I am always typing first `] activate .` to activate the current environment in a new REPL. It works, but if there is a better way to do it I would like to know it, too.  
In addition, you should use [https://github.com/timholy/Revise.jl](https://github.com/timholy/Revise.jl), so that you do not need to restart the REPL after each change in your module.  
For generating a new package, [GitHub - invenia/PkgTemplates.jl: Create new Julia packages, the easy way](https://github.com/invenia/PkgTemplates.jl) provides some more functionality than `Pkg.generate`.

---

<div class="post-metadata">

**Author:** ![pixel27](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pixel27/32/8902_2.png) [@pixel27](https://discourse.julialang.org/u/pixel27)\
**Post date:** [May 10, 2020, 7:39pm UTC](https://discourse.julialang.org/t/how-to-use-juno-and-julia-to-develop-a-project/39225/8 "2020-05-10T19:39:03Z")

</div>

What I’ve done is create the file `~/.julia/config/juno_startup.jl` with the contents:

```julia
if isfile("Project.toml")
	using Pkg
	Pkg.activate(pwd())
	Pkg.instantiate()
end

```

Which checks if there is a `Project.toml` file found in the directory, and if there is, activates it.

---

<div class="post-metadata">

**Author:** ![Laszlo\_Nagy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/laszlo_nagy/32/14565_2.png) [@Laszlo\_Nagy](https://discourse.julialang.org/u/Laszlo_Nagy)\
**Post date:** [May 11, 2020, 4:58am UTC](https://discourse.julialang.org/t/how-to-use-juno-and-julia-to-develop-a-project/39225/9 "2020-05-11T04:58:39Z")

</div>

This is very good. Although, it only works if you start atom from a terminal/shell. I usually start atom with a launcher (shortcut on Windows and the window manager’s launcher on Linux), and it will never start up in the project’s home directory.

The perfect way would be to make atom set JULIA\_PROJECT environment variable **for that Atom window** whenever I open a folder that contains a Project.toml file. E.g. if you open multiple Atom windows then have separate environments, so it would also be possible to open multiple projects at the same time.

In theory, Atom is hackable, so I guess this is possible to do, but I’m not sure how.
