[PATCH] D132378: [LLVM][TableGen] Add jupyter kernel for llvm-tblgen

David Spickett via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 00:34:53 PDT 2022


DavidSpickett added a comment.

> Nice, I've found a variant where one just uses Python magic to do most of the same.

Another notebook do you mean? Can you post a link to it?

One idea I had was to be able to run python scripts on the JSON tablegen output, so I might end up coming back around to Python.



================
Comment at: llvm/utils/TableGen/jupyter/tablegen_kernel/kernel.py:81
+        ('', ['%foo a b c'])
+        >>> k.get_magic("Foo\\n%abc\\n  Bar\\n%def")
+        ('Foo\\n  Bar', ['%abc', '%def'])
----------------
jpienaar wrote:
> Can one interleave magic like this in jupyter? I thought one had cell and line magic but both required to be only at start. (Well required is strong word, expected perhaps better)
Well you already know more than me then :) I did this based on skimming the iPython kernel's docs so I'm still learning the terminology.

So far I guess this would be called "cell magic" and you're right it doesn't make sense for that to be anywhere but the first (or first set of) lines. Since you can't apply cell magic half way through a cell.

I will make this more strict.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132378/new/

https://reviews.llvm.org/D132378



More information about the llvm-commits mailing list