LabSpecification#

pydantic model controller.models.v1.lab.LabSpecification#

Specification of lab to spawn, sent by the JupyterHub spawner.

This model is used for the POST body of the /spawner/v1/labs/username/create route.

Parameters:

data (Any) –

Show JSON schema
{
   "title": "LabSpecification",
   "description": "Specification of lab to spawn, sent by the JupyterHub spawner.\n\nThis model is used for the POST body of the\n:samp:`/spawner/v1/labs/{username}/create` route.",
   "type": "object",
   "properties": {
      "options": {
         "allOf": [
            {
               "$ref": "#/$defs/LabRequestOptions"
            }
         ],
         "description": "Represents the choices made on the spawner form",
         "title": "User-chosen lab options"
      },
      "env": {
         "additionalProperties": {
            "type": "string"
         },
         "description": "Environment variables from JupyterHub. The variable ``JUPYTERHUB_SERVICE_PREFIX`` must be set.",
         "title": "Environment variables",
         "type": "object"
      }
   },
   "$defs": {
      "ImageClass": {
         "description": "Supported classes of images.\n\nThese keywords can be passed into the spawn form to spawn whatever image\nmatches this class, as determined by the lab controller. This is primarily\nused when spawning notebooks for bot users.",
         "enum": [
            "recommended",
            "latest-release",
            "latest-weekly",
            "latest-daily"
         ],
         "title": "ImageClass",
         "type": "string"
      },
      "LabRequestOptions": {
         "description": "User-provided lab configuration options.\n\nThis model represents the form submission to the spawner HTML form\npresented to the user by JupyterHub.\n\nAll values to this model can instead be given as lists of length one, with\nboolean values converted to the strings ``true`` or ``false``. This is the\nform in which the values are received by the JupyterHub spawner form\nprocessing code, and allows JupyterHub to pass its form submission\ndirectly to the lab controller without modifications.",
         "properties": {
            "size": {
               "allOf": [
                  {
                     "$ref": "#/$defs/LabSize"
                  }
               ],
               "description": "Size of image, chosen from sizes specified in the controller configuration",
               "examples": [
                  "medium"
               ],
               "title": "Image size"
            },
            "enable_debug": {
               "default": false,
               "description": "If true, set the ``DEBUG`` environment variable when spawning the lab, which enables additional debug logging",
               "examples": [
                  true
               ],
               "title": "Enable debugging in spawned Lab",
               "type": "boolean"
            },
            "reset_user_env": {
               "default": false,
               "description": "If true, set the ``RESET_USER_ENV`` environment variable when spawning the lab, which tells the lab to move aside the user environment directories (``.cache``, ``.conda``, ``.jupyter``, ``.local``) and files (``.user_setups``). This can be used to recover from user configuration errors that break lab startup.",
               "examples": [
                  true
               ],
               "title": "Move aside user environment",
               "type": "boolean"
            },
            "image_list": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Selected image from the radio button part of the image menu, or the special value ``use_image_from_dropdown``. If this is set, to a value other than ``use_image_from_dropdown``, ``image_dropdown`` should not be set.",
               "examples": [
                  "lighthouse.ceres/library/sketchbook:w_2023_07@sha256:abcd"
               ],
               "title": "Image from selection radio button"
            },
            "image_dropdown": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Selected image from the dropdown part of the image menu. If this is set, ``image_list`` should be omitted or set to ``use_image_from_dropdown``.",
               "examples": [
                  "lighthouse.ceres/library/sketchbook:w_2022_40"
               ],
               "title": "Image from dropdown list"
            },
            "image_class": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ImageClass"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Spawn a class of image determined by the lab controller. Not used by the user form, but may be used by bots creating labs. Only one of ``image_class`` or ``image_tag`` may be given, and neither ``image_list`` nor ``image_dropdown`` should be set when using these options.",
               "examples": [
                  "recommended"
               ],
               "title": "Class of image to spawn"
            },
            "image_tag": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Spawn the image with the given tag. Not used by the user form, but may be used by bots creating labs. Only one of ``image_class`` or ``image_tag`` may be given, and neither ``image_list`` nor ``image_dropdown`` should be set when using these options.",
               "examples": [
                  "w_2023_07"
               ],
               "title": "Tag of image to spawn"
            }
         },
         "required": [
            "size"
         ],
         "title": "LabRequestOptions",
         "type": "object"
      },
      "LabSize": {
         "description": "Allowable names for pod sizes.\n\nTaken from `d20 creature sizes`_.",
         "enum": [
            "fine",
            "diminutive",
            "tiny",
            "small",
            "medium",
            "large",
            "huge",
            "gargantuan",
            "colossal",
            "custom"
         ],
         "title": "LabSize",
         "type": "string"
      }
   },
   "required": [
      "options",
      "env"
   ]
}

Fields:
Validators:
  • _validate_env » env

field env: dict[str, str] [Required]#

Environment variables from JupyterHub. The variable JUPYTERHUB_SERVICE_PREFIX must be set.

Validated by:
  • _validate_env

field options: LabRequestOptions [Required]#

Represents the choices made on the spawner form