For those of you not subscribed for <#CEXV2QWNM|sc...
# datascience
a
For those of you not subscribed for #science channel, a little trick for using Jupyter with locally built libraries and for distribution non-published buncles. The video is

here

. The short recepie is the following: 1. Create a project in the idea and do what you want, exposing APIs that you want to use from the jupyter. 2. Use shadow plugin to create fat-jar distribution 3. Copy resulting jar from
build/libs
to the location of your notebook or send it to the consumer alongside the notebook 4. Load it using
@file:dependsOn("yourJar.jar")
5. OR create a module json file which references local jar file in the same way. In a module you can also define default imports and startup scripts if you want. 6. The resulting notebook + jar + [optional] module file form a stand-alone bundle that will work for anybody you send it to without the requirement to install environment or build anything.
👍 5
The new Jupyter API library will probably allow to define the module declaration right inside your code and bypass step 5
j
if there is a version of maven's dependency plugin for gradle to dump all the deps to a lib/ directory you can avoid the problems with shade when two manifests conflict. the same basic simplicity applies for jvm java -cp $dist/lib/*
h
why not just using gradle publishToMavenLocal and then @file:Repository("*mavenLocal") @file:DependsOn("com.github.holgerbrandlkravis0.8-SNAPSHOT") Works great for me. However since I don't trust the ivy cache, I often clean it from within the notebook before loading my library
a
Because. You can't send your maven local to a friend. Also, as you said, you need to clean up ivy cache on each build. Otherwise, you will see the old jar with the same version stuck in the cache.
h
My friends would kill me if I start sending around fatjars. 🙂 I got used to inlining ivycleanup as preamble in jupyter. E.g. see https://nbviewer.jupyter.org/github/holgerbrandl/kalasim/blob/master/simulations/notebooks/simu-letsplot.ipynb
a
It still won't help you if you use kind of quick-fix bundled from unreleased versions.