Julia `julia --project` argument use

237 Views Asked by At

I learned of a way to run julia, so I can use the file structure of a package for my project. Namely julia --project inside my developement directory. With this I can load all projects structured like projectName/src/projectName.jl inside the same folder.

An Example:

all my julia projects/
├─ project 1/
│  ├─ working with files in julia.jl
│  ├─ data.csv
├─ project 2/
│  ├─ project.toml
│  ├─ src/
│  │  ├─ project 2.jl
├─ project 3/
│  ├─ draft.uxf
│  ├─ .gitignore
│  ├─ project.toml
│  ├─ auto_compile.jl
│  ├─ src/
│  │  ├─ project 3.jl

With this file structure I want to call auto_compile.jl that does the following:

using Pkg

cd("..")
Pkg.activate(".")
Pkg.instatiate()

Pkg.add("PackageCompiler")
using PackageCompiler

create_app("Project 3", "Project 3 Compiled")

However, PackageCompiler.jl only works with the --project command. The --project argument doesnt seem to modify LOAD_PATH, what does it do exactly? Can I edit my julia session with --project later on? I figured julia does the same when loading packages from the ~user/.julia/packages/ dir, but how do I do that, and are there more usefull arguments I should know about?

1

There are 1 best solutions below

0
Baumwolle 25 On

after some quick "testing" I can confirm:

the --project/--project=. flags when starting julia from the terminal do the same as Pkg.activate(".")