-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Labels
Description
Motivated by vatlab/sos#869
We have a render magic that renders output from subkernels as markdown, html etc. We could provide a capture magic to capture output from subkernels. Something like,
%capture --to varwill capture the output (stdout) of subkernel to a variablevaras string.%capture --to var --as jsonwould usejson.load()to parse the output and return a dictionary.%capture --to var --as csvwould usecsv.read()to parse the output aspandas.DataFrame.%capture --to var --as json --from outfile.txtwould get the input from a file instead of standard output.
However, becaues capture and render are similar in functionality, we could add these features to the render magic. That is to say, we could add the following features to the render magic
--from outfile.txtget input from a file instead of stdout, assuming the file would be generated by the subkernel.%rendermagic already supportsJSONbut we could add%render csv--to var%renderdisplays output as cell output but we could save the results to a file.