This is an archive of the discontinued LLVM Phabricator instance.

[LLVM][TableGen] Add JSON magic directive to Jupyter kernel
AbandonedPublic

Authored by DavidSpickett on Aug 25 2022, 4:48 AM.

Details

Reviewers
None
Summary

This allows you to see the records as pretty printed JSON,
which can give you a better idea of the structure.

This is equivalent to %args --dump-json except that
the kernel will format it before returning the result.

(and if you did both, it would still work)

Without formatting, the ouput is all one line.

An example is added to the end of the notebook
and is shown in the Markdown export.

Depends on D132646

Diff Detail

Event Timeline

DavidSpickett created this revision.Aug 25 2022, 4:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2022, 4:48 AM
DavidSpickett requested review of this revision.Aug 25 2022, 4:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2022, 4:48 AM
DavidSpickett planned changes to this revision.Oct 31 2022, 8:36 AM

I am going to rethink this once the basic tutorials are in place.

One idea is to use jq (https://stedolan.github.io/jq/) to give us a way to filter the JSON without making up our own language (and python as a one liner gets awkward). Also the current output is pretty lean, so it might need extra fields.

DavidSpickett abandoned this revision.Feb 16 2023, 8:06 AM

I am rethinking the next steps for the jupyter kernel, probably ones that don't involve showing the raw JSON.

If anyone is here looking for that option, you can do what the SQL backend turorial does instead: https://github.com/llvm/llvm-project/blob/main/llvm/utils/TableGen/jupyter/sql_query_backend.ipynb