7
votes

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?

1
I would be curious to know if you happened to find an answer.ARM
You might want to take a look at this question: stackoverflow.com/questions/25028873/… This considers the same issue, namely reloading modules.niczky12
Regardless of whether you can do this, I'm not sure you should. When you reload a module, you still get objects that predate the module, and you're never quite sure of whether what you run is really independant. My workflow for module development is to run the test suite. I can fiddle around with the functions in the REPL or such, but if I want to look at the module-wide effects, I run the tests.Timothée Poisot

1 Answers

2
votes

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.