tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

using clojupyter, alembic does not work

Open behrica opened this issue 5 years ago • 10 comments

Using clojupyter ignores any local procet.clj file for the dependencies.

It has its own way to add dependencies dynamically, see here: https://github.com/aria42/clojupyter/blob/mime-improvements/examples/html-demo.ipynb

So I think the readme.md should not refer to Alembic for adding dependencies, but as foreseen in clojupyter

I think that the tutorials folder here should rightly focus on using clojupyter as it is the most user friendly. (so I will find my way for my org mode files...) Using clojupyter does not require "leiningen" at all, if i am not mistaken.

behrica avatar Mar 02 '19 14:03 behrica

Using clojupyter means as well that neither leiningen nor any project.clj file is required. After installing the clojupyter kernel, we can just run "jupyter notebook" and select the Clojure kernel.

This makes things even easier for "beginners", as no local installation of leiningen is needed

behrica avatar Mar 02 '19 14:03 behrica

Thanks @behrica.

I removed all the jupyter-related details and switched to Alembic for now, till we close the related issue, #2 .

From my experiments, just using clojupyter did not make it possible to (require '[clojupyter.misc.helper]).

I think the way to go would be through the lein-jupyeter plugin, that makes sure such namespaces are available, and also adds some important tooling such as Parinfer.

daslu avatar Mar 02 '19 14:03 daslu

@behrica does it seem ok to wait a bit, in your opinion?

daslu avatar Mar 02 '19 14:03 daslu

I have it working locally. I removed project.clj and just run "jupyter notebook" in the (empty) tutorials directory and it works.

I can use (require '[clojupyter.misc.helper :as helper]) and (helper/add-dependencies '[semantic-csv "0.2.1-alpha1"])

without problems.

So the names spaces are their, even without the lein-jupyter plugin. But parinfer is missing, indeed

behrica avatar Mar 02 '19 18:03 behrica

@behrica interesting.

Which kernel are you opening at Jupyter?
Clojure or Lein-Clojure ?

daslu avatar Mar 02 '19 20:03 daslu

"clojure"

Maybe I should add that I tried the very latest clojupyter, which allows to connect Cider. That fix is now on masteras well. I will retry now with latest clojupyter

behrica avatar Mar 03 '19 10:03 behrica

Hmm,, lein jupyter 0.0.16 makes problems with latest clojupyter...(master a0a49c8346cfbaa6da01886b4c3f8a06ff078ad1) Kernel not starting, crashes ...

(which I want to use due to the new feature of the nrepl connection to a running clojupyter)

Honestly, the added value of lein jupyter seems little to me.

I prefer as well to add depedencies "dynamically in the notebook" instead of declaring them in project.clj. On top the latest clojupyter has included the documenattion of functions on Shift-tab, which current lein jupyter does not have.

This allows as well "standalone" notebooks, without need of project,clj or leiningen. In my view, this makes it more "beginner friendly".

Not sure, what this means for the organisation of the tutorials.

It needed to be different for "clojupyter style notebooks" and "lein jupyter style notebooks" as the first can be completely standalone, while the second should allow one project.clj per notebook (so at least one folder per notebook)

behrica avatar Mar 03 '19 11:03 behrica

Thanks, @behrica . (require 'clojupyter.misc.helper) works at my machine, too, after installing the latest version of clojupyter ("0.2.1-SNAPSHOT").

Regarding adding dependencies dynamically in the notebook, I feel the same. It makes sure the notebooks are self-contained examples, and avoids coupling different notebooks with the same dependencies.

Being able to open different notebooks at the same running jupyter seems more attractive for users. Why do you think we should have one project.clj per notebook if we use lein-jupyter?

daslu avatar Mar 03 '19 17:03 daslu

Hi, @behrica, Indeed I see a conflict when trying to use Lein-Jupyter (built it locally with the new Clojupyter).

So, for now, let us not support Lein-Jupyter.

I updated the README and the examples, to suggest using Alembic with plain Clojure, and Clojupyter's tooling with Jupyter.

daslu avatar Mar 05 '19 22:03 daslu

@behrica Do the current structure seem ok in your opinion?

daslu avatar Mar 06 '19 07:03 daslu