jupyterlab-starters

Parameterized file and directory starters for JupyterLab.

releases

deps

ci

demo

docs

pypi-badge
npm-badge
license-badge

python-badge
jupyterlab-badge

ci-badge

binder-badge

docs-badge
roadmap-badge
changelog-badge

screenshot

What’s a starter?

A starter is a…

  • single file

  • directory

  • python function

  • cookiecutter

  • notebook

… that creates a…

  • single file

  • directory of files (or more directories)

… that shows up where you want it in JupyterLab at the click of a button

Installing

You’ll need jupyterlab >=3,<4, python >=3.7, and nodejs >=12

pip install --pre jupyter_starters

Check your installation:

jupyter serverextension list
jupyter labextension list

If you don’t see jupyterlab_starters run:

jupyter serverextension enable --sys-prefix jupyterlab_starters

Configuring

Like the Jupyter Notebook server, JupyterHub and other Jupyter interactive computing tools, jupyter-starters can be configured via Python or JSON files in well-known locations. You can find out where to put them on your system with:

jupyter --paths

They will be merged from bottom to top, and the directory where you launch your notebook server wins, making it easy to check in to version control.

The very simplest starter, copy, will copy a file or folder to the location it is launched from in the JupyterLab Launcher.

{
  "StarterManager": {
    "extra_starters": {
      "whitepaper-single": {
        "type": "copy",
        "label": "Whitepaper Notebook",
        "description": "A reusable notebook for proposing research",
        "src": "examples/whitepaper-single.ipynb"
      }
    }
  }
}

more docs TBD: for now, see examples in the demo configuration.

Alternatives

Don’t like what you see here? Try these other approaches:

Documentation Contents

import graphviz
import IPython


@IPython.core.magic.register_line_cell_magic
def dot(line, cell):
    return graphviz.Source(cell)

For Starters

The basic idea of a starter is:

  • pick a destination in the JupyterLab File Browser

  • click a button in the JupyterLab Launcher

  • see useful files

A slightly more accurate version is:

  • configure via traitlets

  • advertise to JupyterLab via the REST API

  • display in the JupyterLab Launcher

  • click a button in the JupyterLab Launcher

    • or immediately start with a Starter Tree URL

  • zero or more (but usually one) times:

    • gather more information from the user via react-jsonschema-form

    • perform further processing

    • copy files via the Contents API

    • see useful files in the JupyterLab File Browser

    • run JupyterLab Commands to do other things to JupyterLab

Which of these steps a particular starter performs depends primarily on its type.

Types of Starters

Copy

"type": "copy"

"src": "<an absolute or relative path>"

The simplest starter, copy, just… copies. It can copy a single file, or a directory of files (and subdirectories). The src attribute tells the starter where to get the files.

%%dot
digraph g { compound=true layout=dot rankdir=TB
    node[shape=none fontname="sans-serif"]
    graph[fontname="sans-serif" fontcolor="grey" color="none" fillcolor="#eeeeee" style=filled]
    label="a notional execution of a copy starter"
    subgraph cluster_files { label="Your Files"
        files
    }
    
    subgraph cluster_server { label="Notebook Server"
        get[label="/starters" fontname=monospace]
        post[label="/starters/{:name}/{:path}" fontname=monospace]
        contents
    }

    subgraph cluster_lab { label="JupyterLab"
        launcher
    }
    
    get -> launcher[label=①]
    launcher -> post[label=②]
    post -> contents[label=③]
    contents -> files[label=④]
    files -> contents[label=⑤]
    contents -> post[label=⑥]
    post -> launcher[label=⑦]
    launcher -> launcher[label=⑧]
}
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
Input In [2], in <module>
----> 1 get_ipython().run_cell_magic('dot', '', 'digraph g { compound=true layout=dot rankdir=TB\n    node[shape=none fontname="sans-serif"]\n    graph[fontname="sans-serif" fontcolor="grey" color="none" fillcolor="#eeeeee" style=filled]\n    label="a notional execution of a copy starter"\n    subgraph cluster_files { label="Your Files"\n        files\n    }\n    \n    subgraph cluster_server { label="Notebook Server"\n        get[label="/starters" fontname=monospace]\n        post[label="/starters/{:name}/{:path}" fontname=monospace]\n        contents\n    }\n\n    subgraph cluster_lab { label="JupyterLab"\n        launcher\n    }\n    \n    get -> launcher[label=①]\n    launcher -> post[label=②]\n    post -> contents[label=③]\n    contents -> files[label=④]\n    files -> contents[label=⑤]\n    contents -> post[label=⑥]\n    post -> launcher[label=⑦]\n    launcher -> launcher[label=⑧]\n}\n')

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/IPython/core/displayhook.py:262, in DisplayHook.__call__(self, result)
    260 self.start_displayhook()
    261 self.write_output_prompt()
--> 262 format_dict, md_dict = self.compute_format_data(result)
    263 self.update_user_ns(result)
    264 self.fill_exec_result(result)

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/IPython/core/displayhook.py:151, in DisplayHook.compute_format_data(self, result)
    121 def compute_format_data(self, result):
    122     """Compute format data of the object to be displayed.
    123 
    124     The format data is a generalization of the :func:`repr` of an object.
   (...)
    149 
    150     """
--> 151     return self.shell.display_formatter.format(result)

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/IPython/core/formatters.py:148, in DisplayFormatter.format(self, obj, include, exclude)
    144 if self.ipython_display_formatter(obj):
    145     # object handled itself, don't proceed
    146     return {}, {}
--> 148 format_dict, md_dict = self.mimebundle_formatter(obj, include=include, exclude=exclude)
    150 if format_dict or md_dict:
    151     if include:

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/decorator.py:232, in decorate.<locals>.fun(*args, **kw)
    230 if not kwsyntax:
    231     args, kw = fix(args, kw, sig)
--> 232 return caller(func, *(extras + args), **kw)

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/IPython/core/formatters.py:222, in catch_format_error(method, self, *args, **kwargs)
    220 """show traceback on failed format call"""
    221 try:
