Python API#

Starter Manager#

Manager, for starters.

jupyter_starters.manager.DEFAULT_ENV_CLS = 'jinja2.sandbox.SandboxedEnvironment'#

the importable name of a class

class jupyter_starters.manager.StarterManager(**kwargs: Any)[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_content(path, starter_model, body)[source]#

save a content model (and its children)

async save_contents_model(model, dest)[source]#

Use the contents manager to write a model.

async save_one_file(src, dest)[source]#

Generate and save a content model for a single file/directory.

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

Start a starter.

async start_content(name, starter, path, body)[source]#

Start a content 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: StarterManager)[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 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 Infinity 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.