[IPython-dev] magics and metadata

MinRK benjaminrk@gmail....
Tue Jun 19 15:17:56 CDT 2012


On Tue, Jun 19, 2012 at 1:05 PM, Brian Granger <ellisonbg@gmail.com> wrote:

> On Tue, Jun 19, 2012 at 12:21 PM, MinRK <benjaminrk@gmail.com> wrote:
> >
> >
> > On Tue, Jun 19, 2012 at 12:05 PM, Jonathan Taylor
> > <jonathan.taylor@stanford.edu> wrote:
> >>
> >> That's the sort of use case I imagine as well, where a cell magic wants
> >> to about something to the frontend a little more information about what
> >> kind of cell it is (in your %%bash example, it would be a code cell for
> >> which the code_mirror might use bash highlighting instead of python).
> This
> >> seems like it could be accomplished with something parallel to
> >> "publish_display_data" for cell metadata which different frontends can
> >> handle differently.
> >
> >
> > publish_display_data already takes a metadata arg.  This has always been
> the
> > case, but so far it's totally unused.
> >
> > I just noticed, this metadata is *not* included in the added fields
> > preserved in the notebook, but I will get on that.
>
> But I think the publish_display_data metadata is separate from the
> cell metadata.  Are you thinking we should save another set of
> metadata with the display data output?
>

Yes - we put metadata on outputs for a reason, presumably.  If this
shouldn't be saved, it should probably be removed from the API.


>
> > -MinRK
> >
> >>
> >>
> >> On Tue, Jun 19, 2012 at 8:49 AM, Thomas Kluyver <takowl@gmail.com>
> wrote:
> >>>
> >>> On 19 June 2012 16:08, Jonathan Taylor <jonathan.taylor@stanford.edu>
> >>> wrote:
> >>> > Yes, it would not be good to have the API of cell magics be notebook
> >>> > specific. What about providing a reference to the current cell
> metadata
> >>> > in
> >>> > the Magics class that can be used to update the NotebookNode after
> >>> > executing
> >>> > cell.input? So, cell_magics would not have access to the metadata on
> >>> > execution but could pass any metadata it wanted to back to the
> >>> > notebook.
> >>>
> >>> Before we get too far into the mechanism, let's try to think about
> >>> actual use cases, so we can figure out how things need to work.
> >>>
> >>> We can also see cell magics themselves as a sort of within-cell
> >>> metadata. For example, the frontend might one day be aware that if a
> >>> cell starts with %%bash, different syntax highlighting and tab
> >>> completion rules apply to it. I think this would need to be within the
> >>> frontend, rather than going through the kernel, because we want to use
> >>> the new highlighting & completion before the cell is executed.
> >>>
> >>> Thomas
> >>> _______________________________________________
> >>> IPython-dev mailing list
> >>> IPython-dev@scipy.org
> >>> http://mail.scipy.org/mailman/listinfo/ipython-dev
> >>
> >>
> >>
> >>
> >> --
> >> Jonathan Taylor
> >> Dept. of Statistics
> >> Sequoia Hall, 137
> >> 390 Serra Mall
> >> Stanford, CA 94305
> >> Tel:   650.723.9230
> >> Fax:   650.725.8977
> >> Web: http://www-stat.stanford.edu/~jtaylo
> >>
> >> _______________________________________________
> >> IPython-dev mailing list
> >> IPython-dev@scipy.org
> >> http://mail.scipy.org/mailman/listinfo/ipython-dev
> >>
> >
> >
> > _______________________________________________
> > IPython-dev mailing list
> > IPython-dev@scipy.org
> > http://mail.scipy.org/mailman/listinfo/ipython-dev
> >
>
>
>
> --
> Brian E. Granger
> Cal Poly State University, San Luis Obispo
> bgranger@calpoly.edu and ellisonbg@gmail.com
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20120619/728ec8dc/attachment-0001.html 


More information about the IPython-dev mailing list