sc3nb.magics

This module adds the Jupyter specialties such as Magics and Keyboard Shortcuts

Module Contents

Function List

load_ipython_extension

Function that is called when Jupyter loads this as extension (%load_ext sc3nb)

add_shortcut

Add the server 'free all' shortcut.

Class List

SC3Magics

IPython magics for SC class

Content

sc3nb.magics.load_ipython_extension(ipython) None[source]

Function that is called when Jupyter loads this as extension (%load_ext sc3nb)

Parameters:
ipythonIPython

IPython object

sc3nb.magics.add_shortcut(ipython, shortcut: str = None) None[source]

Add the server ‘free all’ shortcut.

Parameters:
ipythonIPython

IPython object

shortcutstr, optional

shortcut for ‘free all’, by default it is “cmd-.” or “Ctrl-.”

class sc3nb.magics.SC3Magics(shell=None, **kwargs)[source]

Bases: IPython.core.magic.Magics

IPython magics for SC class

Create a configurable given a config config.

Parameters:
configConfig

If this is empty, default values are used. If config is a Config instance, it will be used to configure the instance.

parentConfigurable instance, optional

The parent Configurable instance of this object.

Notes

Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():

class MyConfigurable(Configurable):
    def __init__(self, config=None):
        super(MyConfigurable, self).__init__(config=config)
        # Then any other code you need to finish initialization.

This ensures that instances will be configured properly.

Overview:

sc

Execute SuperCollider code via magic

scv

Execute SuperCollider code with verbose output

scs

Execute SuperCollider code silently (verbose==False)

scg

Execute SuperCollider code returning output

scgv

Execute SuperCollider code returning output

scgs

Execute SuperCollider code returning output

_parse_pyvars

Parses SuperCollider code for python variables and their values

sc(line='', cell=None)[source]

Execute SuperCollider code via magic

Parameters:
linestr, optional

Line of SuperCollider code, by default ‘’

cellstr, optional

Cell of SuperCollider code , by default None

Returns:
Unknown

cmd result

scv(line='', cell=None)[source]

Execute SuperCollider code with verbose output

Parameters:
linestr, optional

Line of SuperCollider code, by default ‘’

cellstr, optional

Cell of SuperCollider code , by default None

Returns:
Unknown

cmd result

scs(line='', cell=None)[source]

Execute SuperCollider code silently (verbose==False)

Parameters:
linestr, optional

Line of SuperCollider code, by default ‘’

cellstr, optional

Cell of SuperCollider code , by default None

Returns:
Unknown

cmd result

scg(line='', cell=None)[source]

Execute SuperCollider code returning output

Parameters:
linestr, optional

Line of SuperCollider code, by default ‘’

cellstr, optional

Cell of SuperCollider code , by default None

Returns:
Unknown

cmd result Output from SuperCollider code, not all SC types supported, see pythonosc.osc_message.Message for list of supported types

scgv(line='', cell=None)[source]

Execute SuperCollider code returning output

Parameters:
linestr, optional

Line of SuperCollider code, by default ‘’

cellstr, optional

Cell of SuperCollider code , by default None

Returns:
Unknown

cmd result Output from SuperCollider code, not all SC types supported, see pythonosc.osc_message.Message for list of supported types

scgs(line='', cell=None)[source]

Execute SuperCollider code returning output

Parameters:
linestr, optional

Line of SuperCollider code, by default ‘’

cellstr, optional

Cell of SuperCollider code , by default None

Returns:
Unknown

cmd result Output from SuperCollider code, not all SC types supported, see pythonosc.osc_message.Message for list of supported types

_parse_pyvars(code: str) Dict[str, Any][source]

Parses SuperCollider code for python variables and their values

Parameters:
codestr

SuperCollider code snippet

Returns:
Dict[str, Any]

Dict with variable names and their values.

Raises:
NameError

If pyvar injection value can’t be found.