[IPython-dev] [sympy] Re: using reST for representing the notebook cells+text

Ondrej Certik ondrej@certik...
Wed Feb 24 12:55:13 CST 2010


On Wed, Feb 24, 2010 at 10:46 AM, Brian Granger <ellisonbg@gmail.com> wrote:
> Ooopps, hit keyboard shortcut for send...
>
>> Using Python allows the notebook format to be extended by simple
>> subclassing:
>>
>> class MatplotlibFigureCell(Cell):
>
> This subclass could contain all the logic for representing the
> matplotlib figure in different formats: html, jpeg, svg, native pyqt
> gui, etc and could be distributed with matplotlib.
>
> Sure, if your notebook uses the MatplotlibCell, you will need
> matplotlib, but the validation of that aspect is handled by python
> itself, not an XML schema.
>
> Doing these types of things using XML would require all of this to be
> put into the centralized XML schema, making it difficult for third
> parties to extend.  Plus all of the additional logic associated with
> that Cell type has to be put somewhere as well.
>
> [I am thinking aloud here...not sure if all of this would pan out in
> practice...only actual code would
> tell...]
>
> [For what it is worth, while I *love* the idea of having a reST based
> notebook format, I think it is simply
> too limiting in the long run.  Between reST and XML, I think XML wins...]

I will do reST import/export, but having it the default format, that I
think sucks. With xml, anyone can easily write a parsers for it in any
language.

Besides, I need to push the worksheet to the browser. In my case, I
use pyjamas, so it's pure Python, however, exec/eval are not evailable
there (as far as I know), but I am sure xml would work, here is some
code to handle xml in pyjamas:

http://pyjamas.sourceforge.net/examples/xmldoc/XMLload.py

I think, that it might work to push the whole Python objects somehow
(that's the nice thing about pyjamas, that since you have python on
both sides, you can do lots of cool stuff), but maybe not.

I like Brian's idea to be able to just import it in Python. But I
think I'll just stick to xml for the first iteration of my notebook,
to get the job done.

Ondrej


More information about the IPython-dev mailing list