--> 222     r = method(self, *args, **kwargs)
    223 except NotImplementedError:
    224     # don't warn on NotImplementedErrors
    225     return self._check_return(None, args[0])

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/IPython/core/formatters.py:973, in MimeBundleFormatter.__call__(self, obj, include, exclude)
    970     method = get_real_method(obj, self.print_method)
    972     if method is not None:
--> 973         return method(include=include, exclude=exclude)
    974     return None
    975 else:

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/graphviz/jupyter_integration.py:98, in JupyterIntegration._repr_mimebundle_(self, include, exclude, **_)
     96 include = set(include) if include is not None else {self._jupyter_mimetype}
     97 include -= set(exclude or [])
---> 98 return {mimetype: getattr(self, method_name)()
     99         for mimetype, method_name in MIME_TYPES.items()
    100         if mimetype in include}

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/graphviz/jupyter_integration.py:98, in <dictcomp>(.0)
     96 include = set(include) if include is not None else {self._jupyter_mimetype}
     97 include -= set(exclude or [])
---> 98 return {mimetype: getattr(self, method_name)()
     99         for mimetype, method_name in MIME_TYPES.items()
    100         if mimetype in include}

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/graphviz/jupyter_integration.py:112, in JupyterIntegration._repr_image_svg_xml(self)
    110 def _repr_image_svg_xml(self) -> str:
    111     """Return the rendered graph as SVG string."""
--> 112     return self.pipe(format='svg', encoding=SVG_ENCODING)

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/graphviz/piping.py:99, in Pipe.pipe(self, format, renderer, formatter, quiet, engine, encoding)
     52 def pipe(self,
     53          format: typing.Optional[str] = None,
     54          renderer: typing.Optional[str] = None,
   (...)
     57          engine: typing.Optional[str] = None,
     58          encoding: typing.Optional[str] = None) -> typing.Union[bytes, str]:
     59     """Return the source piped through the Graphviz layout command.
     60 
     61     Args:
   (...)
     97         '<?xml version='
     98     """
---> 99     return self._pipe_legacy(format,
    100                              renderer=renderer,
    101                              formatter=formatter,
    102                              quiet=quiet,
    103                              engine=engine,
    104                              encoding=encoding)

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/graphviz/_tools.py:172, in deprecate_positional_args.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
    163     wanted = ', '.join(f'{name}={value!r}'
    164                        for name, value in deprecated.items())
    165     warnings.warn(f'The signature of {func.__name__} will be reduced'
    166                   f' to {supported_number} positional args'
    167                   f' {list(supported)}: pass {wanted}'
    168                   ' as keyword arg(s)',
    169                   stacklevel=stacklevel,
    170                   category=category)
--> 172 return func(*args, **kwargs)

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/graphviz/piping.py:114, in Pipe._pipe_legacy(self, format, renderer, formatter, quiet, engine, encoding)
    106 @_tools.deprecate_positional_args(supported_number=2)
    107 def _pipe_legacy(self,
    108                  format: typing.Optional[str] = None,
   (...)
    112                  engine: typing.Optional[str] = None,
    113                  encoding: typing.Optional[str] = None) -> typing.Union[bytes, str]:
--> 114     return self._pipe_future(format,
    115                              renderer=renderer,
    116                              formatter=formatter,
    117                              quiet=quiet,
    118                              engine=engine,
    119                              encoding=encoding)

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/graphviz/piping.py:139, in Pipe._pipe_future(self, format, renderer, formatter, quiet, engine, encoding)
    136 if encoding is not None:
    137     if codecs.lookup(encoding) is codecs.lookup(self.encoding):
    138         # common case: both stdin and stdout need the same encoding
--> 139         return self._pipe_lines_string(*args, encoding=encoding, **kwargs)
    140     try:
    141         raw = self._pipe_lines(*args, input_encoding=self.encoding, **kwargs)

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/graphviz/backend/piping.py:196, in pipe_lines_string(engine, format, input_lines, encoding, renderer, formatter, quiet)
    192 cmd = dot_command.command(engine, format,
    193                           renderer=renderer, formatter=formatter)
    194 kwargs = {'input_lines': input_lines, 'encoding': encoding}
--> 196 proc = execute.run_check(cmd, capture_output=True, quiet=quiet, **kwargs)
    197 return proc.stdout

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/graphviz/backend/execute.py:83, in run_check(cmd, input_lines, encoding, capture_output, quiet, **kwargs)
     81     assert kwargs.get('input') is None
     82     assert iter(input_lines) is input_lines
---> 83     proc = _run_input_lines(cmd, input_lines, kwargs=kwargs)
     84 else:
     85     proc = subprocess.run(cmd, **kwargs)

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/site-packages/graphviz/backend/execute.py:109, in _run_input_lines(cmd, input_lines, kwargs)
    106 for line in input_lines:
    107     stdin_write(line)
--> 109 stdout, stderr = popen.communicate()
    110 return subprocess.CompletedProcess(popen.args, popen.returncode,
    111                                    stdout=stdout, stderr=stderr)

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/subprocess.py:1149, in Popen.communicate(self, input, timeout)
   1146     endtime = None
   1148 try:
-> 1149     stdout, stderr = self._communicate(input, endtime, timeout)
   1150 except KeyboardInterrupt:
   1151     # https://bugs.python.org/issue25942
   1152     # See the detailed comment in .wait().
   1153     if timeout is not None:

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/subprocess.py:2000, in Popen._communicate(self, input, endtime, orig_timeout)
   1993     self._check_timeout(endtime, orig_timeout,
   1994                         stdout, stderr,
   1995                         skip_check_and_raise=True)
   1996     raise RuntimeError(  # Impossible :)
   1997         '_check_timeout(..., skip_check_and_raise=True) '
   1998         'failed to raise TimeoutExpired.')
-> 2000 ready = selector.select(timeout)
   2001 self._check_timeout(endtime, orig_timeout, stdout, stderr)
   2003 # XXX Rewrite these to use non-blocking I/O on the file
   2004 # objects; they are no longer using C stdio!

