Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a good workflow for developing Julia modules with IPython/Jupyter?

I find myself frequently developing new Julia modules while at the same time using those modules for my work. So I'll have an IPython (Jupyter) notebook, with something like:

using DataFrames
using MyModule

Then I'll do something like:

x = myfunction(7, 3)

But I'll have to modify that function, and unfortunately by that point I can't simply do

using MyModule

again. I'm not really sure why; I thought that calling using simply declares available modules in order to make the global scope aware of them, and then when a name is actually needed, the runtime searches for the definition among the currently loaded modules (starting with Main).

So shouldn't using MyModule simply just refresh the definitions of the items in the already declared module? Why do I have to completely stop and restart the kernel in order to use my updated functions? (Is it because names are bound only once to functions that are declared using the function keyword?)

I've looked at Julia Workflow Tips, but I don't find the whole Tmp, tst.jl system very simple or elegant... at least for a notebook.

Any suggestions?

like image 791
Nick Avatar asked Jun 05 '15 13:06

Nick


People also ask

How do I open Jupyter Notebook from Julia terminal?

SCRIPTDIR in Julia to find out where Conda installed jupyter . A "dashboard" window like this should open in your web browser. Click on the New button and choose the Julia option to start a new "notebook". A notebook will combine code, computed results, formatted text, and images, just as in IPython.

How do you write codes in Jupyter Notebook?

When you open a new Jupyter notebook, you'll notice that it contains a cell. Cells are how notebooks are structured and are the areas where you write your code. To run a piece of code, click on the cell to select it, then press SHIFT+ENTER or press the play button in the toolbar above.


1 Answers

I think there's a lot of truth in this statement attributed to one of the Juno developers: Jupyter notebook is for working with data. Juno IDE is for working with code.

Jupyter is great for using modules in a notebook style that the output you're getting is reproducible. Juno and the REPL have less overhead that let you keep starting new sessions (faster testing, and fixes the problem you noted), have multiple tabs open to follow code around a complex module, and can use the debugger (in v0.5). They address different development issues for difference stages of use. I think you're pushing against the tide if you're using the wrong tool for the wrong job.

like image 155
Chris Rackauckas Avatar answered Sep 29 '22 09:09

Chris Rackauckas