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.2.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.2-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sckernel-0.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 f0c8761df22e008268dbef3abbaef60202091c5edc6a1d4722cecf8f97490d31
MD5 22a6e28b207a0703393658e47006441c
BLAKE2b-256 317c3512fce50d1783b76b2a9190ccc63c1e4de98bb9c50417227be36b2229e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sckernel-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 12.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3190a70190fcd545785ba2a99a319b3f03e0208351f7da168159a504c5939054
MD5 a338c977c15d50ace55acb1f0ebb3f8f
BLAKE2b-256 9fef074f5123adf1877388b21d301ae54654cd35c88c5ed6fd88f0e4e80e52eb

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