File ~/checkouts/readthedocs.org/user_builds/jupyterstarters/conda/stable/lib/python3.10/selectors.py:416, in _PollLikeSelector.select(self, timeout)
    414 ready = []
    415 try:
--> 416     fd_event_list = self._selector.poll(timeout)
    417 except InterruptedError:
    418     return ready

KeyboardInterrupt: 

copy, like all the starters, makes use of the Contents API directly. Existing files will not be overwritten.

Python

"type": "python"

"callable": "<a dotted notation python function>"

A Python Starter is a function. This type has the fewest limitations, as it has full access to the StarterManager (and by extension, it’s parent, the NotebookApp). This powers both the Cookiecutter the Notebook starters, with the latter directly using the notebook server’s Kernel Manager to start short-lifespan kernels.

%%dot
digraph g { compound=true layout=dot rankdir=TB
    node[shape=none fontname="sans-serif"]
    graph[fontname="sans-serif" fontcolor="grey" color="none" fillcolor="#eeeeee" style=filled]
    label="a notional execution of a python starter"
    subgraph cluster_files { label="Your Files"
        files
    }
    
    subgraph cluster_server { label="Notebook Server"
        get[label="/starters" fontname=monospace]
        post[label="/starters/{:name}/{:path}" fontname=monospace]
        contents
        callable             
    }

    subgraph cluster_lab { label="JupyterLab"
        launcher
    }
    
    get -> launcher[label=①]
    launcher -> post[label=②]
    post -> callable[label=③]
    callable -> contents[label=④]
    contents -> files[label=⑤]
    files -> contents[label=⑥]
    contents -> callable[label=⑦]
    callable -> post[label=⑧]
    post -> launcher[label=⑨]
    launcher -> launcher[label=⑩]
}

Notebook

"type": "notebook"

A notebook can be a starter. Each starter run gets its own, private kernel which can persist between interactions with the user. Communication with the server manager is handled through manipulating a copy of the notebook, specfically the notebook metadata. The advantages of this approach over the Python starter is:

  • works with any installed kernel

  • state is maintained between successive re-executions

  • jupyterlab-starters provides authoring support for editing and validating the starter

%%dot
digraph g { compound=true layout=dot rankdir=TB title="woooo"
    node[shape=none fontname="sans-serif"]
    graph[fontname="sans-serif" fontcolor="grey" color="none" fillcolor="#eeeeee" style=filled]
    label="a notional execution of a notebook starter"
    subgraph cluster_files { label="Your Files"
        files
    }
    
    subgraph cluster_server { label="Notebook Server"
        get[label="/starters" fontname=monospace]
        post[label="/starters/cookiecutter/{:path}" fontname=monospace]
        contents
        kernel
        tmpdir
    }

    subgraph cluster_lab { label="JupyterLab"
        launcher
        form1[label="initial form"]
        form2[label="dynamic form"]
    }

    get -> launcher[label=①]
    launcher -> form1[label=②]
    form1 -> post[label=③]
    post -> tmpdir[label=④]
    tmpdir -> post[label=⑤]
    tmpdir -> kernel[label=⑥]
    kernel -> tmpdir[label=⑦]
    post -> form2[label=⑧]
    form2 -> post[label=⑨]
    post -> tmpdir[label=⑩]
    tmpdir -> kernel[label=⑪]
    kernel -> tmpdir[label=⑫]
    tmpdir -> contents[label=⑬]
    contents -> files[label=⑭]
    files -> contents[label=⑮]
    contents -> post[label=⑯]
    post -> launcher[label=⑰]
    launcher -> launcher[label=⑲]
}

Built-ins

Cookiecutter

The cookiecutter starter will be available if cookiecutter is installed in the same Python environment as the notebook server.

Find more cookiecutter URLs on GitHub by topic or advanced search.

One of the original motivations for Jupyter Starters was a way to provide a convenient, consistent, web-based experience for the cookiecutter ecosystem. Briefly, a cookiecutter is:

  • a repository, zip archive, or directory that contains

    • cookiecutter.json

    • a (potentially nested) directory that uses Jinja2 to describe file names and contents

What they may lack in dynamism, the make up for in consistency and robustness.

%%dot
digraph g { compound=true layout=dot rankdir=TB title="woooo"
    node[shape=none fontname="sans-serif"]
    graph[fontname="sans-serif" fontcolor="grey" color="none" fillcolor="#eeeeee" style=filled]
    label="a notional execution of the cookiecutter starter"
    subgraph cluster_files { label="Your Files"
        files
    }
    
    subgraph cluster_server { label="Notebook Server"
        get[label="/starters" fontname=monospace]
        post[label="/starters/cookiecutter/{:path}" fontname=monospace]
        contents
        cookiecutter
    }

    subgraph cluster_lab { label="JupyterLab"
        launcher
        form1[label="template form"]
        form2[label="cookiecutter form"]
    }
    get -> launcher[label=①]
    launcher -> form1[label=②]
    form1 -> post[label=③]
    post -> cookiecutter[label=④]
    cookiecutter -> git[label=⑤]
    git -> cookiecutter[label=⑥]
    cookiecutter -> post[label=⑧]
    post -> form2[label=⑨]
    form2 -> post[label=⑩]
    post -> cookiecutter[label=⑪]
    cookiecutter -> contents[label=⑫]
    contents -> files[label=⑬]
    files -> contents[label=⑭]
    contents -> post[label=⑮]
    post -> launcher[label=⑯]
    launcher -> launcher[label=⑰]
}

Under the hood, the cookiecutter starter is implemented as a Python starter, and can be seen as tutorial in how to create a starter from a complex piece of existing functionality.

Extras

Starter Tree URL

By specifying a special URL when starting JupyterLab, you can immediately start a Starter, without requiring the launcher. The pattern is:

{:protocol}://{:host}:{:port}{:base-url}/lab{:whatever}?starter/{:starter-name}{:starter-path}

For example:

http://localhost:8888/lab?starter=cookiecutter/

On Binder, this path is determined by the urlpath GET parameter, for example:

https://mybinder.org/v2/gh/deathbeds/jupyterlab-starters/master?urlpath=lab%3Fstarter%2Fcookiecutter%2Fexamples%2F

