Python API

Starter Manager

manager, for starters

class jupyter_starters.manager.StarterManager(**kwargs)[source]

handlers starting starters

property contents_manager

use the contents manager from parent

async just_copy(root, path)[source]

just copy, with some dummy values

property kernel_manager

use the kernel manager from parent

resolve_src(starter)[source]

resolve the src of a file-based starter

property running

report names of all starters that could be stopped

async save_one(src, dest)[source]

use the contents manager to write a single file/folder

async start(name, path, body)[source]

start a starter

async start_copy(name, starter, path, body)[source]

start a copy starter

async start_notebook(name, starter, path, body)[source]

delegate running the notebook to a kernel

async start_python(name, starter, path, body)[source]

start a python starter

property starter_names: List[str]

convenience method to get names of starters

property starters

augment notebook starters

TODO: caching

async stop(name)[source]

stop a starter. presently only works for notebooks

async stop_notebook(name)[source]

stop running the notebook kernel

jupyter_starters.manager.iter_not_ignored(root, ignore_patterns=None)[source]

yield all children under a root that do not match the ignore patterns

Starters

Cookiecutter

a starter that runs cookiecutter

jupyter_starters.py_starters.cookiecutter.cookiecutter_pantry()[source]

try to load the pantry from the cookiecutter metadata

jupyter_starters.py_starters.cookiecutter.cookiecutter_starters(manager)[source]

try to find some cookiecutters

jupyter_starters.py_starters.cookiecutter.cookiecutter_to_schema(cookiecutter_json)[source]

convert a cookiecutter context to a JSON schema

async jupyter_starters.py_starters.cookiecutter.start(name, starter, path, body, manager) Dict[str, Any][source]

run cookiecutter

Notebook

use a notebook as a starter

async jupyter_starters.py_starters.notebook.copy_files(tmp_nb, path, manager)[source]

handle retrieving the files from the temporary directory

async jupyter_starters.py_starters.notebook.ensure_notebook(starter, path, body, tmpdir, manager)[source]

ensure a notebook exists in a temporary directory

async jupyter_starters.py_starters.notebook.get_kernel_and_tmpdir(name, starter, manager)[source]

use the manager to get a kernel and working directory

jupyter_starters.py_starters.notebook.kernel_for_path(src)[source]

get the kernel.

TODO: do better on account of freaky names

async jupyter_starters.py_starters.notebook.notebook_starter(name, starter, path, body, manager)[source]

(re)runs a notebook until its schema is correct

jupyter_starters.py_starters.notebook.response_from_nbjson(nbjson)[source]

get the starter response

jupyter_starters.py_starters.notebook.response_from_notebook(src)[source]

load a path and return the metadata

async jupyter_starters.py_starters.notebook.run_cells(nbjson, kernel, manager)[source]

actually run the cells

jupyter_starters.py_starters.notebook.starter_from_nbjson(nbjson)[source]

get just the starter

async jupyter_starters.py_starters.notebook.stop_kernel(name, manager)[source]

stop the kernel (and clean the tmpdir)

Miscellaneous

Types

some types and constants

class jupyter_starters.types.Status[source]

pseudo-enum for managing statuses

__weakref__

list of weak references to the object (if defined)

Traits

some more traits

these are not typechecked yet, because of the impedance between traitlets, JSON Schema, and mypy.

class jupyter_starters.trait_types.Schema(validator, *args, **kwargs)[source]

any… but validated by a jupyter_starters.json_.json_validator()

__init__(validator, *args, **kwargs)[source]

Declare a traitlet.

If allow_none is True, None is a valid value in addition to any values that are normally valid. The default is up to the subclass. For most trait types, the default value for allow_none is False.

If read_only is True, attempts to directly modify a trait attribute raises a TraitError.

Extra metadata can be associated with the traitlet using the .tag() convenience method or by using the traitlet instance’s .metadata dictionary.

validate(obj, value)[source]

applies a validator

Validators

some third-party preferred alternatives to stdlib/status quo for parsing and validating JSON

jupyter_starters.json_.JsonSchemaException

alias of jsonschema.exceptions.ValidationError

jupyter_starters.json_.dumps()

Converts arbitrary object recursively into JSON. Use ensure_ascii=false to output UTF-8. Set encode_html_chars=True to encode < > & as unicode escape sequences. Set escape_forward_slashes=False to prevent escaping / characters.Set allow_nan=False to raise an exception when NaN or Inf would be serialized.Set reject_bytes=True to raise TypeError on bytes.

jupyter_starters.json_.json_validator(schema: Dict[str, Any]) Callable[[Dict[str, Any]], Any][source]

implements that fastjsonschema.compile API with jsonschema

jupyter_starters.json_.loads()

Converts JSON as string to dict object structure.