micronaut-jupyter

Integration between Micronaut and Jupyter

License

License

Categories

Categories

Micronaut Container Microservices
GroupId

GroupId

ai.stainless
ArtifactId

ArtifactId

micronaut-jupyter
Last Version

Last Version

0.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

micronaut-jupyter
Integration between Micronaut and Jupyter
Project URL

Project URL

https://github.com/stainlessai/micronaut-jupyter
Source Code Management

Source Code Management

http://github.com/stainlessai/micronaut-jupyter/tree/master

Download micronaut-jupyter

How to add to project

<!-- https://jarcasting.com/artifacts/ai.stainless/micronaut-jupyter/ -->
<dependency>
    <groupId>ai.stainless</groupId>
    <artifactId>micronaut-jupyter</artifactId>
    <version>0.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/ai.stainless/micronaut-jupyter/
implementation 'ai.stainless:micronaut-jupyter:0.2.1'
// https://jarcasting.com/artifacts/ai.stainless/micronaut-jupyter/
implementation ("ai.stainless:micronaut-jupyter:0.2.1")
'ai.stainless:micronaut-jupyter:jar:0.2.1'
<dependency org="ai.stainless" name="micronaut-jupyter" rev="0.2.1">
  <artifact name="micronaut-jupyter" type="jar" />
</dependency>
@Grapes(
@Grab(group='ai.stainless', module='micronaut-jupyter', version='0.2.1')
)
libraryDependencies += "ai.stainless" % "micronaut-jupyter" % "0.2.1"
[ai.stainless/micronaut-jupyter "0.2.1"]

Dependencies

compile (2)

Group / Artifact Type Version
com.github.twosigma.beakerx » beaker-kernel-base jar 1.4.1
com.github.twosigma.beakerx » beaker-kernel-groovy jar 1.4.1

runtime (5)

Group / Artifact Type Version
org.codehaus.groovy : groovy-all jar 2.5.6
io.micronaut : micronaut-inject-groovy jar
io.micronaut : micronaut-messaging jar
io.micronaut : micronaut-inject jar
io.micronaut : micronaut-management jar

Project Modules

There are no modules declared in this project.

micronaut-jupyter

Build Status Maven Central

A Micronaut configuration that integrates your app with an existing Jupyter installation.

Features

Micronaut kernel

A special Micronaut kernel is provided to Jupyter that can be used to run notebooks. This kernel can:

  • Execute Groovy code
  • Import classes on your Micronaut app's classpath
  • Access Micronaut beans
  • Use Micronaut Data repositories
  • Use GORM Data Services and dynamic finders
  • Access functionality available to the BeakerX Groovy kernel
    • Note: This requires that the beakerx Python package (and possibly other Jupyter packages) be installed on the system separately.

Setup

Add Build Dependency (Gradle)

Ensure the following repositories are added to your gradle build:

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}

Add the following dependency to your gradle build:

dependencies {
    implementation "ai.stainless:micronaut-jupyter:0.2.4"
}

Configure your Jupyter Kernels Directory

Ensure that your app can write to a directory where Jupyter will search for kernels.

Option 1 - Easiest (Possible security vulnerability!)

The default directory is /usr/local/share/jupyter/kernels, so the following is sufficient:

chmod 777 /usr/local/share/jupyter/kernels
Option 2 - May be More Secure

Create a separate directory, say at /opt/jupyter-alt/kernels, that your app can write to. Then, configure Jupyter to search this directory using JUPYTER_PATH. Lastly, add the following config to your application.yml:

jupyter:
  kernel:
    location: /opt/jupyter-alt/kernels

Usage

When your app starts up, this configuration will make any necessary configurations to Jupyter. Once both your app and Jupyter are running, login to Jupyter to start using the features.

See the /examples directory for example apps that use this configuration along with sample Jupyter notebooks that take advantage of the available features.

Development

Branches

The master branch contains the latest production release. The develop branch contains the latest stable build. It is recommended that most PRs be submitted to the develop branch in order to ensure that they are based on the most recent version of the code. Most PRs that are submitted to master will be rebased onto develop. Exceptions to this would include things like critical bugfixes that need to be pushed ahead of the next planned release.

Testing

Docker Required

In order to run the tests, you must have Docker installed on your dev environment. The tests use a library called Testcontainers, so you'll need to meet its system requirements (see link) in order to run the tests. The tests run in Travis CI out of the box; on a local machine, installing Docker Desktop should be sufficient.

Running the Tests

Run all the tests:

./gradlew test

Run integration and unit tests separately

./gradlew integrationTest
./gradlew unitTest

Gradle's --tests option won't apply to subtasks, so use -Ptests to filter the tests:

./gradlew test -Ptests=*BasicGroovy*
./gradlew integrationTest -Ptests=*Finder*

Building

./gradlew build

Planned Features

  • Import classes on app classpath in Jupyter script
  • Access GORM methods in Jupyter scripts
  • Access beans in Jupyter script
  • Ability to add custom methods and properties to scope of Jupyter script
  • Access GORM Data Services from Jupyter script
  • Access Micronaut Data repositories from Jupyter script
ai.stainless

Stainless AI

Versions

Version
0.2.1
0.2.0
0.1.0
0.0.0