For Users

Pre-requisites

Before you begin, you’ll need JupyterLab 3.

pip install jupyterlab=3

conda or mamba is also highly recommended, once you have heavy custom dependencies:

conda install -c conda-forge jupyterlab=3

Installing

Get up and running fast with pip:

pip install --pre jupyter_starters

…or conda:

TBD

Extras

Cookiecutter

jupyter_starters integrates with (but doesn’t require) cookiecutter. It also uses importlib_resources to populate the curated “pantry” of cookiecutters. Again, install it with pip

pip install cookiecutter importlib_resources

or conda

conda install -c conda-forge cookiecutter importlib_resources

CLI

You can list your available starters with the jupyter starters list CLI.

!jupyter starters list --help
List all installed starters.

Options
=======
The options below are convenience aliases to configurable class-options,
as listed in the "Equivalent to" description-line of the aliases.
To see all configurable class-options for some <cmd>, use:
    <cmd> --help-all

--debug
    set log level to logging.DEBUG (maximize logging output)
    Equivalent to: [--Application.log_level=10]
--show-config
    Show the application's configuration (human-readable format)
    Equivalent to: [--Application.show_config=True]
--show-config-json
    Show the application's configuration (json format)
    Equivalent to: [--Application.show_config_json=True]
--generate-config
    generate default config file
    Equivalent to: [--JupyterApp.generate_config=True]
-y
    Answer yes to any questions instead of prompting.
    Equivalent to: [--JupyterApp.answer_yes=True]
--json
    List starters as JSON instead of YAML
    Equivalent to: [--StartersListApp.json=True]
--log-level=<Enum>
    Set the log level by value or name.
    Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
    Default: 30
    Equivalent to: [--Application.log_level]
--config=<Unicode>
    Full path of a config file.
    Default: ''
    Equivalent to: [--JupyterApp.config_file]

To see all available configurables, use `--help-all`.

For Developers

and other adventurous scientists

Use Cases

The Demo

I built a cool Binder (and even included ?urlpath=lab/tree/tutorial.ipynb to open a notebook) to showcase my library, but when visitors get to their Binder, they still have to read a notebook and shift+enter their way through my example to see the plot at the end.

A starter can increase engagement by:

  • creating personalized content

  • running JupyterLab commands on the users behalf, including the mighty Run All Cells

  • launching a starter directly, with a Starter Tree URL

The Chore

When my scientists start a new experiment they hope will become reproducible research, they start a new folder that contains a notebook, a spreadsheet and a few other artifacts. Sometimes they don’t do it… quite right.

A starter can enhance reproducibility by:

  • automating boring chores

  • standardizing file names

Packaging Starters

Starters are configured through the traitlets system. As of notebook 5.3, these configurations can be packaged as simple files. Here’s a quick example, assuming the following file structure:

my-project:
  - setup.py
  - MANIFEST.in
  # other good stuff like LICENSE, README.md, CHANGELOG.md, CODE_OF_CONDUCT.md
  - src:
      - my_project:
          - __init__.py
          - foo.py
          - my-starter-folder:
              - my-starter-file.json
          - etc:
              - my-project-starter.json

MANIFEST.in

# the usual suspects
include LICENSE README.md CHANGELOG.md CODE_OF_CONDUCT.md
# ensure the starter is included in the source distribution
recursive-include src *.json

setup.py

import setuptools

setuptools.setup(
    ...
    include_package_data=True,
    data_files=[
        (
            "etc/jupyter/jupyter_server_config.d",
            ["src/my_project/etc/my-project-starter.json"],
        )
    ]
    zip_safe=False
)

my-project-starter.json

{
  "StarterManager": {
    "extra_starters": {
      "my-project-starter": {
        "label": "My Starter",
        "description": "copies a JSON file to your working directory",
        "type": "copy",
        "py_src": "my_project",
        "src": "my-starter-folder/my-starter-file.json"
      }
    }
  }
}

Note that all paths should be /-delimited, even on Windows.

src can be absolute or relative to the cwd of the running notebook server…

This is not very useful when packaging, as these values cannot be known in advance!

Starter copy and notebook types, in addition to src, can use a py_src of any importable module as a portable “anchor” without

  • having to know the details of the installed location

  • or executing/importing any arbitrary code until the user requests it

However, because of how dynamic the python import system is (see importnb), giving a dotted module, e.g. my_module.foo does cause the top-level module to be imported.

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.

REST API

jupyter_starters adds two routes to the Notebook server, which are primarily consumed by the @deathbeds/jupyterlab-starters JupyterLab extension.

Starter List

GET http://localhost:8888/starters

Returns a named map of starters, as loaded via traitlets. For example, the demo starters:

import json
import pathlib

import IPython

from jupyter_starters.handlers import VERSION

HERE = pathlib.Path.cwd()
starters = json.loads((HERE.parent.parent / "jupyter_server_config.json").read_text())[
    "StarterManager"
]["extra_starters"]
IPython.display.Markdown(
    f"""```json
{json.dumps({
    "version": VERSION,
    "starters": starters
}, indent=2, sort_keys=True) }
```"""
)
{
  "starters": {
    "multi-stage-notebook": {
      "description": "Build a directory one file at a time",
      "label": "Multi-Stage Starter Notebook",
      "src": "./examples/Multi-Stage Starter Notebook.ipynb",
      "type": "notebook"
    },
    "notebook-starter": {
      "description": "A notebook that is also a starter",
      "label": "Starter Notebook",
      "src": "./examples/Starter Notebook.ipynb",
      "type": "notebook"
    },
    "whitepaper-multiple": {
      "description": "Some reusable notebooks for proposing research",
      "icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'><g class='jp-icon-contrast1' fill='#ccc'><circle cx='24' cy='24' r='24'/></g></svg>",
      "label": "Whitepaper Folder",
      "src": "examples/whitepaper-multiple",
      "type": "copy"
    },
    "whitepaper-named": {
      "description": "A renamed whitepaper",
      "dest": "{% now 'local' %} {{ dest }} Whitepaper.ipynb",
      "icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><g class='jp-icon-contrast3' fill='#ccc'><rect width='100' height='100'/></g></svg>",
      "label": "Named Whitepaper",
      "schema": {
        "description": "> A whitepaper that already has a name, based on the [Heilmeier Catechism](https://www.darpa.mil/work-with-us/heilmeier-catechism).",
        "properties": {
          "dest": {
            "default": "Unimagined",
            "description": "the _topic_ of the whitepaper",
            "title": "## Topic",
            "type": "string"
          }
        },
        "required": [
          "dest"
        ],
        "title": "# A Named whitepaper",
        "type": "object"
      },
      "src": "examples/whitepaper-single.ipynb",
      "type": "copy",
      "uiSchema": {
        "dest": {
          "ui:autofocus": true,
          "ui:help": "keep it short and simple: it will go in $1$ file named: `<topic> Whitepaper.ipynb`"
        }
      }
    },
    "whitepaper-single": {
      "description": "A reusable notebook for proposing research",
      "label": "Whitepaper Notebook",
      "src": "examples/whitepaper-single.ipynb",
      "type": "copy"
    }
  },
  "version": "2"
}

