
Interactive Go programming with Jupyter - kawera
https://medium.com/@yunabe/interactive-go-programming-with-jupyter-93fbf089aff1
======
robochat42
This looks very cool. There's no overview of how it actually works. It seems
to launch a goroutine for each Jupyter code cell but any variables defined are
also available for use in later cells so I'm not sure how that works.

Just playing with the code in the mybinder.org it feels responsive enough. As
well as for data analysis, this will be a great way to do those quick checks
that I like to do in python to confirm how an api works. I've been meaning to
start using golang more and this might be how I do it.

~~~
chatmasta
As someone who hasn't worked with Jupyter beyond a simple iPython shell, this
comment sent me down a bit of a rabbit hole. If anyone's interested, here are
some links.

Jupyter docs for making a kernel: [http://jupyter-
client.readthedocs.io/en/latest/kernels.html](http://jupyter-
client.readthedocs.io/en/latest/kernels.html)

List of jupyter kernels: [https://github.com/jupyter/jupyter/wiki/Jupyter-
kernels](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels)

Jupyter seems like a cleanly designed piece of software that is easy to
integrate with. I like the use of ZeroMQ for the wire protocol.

~~~
carreau
Sorry it's my job to nitpick. IPython is upper case I and P. We don't want to
upset the fruit giant.

------
cosmos72
For information, it's not the only Go kernel for Jupyter.

There is also
[https://github.com/gopherdata/gophernotes](https://github.com/gopherdata/gophernotes)
which uses a different approach: contains a portable Go interpreter, instead
of invoking the Go compiler for each Jupyter cell as lgo does (lgo is
currently linux only)

~~~
fredley
A comparison with gophernotes is included in the article. From the things
they've chosen to compare, it looks like a step up!

~~~
cosmos72
Yes, from the things they've chosen to compare.

I am gomacro author's (gophernotes uses gomacro as Go interpreter) and I find
the comparison needs an update.

Among other things, gomacro now supports interfaces - although gophernotes
still has to catch up. It's also partially incorrect: gophernotes and gomacro
_are_ type safe I guess I will have to open an issue...

Also, IMHO the comparison criteria are chosen based on what lgo author
considers important - not necessarily what's important for someone else.

Some quick examples that are important for me: portability on non-Linux
systems, redefining a variable or function (lgo can only shadow them),
redefining a method, allowing unused local variables...

I have great respect for what yunabe accomplished with lgo, including the deep
integration with Jupyter (displaying HTML, Javascript, images...), code
completion, and many other features, but I think his comparison with
gophernotes needs to be updated.

------
fwdpropaganda
Serious question: what's the point? Is there anything in the realm of
interactive data analysis-type programming that isn't already better with
Python and instead needs to be done in Go? I might be missing something. If
so, what?

~~~
Shakahs
Jupyter has uses outside of data science; I find it to be an extremely useful
programming scratchpad for web development with Python and Node. It was
renamed from IPython to Jupyter to reflect its broader scope, Python was the
original kernel but there are many now:

[https://github.com/jupyter/jupyter/wiki/Jupyter-
kernels](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels)

------
tekkk
This is very fascinating, great job!

One thing I was wondering how did you manage to build it? There's a lot of
code there and I was wondering if I could make my own version for a different
programming language.

------
21stio
I don't get why you want to use this over an IDE.

All you get is cached intermediate variables and being able to print them, am
I right?

On the other hand you loose the capability to see the definition of everything
externally defined and you can't use the debugger.

Please let me know if I am missing something

~~~
dahart
> I don't get why you want to use this over an IDE. All you get is cached
> intermediate variables and being able to print them, am I right?

You get more than that from Jupyter. Especially with Python, but for Go also.

Jupyter is for exploration and prototyping. Think of Jupyter as being a
massive improvement on the command line shell, rather than an IDE downgrade.
If you're developing large structured programs, yes the IDE is definitely the
way to go. But if you're doing interactive coding and you want to run the code
line by line or in small groups, you'd use the shell, or better yet Jupyter.
Jupyter is between an IDE and a shell.

Jupyter gives you inline images & plots. It's made with visual results and
interactive plotting in mind. Most IDE's don't have anything like that. You
can also compare Jupyter to Maple or Matlab or Mathematica.

Jupyter lets you add readable formatted markdown between code blocks, and you
can export your notebook in presentation formats like PDF or HTML.

Notebooks show the results of the program run, so someone you share with can
see what happened before they run the code.

And I don't know about the Go kernel, but with Python at least, Jupyter most
often installs a sandbox environment that includes several powerful Python
libraries. What this means in practice is that sharing notebooks is vastly
easier for the recipient of a notebook.

~~~
cube2222
Actually, pycharm caught up and provides all the interactivity and cell based
execution.

~~~
masklinn
1\. That's very misleading, because what PyCharm did was _add support for
jupyter notebooks_. Without iPython/Jupyter there would be no "interactivity
and cell based execution" in PyCharm.

2\. And AFAIK it's just Python, does it support the few dozens other jupyter
kernels?

~~~
cube2222
1\. No, it's not. In regular python files you can create cells using #%% and
run them separately. Yes, there is also notebook support but it requires
Jupyter.

2\. Just python

------
gaff33
Is there a pandas equivalent / Dataframe library for Go yet?

~~~
dm319
I just don't see Go ever becoming a good language for numerical computing.
There was such a push with implementing [multidimensional arrays in
Go]([https://github.com/golang/go/issues/6282](https://github.com/golang/go/issues/6282))
but it looks like it's been shot down more than once.

When using Python and R interactively, the syntactic sugar and functions that
allow for rapid analysis (subsetting, indexing, merging data objects etc etc)
more than make up for the slowness of the language. If someone wanted to
implement that workflow in Go for repeated analysis of very large datasets, I
doubt they would need it to be interactive.

But it looks like Julia might become the goto numerical language that is
compiled and fast.

------
chillydawg
I wonder what kind of dark arts might be required to have this talk to python
within one notebook? Would it even be useful?

~~~
fredley
If this were possible, it would require the blackest of black magic, and
mapping anything other than primitive types across the void would be
essentially impossible, e.g. anything useful like a DataFrame.

~~~
catawbasam
Arrow is meant to help with that

------
mar77i
So, what about the obvious rename to "Jugoter"?

~~~
TuringTest
That has the problem of sounding like "judgemental" in French ("jugeote")

~~~
akerro
So what? Jupyter sounds like a name of a planet in English.

------
odd_noises
This is def gonna help me understand Golang way better

------
pressurefree
ISNT IT PRONOUNCED 'GOH'? LIKE HOG BACKWARDS.

