nbprint.config.core.Outputs

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

Bases: ResultBase, BaseModel

Show JSON schema
{
   "title": "Outputs",
   "type": "object",
   "properties": {
      "tags": {
         "items": {
            "type": "string"
         },
         "title": "Tags",
         "type": "array"
      },
      "role": {
         "$ref": "#/$defs/Role",
         "default": "outputs"
      },
      "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"
      },
      "root": {
         "default": "/home/runner/work/nbprint/nbprint/outputs",
         "format": "path",
         "title": "Root",
         "type": "string"
      },
      "naming": {
         "default": "{{name}}-{{date}}",
         "title": "Naming",
         "type": "string"
      },
      "embedded": {
         "default": false,
         "description": "Whether this output is expected to run from its embedding inside the notebook.",
         "title": "Embedded",
         "type": "boolean"
      },
      "hook": {
         "default": null,
         "title": "Hook"
      },
      "postprocess": {
         "default": null,
         "title": "Postprocess"
      }
   },
   "$defs": {
      "Role": {
         "enum": [
            "undefined",
            "configuration",
            "context",
            "outputs",
            "parameters",
            "content",
            "page",
            "layout"
         ],
         "title": "Role",
         "type": "string"
      }
   }
}

Fields:
  • embedded (bool)

  • hook (ccflow.exttypes.pyobjectpath.PyObjectPath | None)

  • ignore (bool)

  • naming (str)

  • postprocess (ccflow.exttypes.pyobjectpath.PyObjectPath | None)

  • role (nbprint.config.base.Role)

  • root (pathlib.Path)

  • tags (list[str])

field root: Path = PosixPath('/home/runner/work/nbprint/nbprint/outputs')
field naming: str = '{{name}}-{{date}}'
field tags: Annotated[list[str], SerializeAsAny()] [Optional]
field role: Role = Role.OUTPUTS
field ignore: bool = True
field embedded: bool = False

Whether this output is expected to run from its embedding inside the notebook.

field hook: PyObjectPath | None = None

A callable hook that is called after generation of the notebook. It is passed the config instance. If it returns something non-None, that value is returned by run instead of the output path.

field postprocess: PyObjectPath | None = None

A callable hook that is called after all processing completes. It is passed the config instance/s. NOTE: It may receive multiple Configuration instances, if a parameterized run was performed.

property notebook: Path
property executed_notebook: Path
property output: Path
run(config: Configuration, gen: NotebookNode) Path[source]
generate(metadata: dict, **kwargs) 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.