jellycell.format.tags

Parse jupytext cell-tag lists into :class:CellSpec instances.

Tags in jupytext percent format live in cell.metadata.tags as a list of strings (spec §7). Examples::

["jc.load", "name=raw"]
["jc.step", "name=summary", "deps=raw"]
["jc.step", "name=summary", "deps=raw", "deps=env"]    # multi-dep
["jc.step", "deps=raw;env"]                            # semicolon syntax
["jc.figure", "deps=summary", "timeout=60"]

nbformat’s JSON schema forbids commas in tag strings (^[^,]+$). Multi-dep cells must use either multiple deps= tags or ; as the separator. render_tags always emits multiple deps= tags so the output is nbformat-safe.

Module Contents

Functions

parse_tags

Parse a tag list into a :class:CellSpec.

render_tags

Inverse of :func:parse_tags — produce a canonical tag list for a spec.

Data

API

jellycell.format.tags.KIND_TAGS: dict[str, jellycell.format.cells.CellKind]

None

exception jellycell.format.tags.TagParseError

Bases: ValueError

Raised for malformed cell tags.

Initialization

Initialize self. See help(type(self)) for accurate signature.

jellycell.format.tags.parse_tags(tags: list[str]) jellycell.format.cells.CellSpec

Parse a tag list into a :class:CellSpec.

Unknown jc.* tags raise :class:TagParseError; unknown non-jc.* tags are ignored (jupytext/papermill/etc. may set their own). Multiple deps= tags accumulate.

jellycell.format.tags.render_tags(spec: jellycell.format.cells.CellSpec) list[str]

Inverse of :func:parse_tags — produce a canonical tag list for a spec.

Emits one deps=<name> tag per dep so the output round-trips through nbformat’s ^[^,]+$ constraint on tag strings.