Skip to main content

No project description provided

Project description

Jupyter package

This package provides a custom Jupyter kernel that allows extra communication beyond the usual Jupyter message types to allow for the kernel to interact with an LLM (GPT-4) and answer questions and generate code that is runnable in native notebook code cells.

This package contains 4 different products:

  • A Python module named beaker_kernel (pyproject.toml)
  • A Jupyter kernel (beaker)
  • A Jupyter service (main.py)
  • A standalone development interface (dev_ui)

Install / setup

beaker_kernel Python module

Normal installation:

# Requires [hatch](https://github.com/pypa/hatch)
$ pip install hatch  # If needed
$ pip install .

Development installation

$ pip install -e .

Jupyter kernel

The Beaker Kernel should be automatically installed if Beaker is installed using the method above.

If the kernel is not installed, or you want to install the kernel manually ensure that the beaker_kernel package is accessible in your environmnet and then simply copy or symlink the kernel.json file to one of the directories defined in the following document inside a unique directory:

https://jupyter-client.readthedocs.io/en/stable/kernels.html#kernel-specs

For example:

$ cp -r beaker_kernel/kernel.json /usr/share/jupyter/kernels/beaker/kernel.json

Once the directory exists and the jupyter service is restarted the kernel should be available for selection.

Dev setup

This package is bundled with a basic development UI for development and testing.

You will need to update the .env file with your OpenAI/GPT API key to use the LLM.

Once you have set up the environment and added your keys you can start the dev server by running:

$ make dev

This will start the Jupyter service and launch a specialized notebook interface in your browser similar to if you ran $ jupyter notebook normally.

Differences from vanilla Jupyter

This setup uses mostly stock Jupyter services as provided in the Jupyter Python packages, with minor differences.

The entry point of the docker file runs the file main.py which starts a JupyterLab Server App. The key differences here are:

  1. This service does not run any front-end outside of dev mode and only provides API and websocket access as this service is expected to connect to a custom interface.
  2. Some security settings are loosened to allow access through the a custom interface and allow Beaker to access the Jupyter service API to manage subkernels:
    1. allow_orgin rule loosened as UI and Kernel likely do not share the same domain.
    2. disable_check_xsrf set so as the Jupyter API does not require xsrf checks, allowing Beaker to make calls directly

These security settings will be reviewed in the future in an attempt to tighten the modifications.

More information can be found in the official docs (link coming soon).

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beaker_kernel-1.2.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

beaker_kernel-1.2.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file beaker_kernel-1.2.0.tar.gz.

File metadata

  • Download URL: beaker_kernel-1.2.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.25.2

File hashes

Hashes for beaker_kernel-1.2.0.tar.gz
Algorithm Hash digest
SHA256 deeba33b0ad777669bda5bff81b3973b8ebe113a1472925876c106ebf6fe0970
MD5 7682206b7df588df3a42156d6cded455
BLAKE2b-256 2997741921e602d2c7b0485cbb6598d5140a1e6d692f9f749fbe68367ac9c349

See more details on using hashes here.

File details

Details for the file beaker_kernel-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for beaker_kernel-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84ec5da955462c24543af2673cf61ef3f0e5a5619ef7de3e252fb71ee5d070ed
MD5 0847793ec49f5aca714db7911aa3e9eb
BLAKE2b-256 b7933d3af68ecd5219dbc3310133a83ae7dc2d4574c20397c3caa942d205cc9c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page