nbprint.config.core.Parameters

pydantic model nbprint.config.core.Parameters[source]

Bases: ContextBase, BaseModel

Show JSON schema
{
   "title": "Parameters",
   "type": "object",
   "properties": {
      "tags": {
         "items": {
            "type": "string"
         },
         "title": "Tags",
         "type": "array"
      },
      "role": {
         "$ref": "#/$defs/Role",
         "default": "parameters"
      },
      "ignore": {
         "default": true,
         "title": "Ignore",
         "type": "boolean"
      },
      "css": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "format": "path",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "",
         "title": "Css"
      },
      "esm": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "format": "path",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "",
         "title": "Esm"
      },
      "classname": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": "",
         "title": "Classname"
      },
      "attrs": {
         "anyOf": [
            {
               "additionalProperties": {
                  "type": "string"
               },
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "title": "Attrs"
      }
   },
   "$defs": {
      "Role": {
         "enum": [
            "undefined",
            "configuration",
            "context",
            "outputs",
            "parameters",
            "content",
            "page",
            "layout"
         ],
         "title": "Role",
         "type": "string"
      }
   }
}

Fields:
  • ignore (bool)

  • role (nbprint.config.base.Role)

  • tags (list[str])

field tags: Annotated[list[str], SerializeAsAny()] [Optional]
field role: Role = Role.PARAMETERS
field ignore: bool = True
generate(metadata: dict, **_) NotebookNode[source]

Generate a notebook node for this model. This will be called before the runtime of the notebook, use it for code generation.

Args:

metadata (dict): common cell metadata

Returns:

NotebookNode: the content of the notebook node

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.