Spawners

Module: jupyterhub.spawner

Class for spawning single-user notebook servers.

Spawner

class jupyterhub.spawner.Spawner(**kwargs)

Base class for spawning single-user notebook servers.

Subclass this, and override the following methods:

  • load_state
  • get_state
  • start
  • stop
  • poll
get_args()

Return the arguments to be passed after self.cmd

get_env()

Return the environment dict to use for the Spawner.

This applies things like env_keep, anything defined in Spawner.environment, and adds the API token to the env.

Use this to access the env in Spawner.start to allow extension in subclasses.

get_state()

store the state necessary for load_state

A black box of extra state for custom spawners. Subclasses should call super.

Returns:state – a JSONable dict of state
Return type:dict
options_from_form(form_data)

Interpret HTTP form data

Form data will always arrive as a dict of lists of strings. Override this function to understand single-values, numbers, etc.

This should coerce form data into the structure expected by self.user_options, which must be a dict.

Instances will receive this data on self.user_options, after passing through this function, prior to Spawner.start.

poll()

Check if the single-user process is running

return None if it is, an exit status (0 if unknown) if it is not.

start()

Start the single-user process

stop(now=False)

Stop the single-user process

class jupyterhub.spawner.LocalProcessSpawner(**kwargs)

A Spawner that just uses Popen to start local processes as users.

Requires users to exist on the local system.

This is the default spawner for JupyterHub.