Conversation
Jupyter asks an object for _repr_html_ before it falls back to repr, so a result printed in a cell is a line saying how many rows it has. The rows are already in memory and a table of them is a strictly better answer, so this draws one, and draws nodes, edges and walks the same way whether they turn up on their own or inside a cell. The markup is a table and a stylesheet and no script, which means it survives nbconvert, an exported HTML file and a notebook diff, and there is nothing to install for it to work. Colours come from the notebook through currentColor and opacity, because a light theme and a dark one are both in the room and a guess about which would be wrong half the time. A hundred rows is the cut, since a million rows of markup is a notebook file nobody can open again, and the note underneath says how many rows there really were. Two hundred characters is the cut on a cell, so a column holding a document does not become a page holding one. Values are escaped, because a string column holding a tag is a string column and pasting one into the page unescaped would run a caller's data as code in their notebook. zudb.magic goes with it: %gql opens a connection and %%gql runs a statement on it, with --conn to say which of several, --params to name a dict, and --out to put the result in a variable instead of showing it. A notebook that already called zudb.connect needs no %gql at all, since a cell with one connection in the namespace finds it, and a cell with two says which names it saw. The magic is a way in and not a layer: the statement goes straight to execute and the engine's exception arrives as the engine's exception. IPython is a dev dependency and not a wheel dependency, and the tests skip without it the way the pyarrow and pandas ones do. They run against a real InteractiveShell with %load_ext rather than a mock, so what is checked is what a notebook does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A result printed in a Jupyter cell was a line saying how many rows it had. The rows are already in memory, so this draws them:
_repr_html_onResult, and onNode,RelandPathso a graph value looks the same on its own as it does inside a cell.The markup is a table and a stylesheet and no script, so it survives nbconvert, an exported HTML file and a notebook diff, and there is nothing to install for it to work. Colours come from the notebook itself through
currentColorand opacity, because a light theme and a dark one are both in the room and a guess about which would be wrong half the time. Classes rather than a style attribute on every cell, since a hundred rows of ten columns is a thousand cells.A hundred rows is the cut and the note underneath says how many rows there really were, because a million rows of markup is a notebook file that will not open again. Two hundred characters is the cut on a single cell, so a column holding a document does not become a page holding one. Values and column names are escaped, since a string column holding a tag is a string column and pasting one in unescaped would run a caller's data as code in their notebook. Drawing a result does not move its cursor: a person who looked at a result has not read it.
zudb.magicgoes with it.%gql <path>opens a connection,--read-onlyopens it that way,--closeshuts it, and the bare form says which one is open.%%gqlruns the cell on it, with--connto say which of several connections,--paramsto name a dict in the namespace, and--outto put the result in a variable instead of showing it. A notebook that already calledzudb.connectneeds no%gql: a namespace with one connection in it is found, and a namespace with two says which names it saw. The magic is a way in and not a layer, so the statement goes straight toexecuteand the engine's exception arrives as the engine's exception.IPython is a dev dependency, not a wheel dependency. The magic tests skip without it, the way the pyarrow and pandas ones do, and they run against a real
InteractiveShellthrough%load_extrather than a mock, so what they check is what a notebook does.36 new tests, 16 on the markup and 20 on the magics. Local gate is green: ruff, cargo fmt, clippy, a release build and the full suite at 528 passed.