Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create project in Julia and Juno?

I've installed Julia, Atom and Juno. I used to think that before you start coding anything you should create a project, but I can't find "New Project" item in Juno IDE.

Does Julia support the notion of project? If yes, how could I create a simple project, add Julia files to it, run it, etc?

like image 759
kludg Avatar asked Jun 18 '19 07:06

kludg


People also ask

How do you create a project in Julia?

To generate a new project environment, simply type generate followed by the name of your project. An environment directory will be created in your present working directory. In this environment the files Project. toml and Manifest.

How do you run a Julia script in Juno?

Opening the Console Window To open the console, use the command Ctrl+j then Ctrl+o , or go to Packages > Julia > Open Console. This will open a window with the title console. To use the console, simply type in a command and hit Enter .

What is Juno for Julia?

Juno is a powerful, free environment for the Julia language.


1 Answers

If you're just looking for a simple way to get the equivalent of a Python virtual environment, where all your packages are contained to a project, here's how I'm currently doing it:

Setting up a new environment:

  1. mkdir myproject
  2. cd myproject
  3. julia
  4. ]
  5. activate . # Now it should say (myproject) pkg> as the prompt
  6. add DataFrames # (for example)
  7. Now two files will appear in myproject/
    1. Project.toml - lists all packages installed. Kind of like a requirements.txt file in Python
    2. Manifest.toml - lists all packages required/available in the project. More intense and complete than Project.toml.

Initializing an environment based on a Project.toml file:

  1. using Pkg
  2. Pkg.activate(".")
  3. Pkg.instantiate() # this will install the packages listed in Project.toml

(You can also use the ] method at the REPL)

Note that if you just do Pkg.activate() (no "."), then it activates the base environment. Usually you won't want to activate the base environment if you're trying to set up an environment specific to a certain project folder.

like image 127
J. Blauvelt Avatar answered Oct 19 '22 05:10

J. Blauvelt