Changelog#
3.0.0 (2026-11-05)#
2.1.2 and 2.1.3 were not released: their changes are in this release (#227).
ipyelk 3.0.0#
Known issues#
With JupyterLab 4.6 and ipykernel 7.4, an
interactslider can stop sending updates to the kernel (#232, ipykernel#1565). Set Settings > Kernels > Comms over subshells (commsOverSubshells) todisabledto avoid concurrent slider callbacks. Administrators can use{"@jupyterlab/apputils-extension:kernels-settings": {"commsOverSubshells": "disabled"}}inoverrides.json. See the JupyterLab discussion.Separately, widget updates during an awaiting cell can stall, including the automatic text-sizing and layout replies needed by
await diagram.refresh(). This can happen without user interaction and also affects older kernel and widget combinations. Disabling subshells does not address this case. Start the refresh without awaiting it in that cell, let the cell return, then check completion and errors in a later cell. While it is pending, let the kernel return to idle; do not wait in a loop inside the cell.First cell, after making the intended diagram changes:
refresh_task = diagram.refresh()
Later cell; run it again after allowing idle time if the refresh is still pending:
if refresh_task is None: raise RuntimeError("Refresh was not scheduled: no running event loop") if not refresh_task.done(): print("Refresh is still running; check again in a later cell.") else: refresh_task.result() # raises a task failure or cancellation diagram.pipe.error() # raises any captured pipeline error print("Refresh completed.")
This avoids keeping the cell open during the browser roundtrip. If widget updates have already stopped, restart the kernel and rerun the notebook. The startup workaround below applies only to robot-test kernels, not installed ipyelk, examples, documentation kernels, or user kernels.
Breaking changes#
Tools no longer replace the pipe’s pending flow when they run.
Toolmerges itsreportsintotee.inlet.flow(order preserved, duplicates dropped) through the newTool.record_reports(), so two tools triggered in the same turn – or a tool triggered while the initial("new",)flow is still unconsumed – keep every writer’s pending reports.ToggleCollapsedTool.runno longer assigns the flow itself (#156).Viewer.fit()/Viewer.center()now carry the fullSprottyViewersignatures (model_ids: str | Sequence[str] | None, plus the animate/zoom/padding keywords) and are documented no-ops on the generic viewer.model_idsaccepts one id or any sequence of ids (astris one id, never its characters);list[str]still works. The baseViewer’s Fit/Center buttons no longer raiseTypeErrorwhen clicked (#156).Tool invocation and lifecycle names each have one role (#156):
Tool.trigger()requests execution (cancels a running request, schedulesrun(), returns theasyncio.Task);Tool.handleris removed.ToolButton.on_clickreplaces thehandlertrait; it is called ason_click(tool).SetTool’sactiveobserver is the private_update_active; it is not an execution entry point.Tool.on_start(callback)replaceson_run. It fires when the work actually starts (2.xon_runfired after a successful run, despite its name).Tool.on_done(callback)is a registration method (several listeners; the owningDiagramregisters its refresh there), no longer an assignable single-slot trait. Callbacks receive the tool and fire only afterrun()completes successfully and its change reports are recorded – never on failure, cancellation, or a request rejected bytrigger().Reports are recorded when the work finishes (successfully or not), so partial changes from failed or cancelled work still reach the next refresh; a request superseded by a newer
trigger()never overwrites the newer request’s state.trigger()on a tool without arun()(state-only tools such asSelection, callback tools such asToolButton) raisesNotImplementedErrorbefore anything is scheduled; nothing is faked.Every callback receives the emitting object:
Toolbar.on_closeis typedCallableand called ason_close(toolbar).Diagram.refresh(sender=None)ignores its argument (it waschange).
Tool.disabledreplaces the inert, synceddisabletrait (nothing ever read it). It is an execution guard:trigger()andToolButtonclicks are rejected withRuntimeErrorwhile the tool is disabled (nothing is scheduled, no callback fires), and every control undertool.uithat has adisabledtrait follows it – buttons and the buttons insideSetTool’s box, but not boxes or progress bars, which have no such trait (#156).Unbound tools are a supported state:
PipelineProgressBar.pipe,ToggleCollapsedTool.selectionandSetTool.selectionareNoneuntil bound (they used to raiseTraitErroron read), so a tool can be constructed first and bound later (Diagram.register_tool, assignment, or the progress bar’s firstupdate). While a dependency listed in the tool’s_dependenciesisNone,Tool.missing_dependencies()names it, the tool’s controls are disabled, andtrigger()raisesRuntimeErrornaming the missing dependency (#156).Selection.elements()stays strict by default (an unknown id raisesNotFoundErrornaming it) and gains explicit tolerant resolution:elements(strict=False)skips unknown ids andmissing_ids()reports them, both inidsorder. Requested ids are never filtered on assignment, so selecting before the first layout keeps working.get_index()now builds the index when the pipe’sMarkIndexhas no elements yet (it only checked for a missingMarkIndex, which always exists) (#156).Toolbar.order()andToolbar.tool_order()are annotated as returning tool UIs (dict[int, list[DOMWidget]]/list[DOMWidget]), which is what they always returned, and document that tools without auiare omitted.Selection.idsis documented as the tuple it is; the01_Linkingexample compares it to a tuple (its list comparison was always true), and the12/13examples drop commented-out references to the long-gonetoolbar.commands(#156).Hover.idsis replaced byHover.hovered_id: str | None(defaultNone). No alias exists: code that reads or observesidson the hover tool must switch tohovered_id. Despite its name,idsonly ever held one id (a string, never a tuple), so the value shape is unchanged; only the trait name and theNonestate are new.Selection.idsis unchanged and still a tuple (#155).Leaving an element now clears the hover:
hovered_idbecomesNonewhen the pointer leaves the diagram’s elements (it previously kept the last hovered id forever). Observers that only expect strings must handleNone(#155).Viewer.control_overlayis opt-in and defaults toNone; assign aControlOverlay(e.g.view.control_overlay = ControlOverlay()) before setting itschildren. The browser renders no overlay container forNoneor for an overlay withoutchildren(previously every selection rendered an empty<id>_entropynode), and re-renders when the overlay’schildrenchange (#156).ipyelk.tools.contol_overlay(sic) is renamed toipyelk.tools.control_overlaywithout an alias (#156).Viewer.viewport(anipyelk.tools.Viewport) replaces the never-writtenZoomandPantools and theViewer.viewedtrait with real viewport synchronization (#156). The browser reports the camera of the most recently reporting view as one snapshot –view_id,origin,zoom,canvas_size,viewed_ids– so an observer of any field sees all five updated together. It is not a global viewport: several views of one diagram stay independent and each report names its view. The traits are read-only in the kernel (the browser is the only writer) andNoneuntil the first report.viewed_idslists the model elements whose bounds touch the visible rectangle, in model order; edges, renderer artifacts and the slack ports/edges that stand in for hidden elements are never listed.SprottyViewer.set_viewport(*, origin=None, zoom=None, animate=True, view_id=None)moves the camera (a command, likefit/center, never a trait):Nonekeeps the view’s current origin/zoom,view_id=Nonemoves every connected view (#156).Viewer.painter(anipyelk.tools.Painter) is live: temporary, view-only styling (#156).painter.paint(ids, *css_classes)adds classes to the rendered elements in every connected view without touchingproperties.cssClasses– a re-layout re-applies them, the ELK/model JSON never changes, and exported SVG shows them.unpaint(ids, *css_classes)removes classes (with none given, drops the ids),clear()removes everything the painter applied and never a class the model set,painted_ids,elements(strict=True)andmissing_ids()mirrorSelection. Targets are ids (astris one id) or elements (stored asget_id()); the syncedstylestrait isdict[str, tuple[str, ...]]. The unfinished 2.x placeholderscssClasses,marksandnameare removed.Removed names are hard errors for the whole 3.x line, not aliases or warnings:
Tool.handler,ToolButton.handler,Tool.on_run,Tool.disable,Hover.ids,Viewer.zoom,Viewer.pan,Viewer.viewed,ipyelk.tools.Zoom,ipyelk.tools.Pan,Painter.cssClasses,Painter.marks,Painter.name, and assigningTool.on_startorTool.on_doneraiseipyelk.exceptions.DeprecatedAPIError(anAttributeError, sohasattr,getattr(..., default)and introspection keep working) on read, assignment, and as constructor keywords, with the reason and the replacement in the message (mechanism:ipyelk.exceptions.RemovedAPI/RegistrationMethod/check_removed). The removed module-level names raiseipyelk.exceptions.DeprecatedImportErrorinstead, which is anImportErrorand not anAttributeError, becausefrom ipyelk.tools import Zoomwould otherwise lose the message to a bare “cannot import name”. Importing the misspelledipyelk.tools.contol_overlaymodule raises it too, naming the new path; it re-exports nothing. Both flavors share theipyelk.exceptions.DeprecatedAPIbase, so oneexceptcatches either.Raise on a closed diagram or pipeline instead of silently accepting the call. A closed widget has no comm, so the call never reached the browser.
refresh(),register_tool()and settingsource,pipe,view,tools,toolbar,symbolsorstyleon a closedDiagramraiseipyelk.exceptions.ClosedError(aTraitErrorand aRuntimeError) naming its class, as doschedule_run()on a closedPipeand settingpipesor callingrun()on a closedPipeline.Diagram.closedandPipe.closedsay whetherclose()was called. A refusedpipesset keeps the stages; it used to empty them. A diagram whose pipe was closed raises onrefresh(). A run in flight when its pipeline closes is cancelled before the next stage or successful completion, even when a progress callback closes it or the cancel comes from another event loop during the final stage; the taskrefresh()returned then resolves cancelled, soawait diagram.refresh()raisesCancelledError. The closed pipe and its interrupted stages reportcancelledinstead of stayingrunning, without firing progress callbacks or updating closed widgets. An error raised by a stage after its pipeline closes is treated as cancellation, including aClosedErrorfrom another closed widget. A run that failed just before the close keeps its exception, and the closed pipe logs a warning naming it instead of callingon_error. A queued refresh callback does not update a closed diagram. Closed tools that implementrun()rejecttrigger(), and closedToolButtons reject button callbacks withClosedError, including tools closed with their diagram. Closing a diagram twice still does nothing (#197).Raise on four more assignments to a closed widget. Setting
Diagram.layoutorDiagram.childrenon a closedDiagram, orPipeline.inletorPipeline.outleton a closedPipeline, raisesClosedErrorwith the same message as the other traits. These assignments did not raise. A closed widget has no comm, so the browser did not show the change (#198).A closed tool names its class in the
ClosedErrorfromtrigger()and button clicks, as a closed diagram or pipe does: “ToggleCollapsedTool is closed and cannot run; build a new ToggleCollapsedTool”. It used to say “use a new tool”.Tool.closedsays whetherclose()was called, likeDiagram.closedandPipe.closed. The refusal depends on the tool only: a tool that left a diagram’stoolsbefore the diagram closed stays open and still runs. The view’s own tools, such asSelectionandFitTool, close with the view (#218).ElementIndex.root(), and socheck_ids(),check_edges()andMarkIndex.root(), raisesipyelk.exceptions.NotFoundErrorwhen every node in the index has a parent, andNotUniqueError, naming the roots, when more than one node has none. It used to fail anassertwith the message “Multiple roots” for no root, and to take the first of several roots without a word, so the checks skipped the other trees (#217). A child put inchildrenafter its parent is made, as withchildren.append(), has no parent link, so it is a second root and the first layout fails: add it withadd_child()instead.Remove code that nothing used: the
ipyelk.pipes.mappingsmodule, theGraphWrappingStrategy.horizontaltrait, andElkLabel.__eq__/__hash__, which served a text sizer cache that is gone. Importingipyelk.pipes.mappingsraisesDeprecatedImportError: nothing replaces itsEdgeandPortclasses or itsNodeMap,EdgeMapandPortMapaliases (#217).ipyelk.elements.layout_options.modelkeeps only the tag classes thatLayoutOptionWidget.applies_touses:ElkGraphElement,ElkNode,ElkPort,ElkEdgeandElkLabel. They have no fields, soElkLabel(id="l1", text="hello")raisesTypeErrorthat namesipyelk.elements.Label. The generated ELK JSON data classes, for exampleElkPointandElkShape, their converter functions, for examplefrom_dict, and theElkRootandElkNullElementsentinels had no users. Their imports raiseDeprecatedImportError, and nothing replaces them.strip_nonemoved toipyelk.util.strip_none. Its old import shows aDeprecationWarningthat names the new place, and still works. 4.0 removes it (#214).Layout options are checked against the options that the bundled
elkjsknows, and the option classes that ELK ignored without an error now take effect, so layouts can change (#29):EdgeSpacing,EdgeNodeSpacing,EdgeLabelSpacing,EdgeEdgeLayerSpacingandEdgeNodeLayerSpacinguse thespacing.edgeEdge,spacing.edgeNode,spacing.edgeLabel,layered.spacing.edgeEdgeBetweenLayersandlayered.spacing.edgeNodeBetweenLayersids (they usedelk.edge.*ids that do not exist). Record nodes setEdgeNodeSpacing(spacing=0), which now applies.LayoutPartitioningusespartitioning.activate(waspartitioning.active).ConsiderModelOrderuseslayered.considerModelOrder.strategy(waslayered.considerModelOrder), applies only to parents, and offersPREFER_NODES.ContentAlignmentloses the tab character at the start of its id.PortAlignmentEast,PortAlignmentWest,PortAlignmentNorthandPortAlignmentSouthsubclassPortAlignment, so they have a value, a control and apply to nodes.LabelPortHorizontalSpacingandLabelPortVerticalSpacingreplaceLabelPortSpacing, because ELK has nospacing.labelPortoption.LabelPortSpacingstill works, emits aDeprecationWarningand sets the horizontal spacing.The
LayoutAlgorithmchoices no longer offer Draw2D (org.eclipse.elk.conn.gmf.layouter.Draw2D), becauseelkjsdoes not have it and a layout with it failed. ImportingDraw2DLayoutraisesDeprecatedImportErrorthroughout 3.x, with the algorithms to use instead in the message.
layoutOptionson elements is typedLayoutOptions(dict[str, str], fromipyelk.elements), like the ELK JSON schema. Validation writesboolvalues as"true"or"false"and numbers as strings. This includes thenumpyscalars, for examplenp.bool_,np.int64andnp.float64, andFractionandDecimal. A number that is not an integer becomes a plainfloatfirst, sonp.float64(12.5)becomes"12.5". A whole-numberfloatbelow2**53in magnitude loses its fraction (2.0becomes"2"), because ELK ignores an integer option with the value"2.0". A largerfloatkeeps the formreprgives it (1e16becomes"1e+16"). Validation raisesValidationErrorfornan, an infinity,None, any other value, or a key that is not a string; 2.x accepted them. Serialization writesboolvalues and numbers as strings too, so a value set in place (node.layoutOptions[key] = 20) goes to ELK as"20". ANoneset in place makes serialization raise aPydanticSerializationError(aValueError) that names the key. Withexclude_none=True, serialization drops that key instead, so ELK uses the option’s default.OptionsWidget.valueonly accepts string keys and values (#31).ELK JSON loads each shape as the class of its type string, through
convert_elkjson,from_elkjsonand the value that comes back from the frontend. So aPath,CommentorWidgetkeeps its class and its fields. 2.x loaded every shape as the shape class of its element, for exampleNodeShape.CircleandEllipseshare the type stringnode:round, and the JSON does not hold their radii, so anode:roundshape loads as anEllipseof the same size. Anode:widgetshape loads with the widget that has themodel_idinuse. If no open widget has thatmodel_id, for example because the widget closed, ELK JSON loads the shape as aNodeShapewith the same JSON, and ipyelk warns. JSON that the class of its type string rejects now raisesValidationError, where 2.x loaded it: for example anode:pathshape withoutuse, or anode:widgetshape in user code with no open widget. A second shape class with a type string that is already taken warns and replaces the first class (#153).The elements, their properties and their shapes raise
ValidationError(typeextra_forbidden) for a key that they do not have, at construction. 2.x ignored the key, so a typo such asNode(hieght=5)did nothing. Assignment does not change. For an unknown key, an element and its properties already raisedValidationError(typeno_such_attribute) in 2.x, and a shape still raisesValueError. The classes areNode,Port,Label,Edge,EdgeSectionand their subclasses, the properties classes and the shape classes. A shape also rejects a field of another shape class, for exampleRect(start="arrow").layoutOptionsstays open. ELK JSON still loads:convert_elkjson,from_elkjson, the value that comes back from the frontend and thenetworkxloader ignore the keys that the models do not have. The newipyelk.elements.from_wire(Node, data)loads a dictionary in the same way. APointignores an unknown key, also in user code, and no longer raisesTypeErrorfor one in ELK JSON. The15_Nesting_Plotsexample no longer passeskey=NonetoNode, which now rejects it (#153).The
usefield of each shape class has a type of its own, and the type string of the shape selects it, in Python, in TypeScript and inelkschema.json(#148):Comment.useis a number of pixels (NotchSize), not a string:Comment(use=20).use == 20.0, and the JSON holds20.0. A string of a number, as 2.x wrote it, still loads as the number.validate_elk_jsonrejects the string, because the schema describes the JSON of 3.0. A notch of 0 draws no notch. 2.x drew 15 pixels for it. A notch that is not a number, is negative,nan, an infinity or aboolraisesValidationError. The renderer limits the notch to the size of the node.The
useof aPathmust be SVG path data that starts withMormand a number (PathData). The symbol identifier (SymbolId) of aUse, anIcon, aPortShapeor aLabelShape, and the URL (ImageUrl) of anImage, must not be empty.Rect,Circle,EllipseandDiamondhave no payload: theirusemust beNone.Widget(widget=w, use="other")raises: theuseof aWidgetis themodel_idof its widget. 2.x dropped the value. Only a construction and an assignment ofusecheck it, and not while the widget is closed.Every shape validates an assignment as it validates a construction. 2.x validated an assignment only on
Comment.NodeShape,PortShapeandLabelShapekeep a stringusefor the payload of a custom shape type.
A
NodeShape,PortShape,LabelShapeorElementShapewith the type string of another shape class, such as a built-in one, validatesusewith the type of that class, so its JSON passesvalidate_elk_json.NodeShape(type="node:comment", use="abc")raisesValidationError, asComment(use="abc")does, andNodeShape(type="node:comment", use="20").useis20.0. A type string whose class requiresuse, such asnode:path, requires it here too. 2.x accepted any string. An assignment oftypechecks theusethat the shape has. Anode:widgetshape takes any string orNone, so ELK JSON still loads theNodeShapeof a closed widget. A type string with no class inBaseShape.json_classeskeeps a stringuse(#244).ipyelk.elements.Markandipyelk.elements.MarkFactoryare removed. They served thenetworkxtransformer that 2.0 removed, and nothing used them since. Importing either name, or theipyelk.elements.mark_factorymodule, raisesDeprecatedImportErrorthroughout 3.x. To load anetworkxgraph, useipyelk.from_nxoripyelk.loaders.NXLoader(#160).A
MarkElementWidgetsyncsvaluewith the browser only when a browser stage reads or writes it: the inlet of aSyncedInletPipe, the outlet of aSyncedOutletPipe(ElkJSandBrowserTextSizerare both), and thesourceof a viewer. These call the newMarkElementWidget.sync_value()when they take the mark. Every other mark, for exampleDiagram.source, keepsvaluein the kernel, so the browser no longer receives the tree the user built (at 100 nodes, the comm-open state of the source fell from 59 kB to 376 B).flowis never synced: no browser code reads it, and each refresh sends up to five fewer messages. Browser code that readsvalueof another mark must callsync_value()on it first (#161).A
Registryholds its elements weakly, so it no longer keeps every element that it saw alive. A key that cannot be weakly referenced, such as astr, is held strongly, as in 2.x (#160).A
Document(ipyelk.elements.Document) owns the ids of an element tree. It replaces the global stack ofRegistrycontexts: no ipyelk code enters aRegistryany more.Document(root)writes onto each element without anidthe id that it serializes with (wire_id),resolve(id)returns aResolved(element, via_slack)orNone,document[id]returns the element or raisesNotFoundError,missing(ids)lists the ids that do not resolve, andlookup(ids, strict=True)yields the elements. The index of a pipeline isMarkIndex.document, andMarkIndex.elementsis the id map of that document.MarkIndex.elementsandMarkIndex.contextare properties now, not traits:MarkIndex(elements=...)and assignment still work, butobserve(callback, "elements")never calls the callback.ElementIndex.from_els,VisIndex.from_elsandHierarchicalIndex.from_elsindex an element without anidby itswire_id. In 2.x they raisedValueError(“Cannot index element without an id”) outside aRegistry.SelectionandPainterresolve their ids through the document (the newget_document()), andelements()andmissing_ids()keep their behavior.Painter.paint(element)stores thewire_idof an element that is not indexed yet. In 2.x it raisedValueError(#160).A slack port has its own id: the id of its hidden element plus
.slack(plus another.slackwhile that id is in use). A slack port is the port that the projection adds to the nearest visible ancestor of a hidden element, so that an edge to the hidden element keeps an endpoint. In 2.x it had the id of the hidden element, so two elements had one id. Selecting a slack port still selects the hidden element:Selection.elements()returns it, andDocument.resolvereturns it withvia_slack=True. Theproperties.keyof the slack port is still the id of the hidden element. Code that compares the id of a slack port with the id of a hidden element must useDocument.resolve.Painter.paintof a hidden element no longer styles its slack port, which had the same id in 2.x; paint the slack port id to style it.ElementIndex.updateno longer adds the slack ports of a browser answer to the index (#160).An element under a second parent raises
ValueErrorwhen it is attached, and the message names both parents. While the new parent is constructed, the error is apydantic.ValidationError, which is aValueErrortoo. This applies to a label (Node(labels=[label]),element.labels = [...]), a child node and a port (Node(children=..., ports=...),add_child,add_port). In 2.x a shared label failed later, inValidationPipe, withNonunique Element Ids, and a child or port failed anassert(owned by different node). An element that its old parent no longer holds attaches without an error. A label that is appended tolabelsin place is not checked at attach;ValidationPipestill reports its id.Compartment(bullet_shape=...)gives each content line its own bullet label. It used to share one label, which failed validation (#160).ipyelk.elements.Registryis deprecated and will be removed in 4.0. Constructing one emits aDeprecationWarningthat namesDocumentand the removal version, and aRegistrykeeps working through 3.x.MarkIndex.contextis deprecated in the same way: reading or assigning it warns, and it holds aRegistrythat ipyelk does not read. This is the second tier of the 3.0 policy: a name that worked warns and keeps working, and a name that never worked raises. The11_Logic_Gatesexample usesDocument(#160).MarkIndexis a plaintraitlets.HasTraits, not a widget. It opens no comm and noLayout, andMarkElementWidget.indexis never sent to the browser. Every stage outlet of a pipeline shares the index of the pipeline’s inlet, and the index is built on first read, so oneDiagram()builds no index that it throws away.MarkElementWidgetis aWidget, not aDOMWidget, because no view displays it. Thus, it has nolayout, and its browser model is aWidgetModel. OneDiagram()opens 52 widgets, not the 78 of 2.1.1. These uses break: aMarkIndexused as a widget (.comm,close(),display()orwidget_serialization), browser code that readsmark.get('index'), and code that readslayoutof aMarkElementWidget.MarkIndex.comm,MarkIndex.closeandMarkElementWidget.layoutraiseDeprecatedAPIErrorthroughout 3.x. The index stays shared:source.index.elements = Nonemakes the next run rebuild it, as in 2.x (#237).A source feeds one open diagram.
Diagram(source=...)and an assignment toDiagram.sourceraiseTraitErrorwhen theMarkElementWidgetis the source of another openDiagram. The message names the fix: close the other diagram withsource.diagram.close(), or give this one its ownMarkElementWidget.MarkElementWidget.diagramis the open diagram of a source, orNone. Thus, a notebook can close the diagram of the last run of a cell. In 2.x, both diagrams took the pending changes from one source, so a recorded change did not reach both. Both diagrams also wrote their layout onto the same elements, so the last layout won. A closed diagram releases its source, also when it closes during a run. A diagram releases its old source when it gets a new one. An assignment of a different source also raisesTraitErrorwhile a pipe in the diagram’s pipe is closed: assign a new pipe first. Such a new source used to be wired in, and the next run failed. An assignment of the same source does nothing. To show one diagram in two places, display the sameDiagramtwice (#178).Diagram.viewis fixed after construction. Pass the viewer asDiagram(view=viewer). An assignment of a different viewer raisesTraitError. The diagram’s tools stay bound to the viewer that the diagram started with. In 2.x, the assignment moved the pipe’s output to the new viewer, but the selection, the painter, the Fit and Center buttons andToggleCollapsedToolstill acted on the old viewer. The old viewer also stayed open. An assignment of the same viewer does nothing.Diagram(view=...)also raisesTraitErrorwhen the viewer is closed or is the view of another open diagram. A closed viewer used to be accepted. The construction then failed with anAttributeErrorand left the widgets that it built open (#208).
Migration#
To change 2.x code for 3.0, read Migrating from ipyelk 2.x to 3.0. It has a
section with the 2.x code and the 3.0 code of each breaking change above. Its table of
removed names lists every name that raises
DeprecatedAPIError or DeprecatedImportError, with a link to its section.
Added#
Viewer.cull_offscreen(opt-in, defaultFalse): each view renders only the elements that touch its canvas, so selecting, hovering and panning stay cheap on a large diagram that is zoomed in. Measured in a headless browser: zoomed into a 1,000-node graph, a hover or a pan costs 2-5 ms of render instead of 8-11 ms plus 7 ms of style and layout; on 5,000 nodes, 11-12 ms instead of 46 ms plus 42 ms; where the whole diagram is on screen, nothing is culled and the check costs 0.1-0.6 ms per 1,000 nodes (1-7% of a render). The SVG in the page is then not the whole diagram when the view is zoomed in, which is why it is opt-in: two acceptance suites in this repository count the live DOM at 1:1 right after display.Exporteris unaffected either way: it renders its export from the model, so it is complete at any zoom (#170).Viewer.fit_on_first_layout(defaultFalse) makes each view fit the whole diagram in the browser after its own first layout.Viewer.fit()is a message to the views that exist when it is sent, so a diagram displayed after it was laid out opened at 1:1 in the top-left corner, and so did every later view of it. A view that is hidden at its first layout (in a collapsed accordion or a background tab) fits the first time it is shown. Each view fits once: later layouts (a newsourceincluded), reveals and resizes keep its camera, a view laid out before the trait was set is not fitted, and aset_viewport()sent while a hidden view waits cancels its fit.Viewer.fit_padding(default0, in diagram units) andViewer.fit_max_zoom(defaultNone: only the viewer’s own limit of 10) set the padding and zoom limit of that fit, and offit()calls and Fit button clicks that pass none (#245).Node.clone(prefix)copies a node with everything under it, for a fragment that is used in several places. The copy of an element with the idXhas the id"<prefix>.X", whereXis the id or thewire_idof the original. So two clones with one prefix get the same ids if they copy the same fragment object, or a fragment whose elements all have anid. An element without anidgets a newwire_ideach time its fragment is built again, and so does its copy. The copies have their own parents,layoutOptionsandproperties. Edges inside the fragment connect the copies, and an edge to an element outside the fragment keeps that endpoint.metadataand the widget of aWidgetshape are shared (#160).An opt-in check for layout option keys that ELK ignores without an error. ELK takes a full option id, or the end of one that starts after a dot (
elk.direction,spacing.nodeNode), and the old ids of some options (layered.northOrSouthPort).ipyelk.schema.unknown_layout_options(keys)returns the keys that end no id or more than one:directionalso endslayered.priority.direction.ipyelk.schema.untargeted_layout_options(keys, targets)returns the keys whose option does not apply to that kind of element, for example a node option on an edge.ValidationPipe(check_layout_options=True)writes them per element id tolayout_options_reportandlayout_options_target_report, and emits oneUserWarning. The check is off by default, and turning it off clears both reports. Refs #115.Allow diagram construction without a running event loop.
Pipe.schedule_run()andDiagram.refresh()returnNonewhen they cannot schedule a task.Add optional
LabelProperties.tooltipandLabelProperties.separatorfields.Re-send widget state after a browser reports missing state, with throttling.
Echo terminal progress state twice, cancelling pending echoes on updates and close.
Surface pipe/diagram exceptions via an
on_errorcallback instead of silently dropping them in the asyncio done-callback (F4)Add a configurable
timeoutand a browser→kernel error channel toElkJS/BrowserTextSizerso a failed or silent browser layout no longer hangs the diagram (F6)
Fixed#
Exporterexports every label. The export used to serialize the live SVG, whose label view leaves out labels under 3 pixels tall on screen, so a diagram exported while fitted at a low zoom (any diagram of a few hundred nodes) had no labels. The export is now rendered from the model, at no level of detail and with nothing culled (#170).PyPI shows the license: the wheel and the source distribution declare
License-Expression: BSD-3-Clause AND EPL-1.0 AND EPL-2.0(PEP 639), because the package contains code under each of these licenses, and listLICENSE.txt,COPYRIGHT.mdand the Eclipse Public License (EPL) 1.0 and 2.0 texts asLicense-Files, which the wheel ships under.dist-info/licenses/. 2.1.x had only aLicense ::classifier, so PyPI showed no license. The bundled elkjs and sprotty packages are available under EPL-2.0, and some source files are derived from EPL-1.0 or EPL-2.0 code:COPYRIGHT.mdnames the license of each. The npm package’spackage.jsondeclares the same expression.scripts/check-dist.pyfails the build if the expression changes, if these fields or files go missing, or ifdist/does not hold exactly one wheel and one source distribution of this version. The PyPIChangeloglink points at themasterbranch (#133)Hiding a root-level node with visible edges no longer crashes elkjs:
iter_visiblereported every sibling after a hidden one as hidden and projected a hidden node’s slack port onto its preceding sibling (for a hidden first child of the root, onto the root itself, which elkjs rejects). Hidden compound children now project onto the compound, and an edge whose projection would touch the root is dropped from the wire while itsEdgestays in the index (#161, #169)Never serialize an id as
null: an id-less element mints a wire id once and keeps it, the index adopts it, and an id theRegistrymints first becomes the wire id, so edges no longer go on the wire assources: [null]and the id first seen is the id for the object’s life. Port ids compose from the parent’s id in and out of aRegistry(was<uuid>.<uuid>underNode(id="N")), a copied element mints its own wire id instead of sharing the original’s, andLabel.wrapno longer copies a generated id onto every line (#160, #169)Add nested label spacing regardless of the sublabel width:
size_nested_labelparsedls.width or 0 + spacingasls.width or (0 + spacing)(#161, #169)Stop echoing browser-written state back to the frontends: the selection, the hover and the laid-out graph were re-sent to every attached frontend as soon as the browser wrote them, and the graph was then sent a second time as a re-serialized copy, so every layout arrived back twice and the diagram re-rendered on each. Known limitation, documented on the traits: a second frontend attached to the same kernel no longer learns browser-made selections from that echo (#164, #161)
Keep a refresh that was requested while a run was already in flight: a style change, or a tool that failed after changing the model, recorded itself by overwriting the pipeline’s pending flow, and a completing run cleared that flow by overwriting it in turn — so the request was lost and the change never redrawn. Runs now take the pending flow when they start and put it back if they fail or are cancelled (#164, #160)
Stop throwing away browser work a refresh has already started: a burst of
refresh()calls cancelled the in-flight run and started another, so the browser went on laying out graphs whose results were discarded, and a cancelled run’s answer could be consumed by its successor. Requests are now counted rather than cancelled and one runner serves them on the trailing edge (ten calls in one tick cost one layout), and each roundtrip carries a generation counter, so a re-sent request is recognized as the same work instead of queueing a duplicate layout in the browser and an answer for an abandoned generation is ignored.Pipe.cancel()is now the only thing that stops a run, andpipe._taskis the pipe’s current runner rather than “the run this call just scheduled” (#164, #161)Stop swapping the browser’s laid-out copy into the pipeline’s input: it carried nothing that persisting the result does not already merge into the user’s own elements, but the next run rebuilt the element index from that copy, so a selection resolved to a copy and a hidden node resolved to the slack port sharing its id (#164, #161)
Make edge-owner validation linear in the hierarchy instead of quadratic in it: validating 1000 nodes with 3000 root-owned edges fell from 14.4 s to 0.010 s (500 nodes / 1500 edges, 3.5 s to 0.005 s; 100 / 300, 0.146 s to 0.001 s), and validation no longer re-reports on its outlet when it changed nothing (#164, #161)
Settle a browser roundtrip on the event loop that awaits it: with
ipykernel7 and a frontend that uses kernel subshells (JupyterLab 4.5+, ipywidgets 8.1.8+), widget messages are handled on a subshell thread with its own loop, so an answer written from there did not wake a run started from a cell until the resend timer fired, and arefresh()from a widget callback reused a runner from the other loop and failed silently. Answers are now delivered through the future’s own loop, and a refresh from another loop hands the runner over to the caller’s loop (#164)Stop leaking widgets on every refresh. Each pipe status change created a new
PipeStatuswidget, and a displayed pipeline status view rebuilt its rows. Neither closed what it replaced: 9 widgets leaked per refresh, 145 with the view shown. The status view now rebuilds its rows only when the sub-pipes or their views change, and closes the rows it replaces (#176)PipeStatusis no longer anipywidgets.Widget: it is an immutable value with the same attributes and constructors, compared by identity, so every new status still notifiesstatusobserversPipelineStatusView.statusesis removed. It held the view’s row widgets, was never synced, and is now a private list; the rows still reach the frontend aschildren
Close the old pipeline when
diagram.pipeis replaced. Only its run was cancelled: its sub-pipes, intermediate marks and status views stayed open, and the diagram’sstylelink kept it alive, so every replacement left 37 widgets behind, 99 with the status view shown. A diagram now owns its pipe: replacing it closes the old pipe, its sub-pipes and the widgets they created (including astatus_widgetdisplayed elsewhere), neverdiagram.sourceor an inlet/outlet passed in.Pipe.close()closes what the pipe created (aPipelinealso closes its sub-pipes).style(also for a text sizer in a nested pipeline), the progress bar and the tools now follow the new pipe (#180)A pipe belongs to one diagram, with every pipe nested in it. Assigning a pipe that nests a pipe another open diagram owns raises
TraitError: both diagrams used to share its outlet, so one silently showed the other’s graph. A source feeds one open diagram too (#178)A replaced pipe is closed, so assigning a pipe that nests a closed pipe, or any part of the current pipe (wrapping it, or reusing its stages), raises
TraitErrortoo: build a new pipe insteadThe rule also holds when a pipeline’s
pipeschanges in place, and before aPipelineis wired. Adding another open diagram’s stage to an assigned pipeline was accepted, so the stage ran in both, andPipeline(pipes=[...])rewired a live diagram’s stage before anything could refuse it. Both now raiseTraitErrorand change nothing, as does apipeslist with a closed stage or a stage listed twice (it was wired into a cycle). A stage added in place belongs to the diagram (and gets itsstyle); a stage removed in place is released, not closed (#191)
Close what a diagram owns when the diagram is closed.
Diagram.close()only released its pipe, so the pipe tree, the view, the tools and the toolbar stayed open: every closed diagram left 68 widgets behind, 130 with the status view shown. It now closes them with their layout and style widgets and drops its links to them, and leaves opendiagram.source, an inlet or outlet passed to a pipe, the viewer’scontrol_overlay, and alayoutor tooluipassed in. A closed diagram’s pipe is closed, so another diagram can no longer take it.Tool.close()also closes theuithe tool built, andViewer.close()its tools (#191)Close a default
layoutor tooluithat user code replaced. ADiagram, aVieweror aToolbarclosed thelayoutit built only while it still used that layout, and a tool closed theuiit built only while it still used thatui. Each replacement thus left the default open afterclose(): one widget for alayout, and three for the default button of a tool. A replacement that user code assigned stays open (#198)Keep the record of the stages that a
Pipelineaccepted. APipelinerefuses a new stage that is closed, part of the current pipe, or owned by another open diagram, and it does not check again a stage that it accepted before. Two gaps let a stage skip the check:An observer of
pipesalso wrote the record. A subclass@validatemethod that setpipesunderhold_trait_notifications()skipped the check ofpipes, and the observer then recorded the unchecked stages as accepted. Now only the check, and the default ofpipes, write the record.A kept stage that another diagram took after the
Pipelineaccepted it stayed in both. A kept stage owned by another open diagram now raisesTraitError.A
hold_trait_notifications()block that raised put back the oldpipes, but the record kept the stages that the block had set. Such a stage, once closed, was accepted, and the sync to the browser failed with anAttributeError. Now a closed stage raisesTraitError, also when the record names it (#198)
Log the routine “fixing N ids” message from
ValidationPipeat debug level instead of warning: assigning ids to id-less elements is the normal path (fix_null_id=True), so every diagram built from id-less elements logged itKeep the elements behind a collapsed view intact across layouts (#171, #187):
A hidden port, or a port on a hidden node, keeps its size, position, layout options and properties. The slack port that stands in for it in the layout used to overwrite them with its own 5×5 geometry, permanently. Any other port, including one that moved to another node, still takes its layout from the browser.
Each line of a wrapped label gets its own ids, and so do its sub-labels. The lines of a label with id
Lget the idsL#0,L#1, … (sub-labelsubgetssub#0, …). If another element already uses one of these derived ids, indexing gives that line a fresh id; ids you set yourself never change. Before, every line had the same id (L, or one generated id) and the same sub-label ids. A wrapped line shares its label’smetadata.The ELK JSON schema accepts the slack-port
keyandhiddenproperties, so a projection validates after a collapse and an expand.
Center a
Circlein its node:Circleno longer serializesxandyas itsradius. Thenode:roundrenderer takes its radii from the laid-out node, so a node larger than the circle drew the ellipse off center.xandythat you set are still serialized (#200)Keep a typed shape through a layout round trip.
ElementIndex.updatereplaced every element’spropertieswith the browser’s copy, whose shape parses as the base class: aCirclecame back as aNodeShapewithout itsradius, anIconas aLabelShape, aWidgetwithout its widget, andshape.radius = 20then raised. The frontend never changesproperties, so an element now keeps its own, with its shape object, and an edit made while a layout was in flight is no longer reverted. The laid-outwidthandheightare still written onto the element, where you can read them, but no longer shadow the shape’s size in the input to the next layout: aradiusset after a layout resizes the node at the next one, and aLabelShapethat sets onlywidthnow sends that width, not the measured one, starting with the first layout. Awidthorheightassigned to aLabelis now sent to the layout instead of the measured size, starting with the first layout. A size assigned to the element itself stays the input to every later layout and wins over the shape (#201)Find an existing port when a NetworkX edge’s
sourcePort,targetPortorportis the port’s global id rather than its key.ElementIndexhad no__contains__, so the loader’sport_key in el_mapcheck was always false and it added a second port with that key instead.ElementIndexandHierarchicalIndexnow supportkey in index, by id. A key that is the id of anything other than one of the endpoint’s own ports still makes a new port with that key, as before (#215)from ipyelk.elements import *works. Its__all__namedElementShape, which the package did not import, andcheck_ids, which is an index method. Ruff ruleF822(an undefined name in__all__) is on now, and a test star-imports every module that has an__all__(#217)Stop
Recordfrom making six widgets for each child every time it is serialized, on every syncedvalue, and never closing them: it writes the same size option strings to its children without the option widgets. Amin_heightthat is not a whole number still fails to serialize, now with aValueErrorthat names it, where the widget’sInttrait raised aTraitError(#217)Export the wrapping layout options
GraphWrappingStrategy,AdditionalWrappedEdgesSpacingandCorrectionFactorForWrappingfromipyelk.elements.layout_options: no module imported them (#217)Diagram.register_toolbinds each dependency in the tool’s_dependenciesthat the diagram supplies (diagram,pipe,view, and the view’sselection,hover,viewportandpainter), and still binds adiagramorselectiontrait that a tool does not list. APipelineProgressBaradded this way is bound to the pipe, and gets the progress reports when no other bar has them. A bar moved from another diagram stops getting the reports of that diagram’s pipe (#217)logic_gates.Gatepassesminimum_size(it wasminimun_size, whichtraitletsdropped with a warning). The text sizer sets the style CSS as the text of its<style>element, not as markup (#217)iter_labelsyields every label of each element and its child nodes, each element’s own labels first. It yielded only the first label of each element (#217)Fix
IDReport.message()printing literal{eid}/{el}placeholders (F1)Fix
Pipeline.check()/get_progress_value()crashing on an empty pipeline (F2)Give each
Toolits ownon_runcallback dispatcher (was shared across all tools) (F3)Re-send the browser
runrequest with backoff until a frontend answers, so a pipe run before its diagram is displayed no longer waits on a message nobody received; a browser-reported layout error stops the retries immediately (F10)Treat an errored run as terminal for progress reporting:
PipeStatus.step()returnedNonefor errored pipes, soPipeline.get_progress_value()raisedTypeErrorinside the error path —on_errorsaw theTypeErrorinstead of the layout error, and thePipelineProgressBarsat “in progress” forever; the bar now fills as a visible warning (F10)Keep hidden elements in the shared
MarkIndexacross browser round trips:Node.dict()always drops hidden children, so rebuilding the index from a value that has been through the browser erased them andToggleCollapsedToolcould never reveal them again — nested widgets (such as the15_Nesting_Plotsfigures) never appeared.ElementIndex.update()now merges instead of requiring every id to be known: existing ids update in place, unknown ids are added, which also fixes aNotFoundErrorwhen slack ports introduced byVisibilityPipecome back from a layout (F12)Log a failed layout in
Diagram.refresh()instead of returning silently: a silently failed pipeline is indistinguishable from a hung diagram (F12)Fix the local
TextSizerfallback, which readself.source.value, assignedself.outlet.changesand returnedself.value— none of which exist onPipe— and therefore raised on its first statement (F13)Do not wait on a browser that cannot answer: with
IPYELK_NO_BROWSERset (asnbconvert --executedoes) a pipe gives up its roundtrip immediately instead of keeping a task alive across cell boundaries re-sendingrunrequests for 30 s, which wedged kernels on slower CI runners (F15)NXLoaderfinds the owner of each edge by walking up the parents of its two ends, not withnetworkx.lowest_common_ancestor, which searches the whole hierarchy for each edge. The owners do not change. Loading a random tree of 3,000 nodes and 3,000 edges falls from 3.3 s to 0.4 s. A cycle in the hierarchy still raises aNetworkXError, which now names the cycle. It raises also if no edge joins two different nodes, where the loader dropped the nodes of the cycle (#160)NXLoaderraises aNetworkXErrorthat says the hierarchy must be directed, for an undirected hierarchy such as annx.Graph. It raisedNetworkXNoCycle: No cycle found., which did not name the problem (#160)Only ELK JSON loads a
node:widgetshape with no open widget for itsuseas aNodeShape, with a warning. Such a dictionary in user code, for exampleNodeProperties(shape={"type": "node:widget", "use": "x"}), raisesValidationError, asWidget(use="x")does. Before, it loaded as aNodeShapeand warned, as ELK JSON does (#153)After you close the widget of a
Widgetshape, the next pipeline run no longer fails. Before, the serialization of the shape raisedAttributeError, because a closed widget has nomodel_id. The shape now writes themodel_idthat the widget had. The frontend keeps its node mark without attaching a missing widget or raising a browser error. ELK JSON loads it as aNodeShape, with a warning that names themodel_id. If you give the shape a widget that is closed already, it writes nomodel_id, not themodel_idof the widget it had before. An assignment ofwidgetsetsusetoNone(#241)After
ToggleCollapsedToolhides a node, a refresh with nothing pending keeps the collapsed diagram in the view. Before, each stage with no pending change gave its input to the next stage. The view then got your tree without the projection thatVisibilityPipemakes, so it lost the slack port, and an edge pointed at the hidden child. A stage with no pending change now keeps its output while nothing reached it since its last run: no change report, and the same input. Otherwise it gives its input to the next stage, as before. The stages after a stage that keeps its output keep their output too, also when a frontend writes that output again after the run. For example, a second tab can answer the text sizer late. If you change your tree in place, for example with a new CSS class or label text, record a change report before you callrefresh(). For example, calldiagram.source.record(F.Layout), withFasipyelk.pipes.flows. 2.1.1 did not show such a change at a refresh with nothing pending either (#231)After
ToggleCollapsedToolhides a node, a run that measures text again keeps the collapsed diagram in the view. Such a run follows a label text change that you record withF.Text.text. It also followsdiagram.source.record(F.Layout)orrecord(F.New), thenrefresh(). Before, the text sizer got your tree with an edge to the hidden node, and the load of its answer raisedNotFoundError. A diagram with a node that is hidden from the start failed the same way at its first run. Nowmodel_dump()of a tree leaves out each edge to a hidden element, as it leaves out the element.VisibilityPipenow observes each change, so it makes the projection again after the text sizer. A color class that you record withF.ColorCSSnow reaches the view too:VisibilityPipemakes the projection again, andElkJSlays it out again. The text sizer does not run (#246)If no event loop runs, for example in a script,
Tool.trigger()raises aRuntimeErrorthat says what to do: call it from a coroutine that you run withasyncio.run(...). Before, it raised theRuntimeErrorofasyncio,no running event loop, and Python warned that the coroutineTool._executewas never awaited. It also cancelled the task of an earliertrigger(), which it now keeps
Development#
Skip a failing
04_Interactive(taggh:95) only on macOStest, where the kernel’s slider values still lag the browser now and then (#232).test-oldeston Ubuntu and macOS passed it in every finished run since the #177 fix, so a failure there fails the job againCheck the source maps in the wheel:
scripts/check-dist.pyfails unless every labextensionstatic/*.jshas a.mapbeside it and ends with asourceMappingURLthat names it, and unless the maps hold the TypeScript (sourcesContent) of everyjs/file that compiles to runtime code. A change to the JS build can no longer drop them without notice (#83)src/ipyelk/schema/elk-catalog.jsonlists the layout options, algorithms and categories of the bundledelkjs.pixi run build-py-elk-catalogwrites it. Avitestchecks it against the installedelkjs, and a unit test checks the option classes against it (#29).CI also regenerates
elk-catalog.jsonand fails if it differs from the committed file, andjlpm schemapasses the real path ofelkschema.ts(#187).A unit test checks the models against
src/ipyelk/schema/elkschema.json, which the TypeScript types of the frontend generate. Every key that a model, or a subclass inipyelk, can write must be in the schema. A graph with every kind of element, every shape and hidden elements must validate, as the view gets it and as ELK gets it. The view types thatjs/sprotty/di-config.tsregisters must be the type strings of the shape classes and four types that only the frontend uses:graph,junction,symbolandnode:compartment. The pipeline does not validate: on 1000 nodes, validation takes about 5 times as long as the serialization that it checks. To check a payload while you debug, callipyelk.schema.validate_elk_json(to_json(node, None))(#131, #153).Add
scripts/bench_pipeline.py, a headless benchmark ofDiagram.refresh(): it runs the real kernel pipeline and realelkjsinnodewith only the two browser stages stubbed, over deterministic graphs fromscripts/bench_graphs.py, and reports wall and per-stage time, comm messages and bytes in both directions, layout runs, a collapse refresh and a ten-refresh burst (#164, #167), and the comms opened per refresh (#176)Gate CI on the benchmark’s deterministic counts:
pixi run bench-checkcompares them toscripts/bench_baseline.jsonand fails on any change until the baseline is updated withpixi run bench-update(#176), including the live widgets left by replacingdiagram.pipe(#180) and by closing a diagram (#191)Run the benchmark on the oldest supported ipywidgets too: on 8.0.1 it crashed in its first refresh, because ipywidgets 8.0 opens an
ipykernelcomm directly and the harness never saw a message.pixi run bench-check-oldestgates it against the same baseline in thetest-oldest (ubuntu-latest)job (#191)Add
ast-grepstructural lint rules for Python and TypeScript (sgconfig.yml,scripts/ast-grep/), each with test cases, run bypixi run lint-ast-grepas part ofpixi run lint; a suppression must name its rule and still match something (#147)Lint prose with Vale in the
lintjob:pixi run lint-valechecks US English spelling and theproselintandwrite-goodstyles in the root*.mdfiles,docs/, docstrings and comments insrc/,tests/andscripts/, and notebook markdown, and fails on any warning or error. It replacescheck-spelling, which linted the built HTML and never failed (#181)The nbconvert kernel watchdog writes its stack dump to the kernel’s real stderr, not to the descriptor ipykernel captures, where the dump woke the capture thread and made it look busy. A second dump lists the pending
asynciotasks of the kernel’s event loops, with their await chains, and whether the shell locks are held (#177)Fix the
itest-nbconverthang in03_App.ipynb(#177). ipykernel 7.0 to 7.3 send shell replies raw on the socket their shell stream reads from, which can swallow the wake-up for a request that arrives during the send. The request then waits unread while the kernel idles. In nbconvert that happens when a cell prints into anipywidgets.Output:nbclientanswers with acomm_msgjust as the cell’s reply goes out, and the next cell never runs.The
itestandatestenvironments now lock ipykernel 7.4, which fixed it (ipykernel#1529).ipykernel 7.4 needs Python 3.11 or newer. For the Python 3.10 environments, the kernels of the
nbconvert--task and of the robot tests loadscripts/kernel_shell_reply_fix.py, a startup file that backports the fix and does nothing on ipykernel 7.4 or newer.utest-oldesttests it
Work around the kernel’s slider values lagging the browser’s in the
04_Interactiverobot tests’ kernels with ipykernel 7.4 (#232). ipykernel 7.4 dispatches a comm message on the (sub)shell the kernel last sent on that comm from (ipykernel#1565), not on the subshell JupyterLab 4.6 addresses widget messages to, so a widget’s first update after the cell that displayed it runs on the main thread and the next ones on the subshell: two sliders’ updates run on two threads at once. ipywidgets’interactwraps every call inwith out:, and with two blocks open on two threads the inner one’sstatus: idlegoes out before the Output’smsg_idis cleared. The page’s Output hook swallows it, the widget’s message throttle never releases, and that slider never reaches the kernel again.The robot tests’ kernels load
scripts/kernel_comm_subshell_fix.py, a startup file that dispatches a comm message where the client addressed it, as ipykernel 7.3 did, and keeps the routing of answers to requests the kernel sent. It does nothing on ipykernel 7.3 or older.utesttests it against a real kernel, soutestnow installsipykernelandjupyter_client
Lower the
nbconvert--cell timeout from 1200 s to 40 s. The slowest healthy notebook in 4061 notebook runs from the last 45 CI runs took 8.2 s. The kernel watchdog now restarts with every cell and fires after 30 s without a new cell (#177)Fail CI when the committed
elkschema.jsondiffers from whatjlpm schemagenerates, and rebuild it whenelkgraph-json.tschanges (#187)Run the JS unit tests that need a DOM under
happy-dom, chosen per file with a@vitest-environment happy-domcomment (#216)Fail the
lintjob whenpixi run fixchanges a committed file or adds a file that git does not ignore (git diff --exit-code,git status --porcelain), and commit what it changes:taploalso formatsscripts/*.toml, andATEST_ARGSinci.ymlis a literal block, whichprettierleaves alone. Ruff targets Python 3.10, therequires-pythonfloor.jlpm cleankeeps the committedelkschema.json.CONTRIBUTING.mdnamespixi run watch-jsand.github/workflows/ci.yml(#217)Track every work marker: a
TODO,FIXME,XXXorHACKcomment names its issue asTODO(#123): what to do, asCONTRIBUTING.mddescribes.scripts/check_todos.py, run bypixi run lint-todosas part ofpixi run lint, fails on a marker in code that names no issue, and on atodo:orfixme:in lower case. Delete the obsolete markers, and file an issue for each of the others (#217)Skip the
16_Cervidae_Treenotebook tests, with the reason, whenexamples/data/cervidae-tree.zipis a git-lfs pointer file: a clone without git-lfs failed them withBadZipFile(#217)Test the oldest environment on Firefox 153 ESR, the current ESR line, instead of 128 ESR, which is no longer updated. 140 ESR reached end of life on 2026-10-13, and crashes at launch on macOS arm64 (
binary is not a Firefox executable). It is not yet known whether this changes the out-of-memory kills of01 Linkingand02 Transformerintest-oldest (ubuntu-latest)(#199)Migrate to native Pydantic 2 validation and serialization; require
pydantic >=2.12,<3. Usemodel_dump()/model_dump_json()instead ofdict()/json(). Custom models now usemodel_config,Field(exclude=True), and native serializers instead ofConfig,merge_excluded, anddict()overrides. Nested subclass fields and graph references are preserved; shape serialization no longer mutates dimensions. Explicit serialization field selections are now respected.Fix Python typing throughout the package and run mypy as part of
pixi run lint.Minimum supported Python is now
3.10Upgrade the pinned
pixifrom0.34.0to0.67.0(andsetup-pixitov0.10.0); relocking updateslibgfortran513.2.0→14.2.0, fixing a macOS arm64 dyld failure that brokenumpy/bqplotin the example notebooksOnly reinstall requirements in the
07_Simulationexample whenipyelkis missing, and addtooltips to its control widgetsPreserve the normal labextension in
src/_dduring the coverage build (build-js-ext-cov), which emptied it and leftpixi run buildwith an unloadable extension (_build.load: "static")Test that the browser text sizer adds its listener for font loads once for each
FontFaceSet, also with two sizer models that each run twice (#161)
Documentation#
Add the page Migrating from ipyelk 2.x to 3.0 (
docs/migration.md), linked from the README and the docs index: a section for each breaking change, with the 2.x code, the 3.0 code and the error or symptom that the 2.x code shows on 3.0. Tests check the page against the code and the CHANGELOG (#219)Document the shape API: a docstring for each class in
ipyelk.elements.shapes, and a Shapes page in the API reference with one table row for each shape (#66)
@jupyrdf/jupyter-elk 3.0.0#
Cull what is off screen when the viewer’s
cull_offscreenis set (an opt-in): the node, label and edge views skip an element whose absolute bounds (an edge’s route) miss the canvas, once the canvas size is known and never for the hidden render. The flag isJLModelSource.culling, in place of theCULLING_ENABLEDconstant, and a change re-renders the model.scripts/bench_render.pymeasures it (#170).Render the SVG export from the model:
ELKViewerView.exportSvg()renders the root again for thehiddentarget – no culling, no label level of detail, no widget overlays – with the hidden render’s own decorations (ids, classes, positions, edge label placement) into a detached element, instead of serializing the live SVG. The view, its viewer and the command stack take no part, so an export is no render of the view, and the live DOM is never touched.diagramUpdatednow says why it fired (layout,selectionorhover), and the exporter skips hover, which fires on every pointer move (#170).Fit each view after its first layout when the viewer’s
fit_on_first_layoutis set: every node, port and label of the layout (those outside their parent included, and not narrowed to a selection), without animation, with the viewer’sfit_paddingandfit_max_zoom. A layout with no sized top-level node does not count as the first. A view with no size on the page then waits for anafter-showorresizemessage or aResizeObservercallback (a CSS reveal), and stops observing once it fits, is removed, or aviewportcommand addressed to it arrives (#245).Write
hovered_idback on pointer leave, but only when the departed element is still the hovered one, so a stale leave cannot erase a newer enter; never dispatchnullto sprotty as an element id; re-wiring the hover tool releases the previous tool’s listener (#155).Skip the control overlay when the viewer’s
control_overlayisnullor has nochildren, and re-render when itschildrenchange (#156).Report the viewport: every
ELKViewerViewowns a stableview_idand, 100 ms after the lastSetViewport/Center/FitToScreen/InitializeCanvasBoundsaction (plus sprotty’s animation time for an animated move) or re-layout, writesview_id,origin,zoom,canvas_sizeandviewed_idsto the kernel’sviewporttool in one state update. A gather superseded by a newer one is dropped, a snapshot the kernel could not tell from the last write is skipped, and a detached view never reports. Theviewportcustom message appliesSprottyViewer.set_viewportto the addressed view (or every view) (#156).Apply the kernel
painter.stylesat transform time: the ELK -> sprotty transform merges the painted classes after each element’s model classes (no duplicates, symbols excluded), so every render – including re-layouts – carries them, and achange:stylesre-renders the same layout through sprotty’s model update, which keeps the selection and the camera.UpdateModelCommand2now also carrieshoverFeedbackover to the updated element, so a re-render under a resting pointer no longer drops the mouseover (#156).Remove
NodeExpandTooland itsExpandAction: itswheelhandler returned before it did anything, and nothing sent the action. Remove the emptychange:interactionlistener too: no kernel class has aninteractiontrait (#217).Fix the first-frame culling bug while culling stays off:
validCanvasBoundswas the inverse of its comment, so nothing was culled on a sized canvas and almost everything on the0x0canvas before the firstInitializeCanvasBoundsAction; the guard now skips culling while the canvas size is unknown, behind an explicitCULLING_ENABLEDconstant (turning it on is #170). The SVG exporter sizes itsviewBoxfrom the model’s content extent instead of the live group’s bounding rect, which under-sized by the layout’s left margin and made the export viewport-dependent (#161, #169)Stop a diagram from freezing for good on an update that removes elements. Sprotty’s fade-out removed the faded elements when the eased animation time reached 1, which
easeInOutrounds to within 1e-8 of the end, while the animation only stops at the raw time 1. A frame landing a hair before the end (evenly spaced frame timestamps, 15 frames of 1000/60 ms for the 250 ms animation) removed them early, and the real last frame removed them again and threw. The throw happened inside an animation-frame callback, so the animation never finished and sprotty’s command stack waited on it forever: every later layout reached the browser and was never drawn (#95). Reported upstream as eclipse-sprotty/sprotty#573; the workaround can go once that is fixedOffset a label icon vertically by its
y, not itsx:ElkLabelViewaddedicon.position.xto the icon’sy, so an icon’sxalso shifted it down and itsywas ignored (#205)Stop selecting a widget node on a click inside its widget, such as on the handle of a slider or the icon of a button: such a click is a widget click, which the select tool ignores, wherever it lands in the widget. Before, only a click on the widget’s own element counted, so a widget node could be selected by clicking its widget’s contents and no longer can. A diagram shown as a widget node of another diagram still selects its own nodes, and the outer diagram no longer selects the node that shows it (#216)
Add optional label tooltips and full-width separators above labels.
Observe source rewiring and apply initial kernel selections after model submission completes.
Report missing browser state for re-sync and surface text-measurement errors through the kernel error channel.
Discard widget views whose attachment host disappears while they load.
Attribute label hover feedback to the nearest hoverable element.
Fix the SVG exporter
enabledflag, which was alwaystrue(F5)Report browser-side layout failures to the kernel instead of silently emitting an empty layout (F6)
Make
ELKLayoutModel.layout()re-entrant: it stripped elementproperties(incl.cssClasses) off the shared inlet value in place, so a duplicaterunmessage or an overlapping refresh re-laid-out the stripped graph and pushed a style-less (black-and-white) diagram (F7)Render edge labels where ELK placed them:
ElkLabelcarried sprotty’sedgeLayoutFeature, whose EdgeLayoutPostprocessor re-anchors edge labels along the route and treats ELK’s absolute coordinates as a relative offset, shifting every edge label by roughly its edge’s origin (F8)Orient edge end symbols along the visible route: the adjacent-segment tangent collapsed to
atan2(0, 0)on the duplicated control points of elkjsSPLINESsections (arrowheads drawn 180° wrong, inside the target node) and followed the short exit stub ofPOLYLINEroutes instead of the visible diagonal; interior bends under a symbol’s footprint no longer make the trimmed shaft double back (F9)Drop the selection write-back race:
getSelection()resolves one action-queue slot later, so twoSelectActions dispatched close together each read the other action’s resulting state and wrote it back, flipping the selection tool’sidsforever — a self-sustaining oscillation that pegged the renderer’s main thread (F11)Render nested JupyterLab widgets in the pass that reveals them: the overlay was built from a registry populated by the previous render’s
snabbdomhooks, so a widget node that had just become visible produced no container until some later, unrelated re-render happened to run (F14)Make the selection write-back set-based so linked views cannot bounce: F11’s generation stamp is per view, but
change:idsis observed by every view of a shared model, and each view gathers the same selection in a different order, so a reordering kept dispatchingSelectActions between two views until the browser ran out of memory (F16)Add a
vitestunit-test harness (F5)Upgrade ELK.js from
0.9.3to0.12.0(#140).ElkEdgegains an optionalcontainerfield in the generated schema, and avitestlays out a graph with the real bundle to pin the port, edge-section andpropertiesround-trip contract.Upgrade
sprottyandsprotty-protocolfrom1.3.0to1.4.0, which requiresinversify ^6.1.3(pinned to6.2.2) andreflect-metadata ^0.2.2. Theinversifyshared module declares itsversionstatically: itslib/esmentry ships a version-lesspackage.json, so webpack module federation would otherwise register it as0and warn on every page load; a unit test keeps the static version exact, equal to the dependency pin and inside the declaredrequiredVersion.Drop the unused
sprotty-elkdependency: nothing injs/ever imported it,sprottyandsprotty-protocoldo not depend on it, and the built extension has no reference to it. Itselkjs ^0.8.2range was the only thing that conflicted with ELK.js0.12.0, so theresolutions.elkjsoverride goes with it (#140).The browser text sizer measures a label again only if its text or its CSS classes change, or the CSS of the sizer or the label font of the theme, or after the page loads a font. It keeps the 0 size of a label with no text. It measured every label on every run: it skipped only a label whose shape has a size, and it writes the size onto the label, not onto the shape. A run with no label to measure answers at once, without the DOM (#161)
Bundle
elkjs/lib/elk-worker.min.js, the compact build of the elkjs worker, notelk-worker.js. The worker in the lab extension falls from 1.92 MB to 1.46 MB, and its source map from 7.7 MB to 4.2 MB. This makes the wheel about 0.4 MB smaller (#161)Shapeis a union of one interface for each built-in type string, for exampleCommentShapeandPathShape, andCustomShapefor the other type strings. Each interface givesuseits type.shapeOf<T>(element)reads the shape of an element as the variant of its view. The comment view draws no notch for 0, and limits the notch to the size of the node. A notch that is missing, not a number or negative draws 15 pixels, and a string notch from 2.x still draws (#148)
Fixed#
Stop two views of one diagram from looping on hover feedback. The two views come from
display(diagram)twice or from a linked output view. A view wrote the feedback that it replays fromhover.hovered_idback tohovered_id. When that feedback arrived late, for example after a second hover, the views wrote stale ids back without end, and the page stopped responding. A view now writes back only the hover feedback from the pointer (#255).
2.1.1#
@jupyrdf/jupyter-elk 2.1.1#
restore license files
ipyelk 2.1.1#
restore license files
2.1.0 (broken)#
@jupyrdf/jupyter-elk 2.1.0#
support JupyterLab 4.1-4.3
ipyelk 2.1.0#
improve type hints
2.1.0a0#
@jupyrdf/jupyter-elk 2.1.0-alpha0#
Update dependencies
elkjs 0.9.3,sprotty 1.3,jupyterlab 4.2Add shim for
reflect-metadatavsfast-foundation
ipyelk 2.1.0a0#
Support
pydantic >=1,<3
2.0.0#
@jupyrdf/jupyter-elk 2.0.0#
Added control layer to allow jupyterlab widgets to exist on top of the diagram based on current node selection.
Adding controllable render delay for jupyterlab widgets used in diagram nodes.
Updated dependencies to
elkjs 0.8.2.Fixed diagram bounding box issue affecting node visibility (#94).
Improved test sizing that takes into account css properties (#97)
ipyelk 2.0.0#
Migrated to
ipywidgets >=8.0.1,<9Added simple visualizer widget for the diagram pipe status.
Fixed edge parent ownership affecting self edges (#101)
2.0.0a0#
@jupyrdf/jupyter-elk 2.0.0-alpha0#
Label Schema fix ([#73])
Element API overhaul (#88)
Add
mypyfor type checkingUse
pydanticforElementbase models
Overhaul top level interface (#89)
Backporting Sprotty Duplicate ID (#17)
Generalize the processing stages to use a common interface of Marks and simplify processing to composable pipes
Refactoring top level APIs and attempt and more streamlined
Diagramcreation
ipyelk 2.0.0a0#
1.0.1#
@jupyrdf/jupyter-elk 1.0.1#
hides some browser console messages
ipyelk 1.0.1#
1.0.0#
@jupyrdf/jupyter-elk 1.0.0#
updates for JupyterLab 3 (#6)
uses
@luminocomponents
ipyelk 1.0.0#
supports (and depends on) JupyterLab 3 (#6)
labextension is delivered as part of the
ipyelkpython package, no morelab buildnpmtarballs will still be uploaded
0.3.0#
@jupyrdf/jupyter-elk 0.3.0#
ipyelk 0.3.0#
Custom shapes (#60)
Ability to add custom SVG symbols and use as a reference for other elements
Custom node shapes
Custom connector end shapes for edges
Custom shapes for ports
Custom node label shapes
JupyterLab widgets rendering inside Node
Node compartments
Initial level of detail checks for labels
Rendering checks for nodes outside of view bounding box
Initial documentation (#64)
0.2.1#
@jupyrdf/jupyter-elk 0.2.1#
ipyelk 0.2.1#
0.2.0#
@jupyrdf/jupyter-elk 0.2.0#
ipyelk 0.2.0#
adds optional node label positioning with
NodeLabelPlacement(#15)vertical/horizontal alignment
inside/outside the node
improves evented updates of networkx to diagram with
ElkDiagram.connect(XElk)(#15)adds optional
ElkTextSizerfor interacting with browser text sizing (#15)add layout options widgets to control various layout parameters (#24)
add support for multiline node labels, port labels, and edge labels ([#35])
adds possibility of passing CSS classes through to the final DOM elements
0.1.3#
@jupyrdf/jupyter-elk 0.1.3#
includes all files using
npm publish
ipyelk 0.1.3#
updates some metadata for pypi
0.1.2#
ipyelk 0.1.2#
@jupyrdf/jupyter-elk 0.1.2 (broken)#
(failed) fix npm release process
0.1.1#
ipyelk 0.1.1#
initial release
@jupyrdf/jupyter-elk 0.1.1 (broken)#
initial release