# Developing a standalone application in Julia

**URL:** <https://discourse.julialang.org/t/developing-a-standalone-application-in-julia/27795>\
**Category:** New to Julia\
**Tags:** package, documentation, build\
**Created:** [August 21, 2019, 9:23am UTC](https://discourse.julialang.org/t/developing-a-standalone-application-in-julia/27795 "2019-08-21T09:23:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blaiseli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blaiseli/32/10332_2.png) [@blaiseli](https://discourse.julialang.org/u/blaiseli)\
**Post date:** [August 21, 2019, 9:23am UTC](https://discourse.julialang.org/t/developing-a-standalone-application-in-julia/27795/1 "2019-08-21T09:23:12Z")

</div>

Hello,

I’m new to Julia (my experience being mostly in Python), I work in the field of bioinformatics, and I work on Linux systems.

I would like to develop a Julia version of a standalone application for which I already have a Python version. My hope is to obtain something faster to insert into some of my bioinformatics automated pipelines.

So far, I’m more or less managing to do the programming part (I have a .jl script that can take input from the command-line and generates at least part of the output I want).  
Where I’m more puzzled is regarding the surrounding development ecosystem and best practice in development workflows.

From what I’ve seen online, Julia usage seems strongly biased towards doing things from the REPL, not writing standalone scripts. I apparently have a quite different approach, so it may be that Julia is not at all the right tool for what I want to do. My practice of REPL (or notebooks like Jupyter) is testing things before using them in re-usable scripts that I can insert into an automated reproducible workflow.

I had a look at [5. Creating Packages · Pkg.jl](https://julialang.github.io/Pkg.jl/v1/creating-packages/), but I’m having a hard time finding up-to-date concrete examples on how to do the kind of tasks I have in mind.

I initiated a package in the REPL in pkg mode, using `generate`, activated the corresponding environment using `activate`, I added dependencies using `add`, and this created me a `Project.toml` file.

But then, how do I go actually building my application? It seems that the dependencies that have been added are only active in the REPL, when the environment is activated. If I try to call Julia to run the script, this only works if I have globally installed the dependencies. Otherwise, I have `LoadError`s.

I suppose the solution lies in the content of the `deps/build.jl` script, but I failed to understand what I should put there. Is it possible to make a standalone executable with all the necessary dependencies somehow “included”?

I also tried to set up documentation using Documenter, creating a `docs/make.jl` and a `docs/src/index.md`, and I’m able to build the doc by executing the `make.jl` script with julia, but only if the required packages are globally installed.

Do you know of standalone applications that have been build using recent Julia versions, where I could look for setup examples?

---

<div class="post-metadata">

**Author:** ![dmolina](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmolina/32/5246_2.png) [@dmolina](https://discourse.julialang.org/u/dmolina)\
**Post date:** [August 21, 2019, 9:34am UTC](https://discourse.julialang.org/t/developing-a-standalone-application-in-julia/27795/2 "2019-08-21T09:34:44Z")

</div>

For the problem of the dependencies, you can use

> julia --project=\<directory\_environment\> _script.jl_

In that way, you will use the dependencies of the environment (is similar to _activate_ from the REPL). If the script is in the same directory, you can put:

> julia --project=. _script.jl_.

Also, you can set the shell variable JULIA\_PROJECT

> export JULIA\_PROJECT=.

to avoid the **–project** argument calling to julia.

The same thing with running the make.jl for the generation of documentation (considering that Documenter are in the dependences).

---

<div class="post-metadata">

**Author:** ![blaiseli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blaiseli/32/10332_2.png) [@blaiseli](https://discourse.julialang.org/u/blaiseli)\
**Post date:** [August 21, 2019, 10:26am UTC](https://discourse.julialang.org/t/developing-a-standalone-application-in-julia/27795/3 "2019-08-21T10:26:42Z")

</div>

Thanks, that’s a useful piece of information.

I can now imagine that one way of doing would be to provide a wrapper script that would take charge of specifying the project directory:

Suppose the actual script is in `bin/foo.jl`. There would be a `bin/foo.sh` wrapper containing the following:

```julia
#/bin/bash

wrapper=$(readlink -f "${BASH_SOURCE[0]}")
PACKAGEDIR=$( cd "$( dirname "${wrapper}" )/.." && pwd )
wrapper_name=$(basename "${wrapper}")

julia_script="${PACKAGEDIR}/bin/${wrapper_name%.sh}.jl"

/usr/bin/env julia --project=${PACKAGEDIR} ${julia_script} "$@"

```

The install would then consist in getting the whole package directory, and making a symbolic link to the wrapper, in a directory somewhere in the PATH.