Starter

POST http://localhost:8888/starters/{:starter-name}/{:api-path}

Returns a start response, e.g.

{
  "body": null,
  "name": "whitepaper-single",
  "path": "whitepaper-single.ipynb",
  "starter": {
    "type": "copy",
    "label": "Whitepaper Notebook",
    "description": "A reusable notebook for proposing research",
    "src": "examples/whitepaper-single.ipynb"
  },
  "status": "done"
}

Jupyter Starters JSON Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json

A collection of JSON types for configuring and operating Starters

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Cannot be instantiated

Yes

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json

Jupyter Starters JSON Type

object (Jupyter Starters JSON)

any of

Jupyter Starters JSON Definitions

Definitions group all-starters

Reference this group by using

{
  "$ref": "https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/all-starters"
}

Property

Type

Required

Nullable

Defined by

starters

object

Required

cannot be null

Jupyter Starters JSON

running

array

Optional

cannot be null

Jupyter Starters JSON

version

string

Required

cannot be null

Jupyter Starters JSON

starters

a named set of Starters

starters

starters Type

object (Starters)

running

Starters currently using a process/resource

running

running Type

string[]

version

The version of the Jupyter Starters API

version

version Type

string (API Version)

version Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"2"

Definitions group starters

Reference this group by using

{
  "$ref": "https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starters"
}

Property

Type

Required

Nullable

Defined by

Additional Properties

Merged

Optional

cannot be null

Jupyter Starters JSON

Additional Properties

Additional properties are allowed, as long as they follow this schema:

additionalProperties Type

object (Starter)

any of

Definitions group start-response

Reference this group by using

{
  "$ref": "https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/start-response"
}

Property

Type

Required

Nullable

Defined by

starter

Merged

Required

cannot be null

Jupyter Starters JSON

status

string

Required

cannot be null

Jupyter Starters JSON

name

string

Required

cannot be null

Jupyter Starters JSON

body

object

Required

cannot be null

Jupyter Starters JSON

path

string

Required

cannot be null

Jupyter Starters JSON

copy

boolean

Optional

cannot be null

Jupyter Starters JSON

errors

array

Optional

cannot be null

Jupyter Starters JSON

starter

the current definition of the starter: may change during multi-step starters

starter

starter Type

object (Starter)

any of

status

the current state of the Starter

status

status Type

string (Status)

status Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"error"

"continuing"

"done"

name

the canonical name of the starter

name

name Type

string (Name)

body

user data populated by the client

body

body Type

object (Body)

path

the API path (/ delimited) to which files will be written

path

path Type

string (API Path)

copy

copy files after starter is run (irrespective of status) if true

copy

copy Type

boolean (Force Copy)

errors

a listing of system and user errors created during a starter

errors

errors Type

string[] (Error Text)

Definitions group starter

Reference this group by using

{
  "$ref": "https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter"
}

Property

Type

Required

Nullable

Defined by

type

string

Required

cannot be null

Jupyter Starters JSON

type

type

type Type

string (Starter Type)

Definitions group starter-meta

Reference this group by using

{
  "$ref": "https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-meta"
}

Property

Type

Required

Nullable

Defined by

label

string

Required

cannot be null

Jupyter Starters JSON

description

string

Required

cannot be null

Jupyter Starters JSON

icon

string

Optional

cannot be null

Jupyter Starters JSON

commands

array

Optional

cannot be null

Jupyter Starters JSON

ignore

array

Optional

cannot be null

Jupyter Starters JSON

schema

object

Optional

cannot be null

Jupyter Starters JSON

uiSchema

object

Optional

cannot be null

Jupyter Starters JSON

label

human-readable, plain-text description used in UI labels and tab titles

label

label Type

string (Label)

description

short, plain-text description of the intent of the Starter

description

description Type

string (Description)

icon

SVG string to use in Launcher cards and tab icons

icon

icon Type

string (Icon)

commands

JupyterLab commands to run after the Starter has completed

commands

commands Type

object[] (JupyterLab Command)

ignore

glob-style patterns for folders and files exclude from copying, with * for wildcards

ignore

ignore Type

string[]

schema

Draft 7 JSON Schema that generates a form like this one, which must validate the user’s data. Description fields may include markdown

schema

schema Type

object (JSON Schema)

uiSchema

react-jsonschema-form uiSchema for customizing the selection of widgets

uiSchema

uiSchema Type

object (UI Schema)

Definitions group command

Reference this group by using

{
  "$ref": "https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/command"
}

Property

Type

Required

Nullable

Defined by

id

string

Required

cannot be null

Jupyter Starters JSON

args

object

Optional

cannot be null

Jupyter Starters JSON

id

canonical name for the command

id

id Type

string (Command ID)

args

optional values provided to the command when executed

args

args Type

object (Arguments)

Definitions group starter-copy

Reference this group by using

{
  "$ref": "https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-copy"
}

Property

Type

Required

Nullable

