Skip to main content

A SuperCollider kernel for Jupyter Notebooks

Project description

sckernel

sckernel is a Jupyter Notebook kernel for SuperCollider's sclang. sckernel launches a post window to display output just as the SuperCollider IDE does while the Notebook front end handles input.

Syntax highlighting in the Notebook uses codemirror with a mode defined in kernel.js.

sckernel has been tested on both MacOS and Windows 10.

Requirements

Users need a working installation of SuperCollider and Jupyter Notebook. There are several ways to install Jupyter Notebook as detailed at www.jupyter.org/install. The quickest way is by downloading Anaconda.

sckernel requires Python 3.5 or higher. Please be sure if you downloaded the Notebook through Anaconda that it is for Python 3.5 or higher.

Installation

Step 1: Download sckernel

To download sckernel from PyPI:

pip install sckernel

Step 2: Install the kernelspec for sckernel

To complete the installation, you must select a location for the sckernel configuration files (called a kernelspec). There are three options:

  1. To install locally to your user account, run

    python -m sckernel.install
    

    The above line is also equivalent to python -m sckernel.install --user.

  2. To install in the root directory or for an environment like Anaconda or venv, run

    python -m sckernel.install --sys-prefix.

  3. To install to another location (not recommended), run

    python -m sckernel.install --prefix <your_prefix_path>
    

    sckernel's kernelspec will be installed in {PREFIX}/share/jupyter/kernels/.

Step 3: Configure sckernel to find your Python and sclang binaries

sckernel works by launching two separate subprocesses: a post window implemented in Python and sclang, the frontend interpreter for SuperCollider. To launch these processes properly, sckernel needs to know where to find those binaries. To complete the installation, run the following with those paths:

python -m sckernel.config --python /path/to/python --sclang /path/to/sclang

You may omit this step entirely. By default, sckernel will attempt to search through your PATH environment variable for the first instance of python and sclang and attempt to run those. Depending upon your personal configuration, you may be able to rely successfully upon your PATH variable without this step. Additionally, you can chose to omit just one of the --python or --sclang flags if you would like to provide a path to only one. Most users with multiple installations of Python should run this step to ensure that sckernel uses the correct instance of Python.

The typical paths for sclang are as follows but may be different on your machine.

OS X: "/Applications/SuperCollider/SuperCollider.app/Contents/Resources/sclang"
Linux: "/usr/local/bin/sclang"
Windows: "C:\Program Files\SuperCollider\sclang.exe"

Using SuperCollider kernel

When opening Jupyter notebook, select from the New menu SC_Kernel to create a new SuperCollider notebook using sclang.

For the console frontend, you can run jupyter console --kernel sckernel.

Converting from Notebooks to SuperCollider files (.scd)

The sckernel package also comes with a convenience script to translate from Jupyter notebooks to .scd files (i.e., SuperCollider files).

python -m sckernel.convertNotebookToScd /path/to/notebook /path/to/destination

Some light formatting is done to make the .scd files readable in a similar way to Jupyter Notebooks.

Version Log

0.3.0

  • Created a configuration file for sckernel to read paths to python and sclang to support different installations
  • Reorganized sclangSub.py
  • Updated documentation to reflect the need for running sckernel.config

0.2.0

  • Eliminated window flicker on MacOS
  • Added syntax highlighting by implementing CodeMirror

0.1.0

  • First version of sckernel

Project details


Download files

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

Source Distribution

sckernel-0.3.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

sckernel-0.3.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file sckernel-0.3.0.tar.gz.

File metadata

  • Download URL: sckernel-0.3.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for sckernel-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ed3990a2aa77784a8a5143754c6aa242a65a4b55157b91bd300acaa398f44313
MD5 45369e0492fac261a3c49ee15ed77189
BLAKE2b-256 b9c7be3286f985f15d34a5d4b910a683edd0421a9a2a60c7df6c451674173720

See more details on using hashes here.

File details

Details for the file sckernel-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: sckernel-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for sckernel-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15b1bb6cc9580d248ab44d7a88ec26c4a5163f40f722fa76124e3474e21b2423
MD5 838061b4147a57fac7e0986f6a11122a
BLAKE2b-256 32c5045a7778783aef8f58bd642ad6be3c18ca872f45b28ac9d3effc1eab5eb5

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