Defined by

type

string

Optional

cannot be null

Jupyter Starters JSON

type

Signifies a copy type

type

type Type

string (Copy Type)

type Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"copy"

Definitions group starter-copy-with-dest

Reference this group by using

{
  "$ref": "https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-copy-with-dest"
}

Property

Type

Required

Nullable

Defined by

dest

string

Required

cannot be null

Jupyter Starters JSON

dest

The file or folder to copy to: Jinja templates will be applied with body as the context

dest

dest Type

string (Copy Destination)

Definitions group starter-notebook

Reference this group by using

{
  "$ref": "https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-notebook"
}

Property

Type

Required

Nullable

Defined by

type

string

Optional

cannot be null

Jupyter Starters JSON

type

Signifies a notebook starter

type

type Type

string (Notebook Type)

type Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"notebook"

Definitions group starter-python

Reference this group by using

{
  "$ref": "https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-python"
}

Property

Type

Required

Nullable

Defined by

type

string

Optional

cannot be null

Jupyter Starters JSON

callable

string

Required

cannot be null

Jupyter Starters JSON

type

Signifies a python starter

type

type Type

string (Python Type)

type Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"python"

callable

a python function that accepts the body

callable

callable Type

string (Python Callable)

callable Constraints

pattern: the string must match the following regular expression:

[a-zA-Z_\d\.]

try pattern

Definitions group starter-with-src

Reference this group by using

{
  "$ref": "https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-with-src"
}

Property

Type

Required

Nullable

Defined by

src

string

Required

cannot be null

Jupyter Starters JSON

py_src

string

Optional

cannot be null

Jupyter Starters JSON

src

path to the starter. may be absolute or relative to the notebook launch directory (or py_src)

src

src Type

string (Starter Source)

py_src

name of a python module installed in the notebook environment to prepent to src

py_src

py_src Type

string (Starter Python Source)

All JSON Schema

API Version Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/all-starters/properties/version

The version of the Jupyter Starters API

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

version Type

string (API Version)

version Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"2"

Untitled string in Jupyter Starters JSON Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/all-starters/properties/running/items

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

items Type

string

Running Starters Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/all-starters/properties/running

Starters currently using a process/resource

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

running Type

string[]

All Starters Server Response Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/all-starters

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

No

Forbidden

Allowed

none

v2.json*

all-starters Type

object (All Starters Server Response)

all-starters Properties

Property

Type

Required

Nullable

Defined by

starters

object

Required

cannot be null

Jupyter Starters JSON

running

array

Optional

cannot be null

Jupyter Starters JSON

version

string

Required

cannot be null

Jupyter Starters JSON

starters

a named set of Starters

starters

starters Type

object (Starters)

running

Starters currently using a process/resource

running

running Type

string[]

version

The version of the Jupyter Starters API

version

version Type

string (API Version)

version Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"2"

Copy Type Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-copy/properties/type

Signifies a copy type

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

type Type

string (Copy Type)

type Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"copy"

Copy Starter Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-copy-with-dest/allOf/0

All the properties from a Copy Starter

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

No

Forbidden

Allowed

none

v2.json*

0 Type

object (Copy Starter)

all of

0 Properties

Property

Type

Required

Nullable

Defined by

type

string

Optional

cannot be null

Jupyter Starters JSON

type

Signifies a copy type

type

type Type

string (Copy Type)

type Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"copy"

Copy Destination Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-copy-with-dest/properties/dest

The file or folder to copy to: Jinja templates will be applied with body as the context

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

dest Type

string (Copy Destination)

Copy with Destination Starter Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-copy-with-dest

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

No

Forbidden

Allowed

none

v2.json*

starter-copy-with-dest Type

object (Copy with Destination Starter)

all of

starter-copy-with-dest Properties

Property

Type

Required

Nullable

Defined by

dest

string

Required

cannot be null

Jupyter Starters JSON

dest

The file or folder to copy to: Jinja templates will be applied with body as the context

dest

dest Type

string (Copy Destination)

Arguments Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/command/properties/args

optional values provided to the command when executed

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

args Type

object (Arguments)

Command ID Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/command/properties/id

canonical name for the command

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

id Type

string (Command ID)

JupyterLab Command Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-meta/properties/commands/items

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

No

Forbidden

Allowed

none

v2.json*

items Type

object (JupyterLab Command)

items Properties

Property

Type

Required

Nullable

Defined by

id

string

Required

cannot be null

Jupyter Starters JSON

args

object

Optional

cannot be null

Jupyter Starters JSON

id

canonical name for the command

id

id Type

string (Command ID)

args

optional values provided to the command when executed

args

args Type

object (Arguments)

Notebook Type Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-notebook/properties/type

Signifies a notebook starter

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

type Type

string (Notebook Type)

type Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"notebook"

Notebook Starter Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-notebook

Uses a notebook as both the configuration object (in #/metadata/jupyter-starters) and execution

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

No

Forbidden

Allowed

none

v2.json*

starter-notebook Type

object (Notebook Starter)

all of

starter-notebook Properties

Property

Type

Required

Nullable

Defined by

type

string

Optional

cannot be null

Jupyter Starters JSON

type

Signifies a notebook starter

type

type Type

string (Notebook Type)

type Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"notebook"

Python Callable Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-python/properties/callable

a python function that accepts the body

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

callable Type

string (Python Callable)

callable Constraints

pattern: the string must match the following regular expression:

[a-zA-Z_\d\.]

try pattern

Python Type Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-python/properties/type

Signifies a python starter

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

type Type

string (Python Type)

type Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"python"

Python Starter Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-python

Invokes an importable python function (multiple times)

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

No

Forbidden

Allowed

none

v2.json*

starter-python Type

object (Python Starter)

all of

starter-python Properties

Property

Type

Required

Nullable

Defined by

type

string

Optional

cannot be null

Jupyter Starters JSON

callable

string

Required

cannot be null

Jupyter Starters JSON

type

Signifies a python starter

type

type Type

string (Python Type)

type Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"python"

callable

a python function that accepts the body

callable

callable Type

string (Python Callable)

callable Constraints

pattern: the string must match the following regular expression:

[a-zA-Z_\d\.]

try pattern

API Path Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/start-response/properties/path

the API path (/ delimited) to which files will be written

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

path Type

string (API Path)

Body Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/start-response/properties/body

user data populated by the client

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

body Type

object (Body)

Error Text Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/start-response/properties/errors/items

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

items Type

string (Error Text)

Errors Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/start-response/properties/errors

a listing of system and user errors created during a starter

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

errors Type

string[] (Error Text)

Force Copy Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/start-response/properties/copy

copy files after starter is run (irrespective of status) if true

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

copy Type

boolean (Force Copy)

Name Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/start-response/properties/name

the canonical name of the starter

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

name Type

string (Name)

Status Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/start-response/properties/status

the current state of the Starter

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

status Type

string (Status)

status Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"error"

"continuing"

"done"

Start Response Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/start-response

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

No

Forbidden

Allowed

none

v2.json*

start-response Type

object (Start Response)

start-response Properties

Property

Type

Required

Nullable

Defined by

starter

Merged

Required

cannot be null

Jupyter Starters JSON

status

string

Required

cannot be null

Jupyter Starters JSON

name

string

Required

cannot be null

Jupyter Starters JSON

body

object

Required

cannot be null

Jupyter Starters JSON

path

string

Required

cannot be null

Jupyter Starters JSON

copy

boolean

Optional

cannot be null

Jupyter Starters JSON

errors

array

Optional

cannot be null

Jupyter Starters JSON

starter

the current definition of the starter: may change during multi-step starters

starter

starter Type

object (Starter)

any of

status

the current state of the Starter

status

status Type

string (Status)

status Constraints

enum: the value of this property must be equal to one of the following values:

Value

Explanation

"error"

"continuing"

"done"

name

the canonical name of the starter

name

name Type

string (Name)

body

user data populated by the client

body

body Type

object (Body)

path

the API path (/ delimited) to which files will be written

path

path Type

string (API Path)

copy

copy files after starter is run (irrespective of status) if true

copy

copy Type

boolean (Force Copy)

errors

a listing of system and user errors created during a starter

errors

errors Type

string[] (Error Text)

Commands Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-meta/properties/commands

JupyterLab commands to run after the Starter has completed

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

commands Type

object[] (JupyterLab Command)

Description Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-meta/properties/description

short, plain-text description of the intent of the Starter

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

description Type

string (Description)

Icon Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-meta/properties/icon

SVG string to use in Launcher cards and tab icons

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

icon Type

string (Icon)

Untitled string in Jupyter Starters JSON Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-meta/properties/ignore/items

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

items Type

string

Ignore Files Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-meta/properties/ignore

glob-style patterns for folders and files exclude from copying, with * for wildcards

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

ignore Type

string[]

JSON Schema Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-meta/properties/schema

Draft 7 JSON Schema that generates a form like this one, which must validate the user’s data. Description fields may include markdown

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

schema Type

object (JSON Schema)

Label Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-meta/properties/label

human-readable, plain-text description used in UI labels and tab titles

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

label Type

string (Label)

UI Schema Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-meta/properties/uiSchema

react-jsonschema-form uiSchema for customizing the selection of widgets

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

uiSchema Type

object (UI Schema)

Starter Metadata Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-python/allOf/0

common metadata for Starters

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

No

Forbidden

Allowed

none

v2.json*

0 Type

object (Starter Metadata)

0 Properties

Property

Type

Required

Nullable

Defined by

label

string

Required

cannot be null

Jupyter Starters JSON

description

string

Required

cannot be null

Jupyter Starters JSON

icon

string

Optional

cannot be null

Jupyter Starters JSON

commands

array

Optional

cannot be null

Jupyter Starters JSON

ignore

array

Optional

cannot be null

Jupyter Starters JSON

schema

object

Optional

cannot be null

Jupyter Starters JSON

uiSchema

object

Optional

cannot be null

Jupyter Starters JSON

label

human-readable, plain-text description used in UI labels and tab titles

label

label Type

string (Label)

description

short, plain-text description of the intent of the Starter

description

description Type

string (Description)

icon

SVG string to use in Launcher cards and tab icons

icon

icon Type

string (Icon)

commands

JupyterLab commands to run after the Starter has completed

commands

commands Type

object[] (JupyterLab Command)

ignore

glob-style patterns for folders and files exclude from copying, with * for wildcards

ignore

ignore Type

string[]

schema

Draft 7 JSON Schema that generates a form like this one, which must validate the user’s data. Description fields may include markdown

schema

schema Type

object (JSON Schema)

uiSchema

react-jsonschema-form uiSchema for customizing the selection of widgets

uiSchema

uiSchema Type

object (UI Schema)

Starter Type Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter/properties/type

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

type Type

string (Starter Type)

Starter Python Source Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-with-src/properties/py_src

name of a python module installed in the notebook environment to prepent to src

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

py_src Type

string (Starter Python Source)

Starter Source Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-with-src/properties/src

path to the starter. may be absolute or relative to the notebook launch directory (or py_src)

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

src Type

string (Starter Source)

Starter with Files Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter-with-src

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

No

Forbidden

Allowed

none

v2.json*

starter-with-src Type

object (Starter with Files)

starter-with-src Properties

Property

Type

Required

Nullable

Defined by

src

string

Required

cannot be null

Jupyter Starters JSON

py_src

string

Optional

cannot be null

Jupyter Starters JSON

src

path to the starter. may be absolute or relative to the notebook launch directory (or py_src)

src

src Type

string (Starter Source)

py_src

name of a python module installed in the notebook environment to prepent to src

py_src

py_src Type

string (Starter Python Source)

Starter Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starter

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

No

Forbidden

Allowed

none

v2.json*

starter Type

object (Starter)

any of

starter Properties

Property

Type

Required

Nullable

Defined by

type

string

Required

cannot be null

Jupyter Starters JSON

type

type

type Type

string (Starter Type)

Starters Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions/starters

a named set of Starters

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

starters Type

object (Starters)

starters Properties

Property

Type

Required

Nullable

Defined by

Additional Properties

Merged

Optional

cannot be null

Jupyter Starters JSON

Additional Properties

Additional properties are allowed, as long as they follow this schema:

additionalProperties Type

object (Starter)

any of

Untitled undefined type in Jupyter Starters JSON Schema

https://raw.githubusercontent.com/deathbeds/jupyterlab-starters/master/src/jupyter_starters/schema/v2.json#/definitions

Abstract

Extensible

Status

Identifiable

Custom Properties

Additional Properties

Access Restrictions

Defined In

Can be instantiated

No

Unknown status

Unknown identifiability

Forbidden

Allowed

none

v2.json*

definitions Type

unknown

For Posterity

import pathlib

import IPython

HERE = pathlib.Path.cwd()

CHANGELOG

jupyter_starters 1.1.0

  • #62 adds a CLI tool, jupyter starters list (with option --json)

  • #68 remove cookiecutter metadata parsing, as it no longer works consistently

  • #69 minimum python is now 3.7

  • #71 support cookiecutter 1.7.1 directory argument, jupyter-server-proxy example

@deathbeds/jupyterlab-starters 1.1.0

@deathbeds/jupyterlab-rjsf 1.1.0

  • #66 formData is now honored when constructing a form

  • #69 upgrade to @rjsf/core 3


jupyter_starters 1.0.2

  • #54 adapt kernel shutdown to newer jupyter_client >=6.1 API

@deathbeds/jupyterlab-starters 1.0.2

@deathbeds/jupyterlab-rjsf 1.0.2

  • #56 upgrade to @rjsf/core 2.5.1


jupyter_starters 1.0.1a0

  • #51 update of @deathbeds/jupyterlab-rjsf and @deathbeds/jupyterlab-starters.

@deathbeds/jupyterlab-starters 1.0.1a0

  • #51 uses new @deathbeds/jupyterlab-rjsf API

@deathbeds/jupyterlab-rjsf 1.0.1a0

  • #51 make more exports lazy loading


jupyter_starters 1.0.0a0

  • #48 support JupyterLab 3.x

    • it is now only necessary (and supported) to pip install this package to also install JupyterLab extensions

    • JupyterLab 1/2-style installation for user Lab Apps is no longer tested

    • for downstreams extensions, releases will continue on npmjs.org

      • versions sycned to the python package

      • on-going API support TBD

Breaking changes

  • due to upstream changes, the router URL has, for now, has changed from:

    • /lab/tree/starter/<starter>/<path> to

    • ?starter=<starter>/<path>

@deathbeds/jupyterlab-rjsf 1.0.0a0

  • #48 support JupyterLab 3.x

@deathbeds/jupyterlab-starters 1.0.0a0

  • #48 support JupyterLab 3.x


jupyter_starters 0.6.0a0

  • #45 use new @deathbeds/jupyterlab-starters 0.6.0a0

  • #45 be more specific on URL patterns

@deathbeds/jupyterlab-rjsf 0.6.0a0

  • #45 upgrade @rjsf/core for anyOf fixes

  • #45 upgrade react-codemirror2

@deathbeds/jupyterlab-starters 0.6.0a0

  • #45 use new @deathbeds/jupyterlab-rjsf 0.6.0a0


jupyter_starters 0.5.0a0

  • #41 handle more recent cookiecutter metadata

@deathbeds/jupyterlab-rjsf 0.5.0a0

  • #41 upgrade react-jsonschema-form to @rjsf/core

@deathbeds/jupyterlab-starters 0.5.0a0

  • #41 upgrade @deathbeds/jupyterlab-rjsf


@deathbeds/jupyterlab-rjsf 0.4.0a0

  • #38 split out rjsf into its own package

@deathbeds/jupyterlab-starters 0.4.0a0

  • #38 depend on @deathbeds/jupyterlab-rjsf

jupyter_starters 0.4.0a0

  • Updated for parity with frontend


jupyter_starters 0.3.0a0

  • #39 adds listing and stopping of currently-running kernels to REST API

@deathbeds/jupyterlab-starters 0.3.0a0

  • #39 supports JupyterLab 2.0

  • #39 adds listing and stopping of running kernel-backed starters


jupyter_starters 0.2.2a0

  • #23 rename _json module to json_, start documentation site in earnest

@deathbeds/jupyterlab-starters 0.2.2a0

  • #29 some updated class names based on schema

  • #34 add stauts indicator for starting/continuing

  • #35 add /lab/tree/starter/<starter>/<path> URL router


jupyter_starters 0.2.1a0

  • #25 add py_src for easier distribution of starters

  • #25 add unit tests

  • #29 handle minimally specified notebook metadata

@deathbeds/jupyterlab-starters 0.2.1a0

  • #29 handle minimally specified notebook metadata


jupyter_starters 0.2.0a0

  • #13 add notebook as starter

  • #18 add copying files and commands while starter is continuing

@deathbeds/jupyterlab-starters 0.2.0a0

  • #13 add notebook metadata authoring

  • #17 add Jupyter markdown to title, description and ui:help in schema forms

  • #18 all starters launch in right sidebar

  • #21 enable CodeMirror for JSON, Markdown, etc. editing


jupyter_starters 0.1.0a3

  • make optional dependency messages only appear in debug mode

jupyter_starters 0.1.0a2

  • add ignore patterns to schema

  • fix default ignore patterns

@deathbeds/jupyterlab-starters 0.1.0a2

  • add glob ignore patterns to schema


jupyter_starters 0.1.0a1

  • add more sources of config

@deathbeds/jupyterlab-starters 0.1.0a0

  • initial implementation

jupyter_starters 0.1.0a0

  • initial implementation

ROADMAP

  • [ ] Adopt some well-known locations for more user-serviceable starters

  • [ ] Add generic script type

  • [ ] Add preview/dry-run

  • [ ] Add better error handling and logging

  • [ ] Explore json-e integration

  • [ ] Add starter builder with command explorer

License

IPython.display.Markdown(
    f"""```
{(HERE / ".." / ".." / "LICENSE").read_text()}
```"""
)
BSD 3-Clause License

Copyright (c) 2022, dead pixels collective
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.