[IPython-user] A 'Mathematica Notebook' interface for python work?

Arnd Baecker arnd.baecker at web.de
Fri May 7 03:39:45 CDT 2004


Hi,

sorry for the slow response - I am pretty busy with "real work"
(+ other stuff).

On Wed, 5 May 2004, Fernando Perez wrote:

> Ero Carrera wrote:
> > On Fri, Apr 30, 2004 at 11:03:04PM -0600, Fernando Perez wrote:
> >
> >>here's a very interesting link I saw today:
> >>
> >>http://dkbza.org/tmPython.html
> >>
> >>Has anyone seen/played with this before?  It would seem to me that, if
> >>ipython were the shell running in that window, we'd have a lovely
> >>environment...

I had a quick look and it seems very interesting, indeed.
Actually, some year ago or so I also wrote some code
to embed python in TeXMacs, but did not push that really far.
There are a couple of things which I find not optimal with TeXMacs,
but there are many many really cool features.
Let me mention just a few  problematic points
  - I find TeXMacs (even on a PIV, 2 GHz, 1G RAM) a bit slow
    (but there is a big machinery behind)
  - there are some many menu points, which might confuse
    those users mostly interested in the python side
    (maybe a way to customize this would be helpful)
  - I don't like the menu-handling: click to  appear, click
    to dissapear and then click for the next menu item
    (Uups, I just managed to seg-fault it ...;-()
  -  concerning the python mode:
     I think that a proper multiline mode
     is a must have.
     Also there should be no need to think about spaces and
     such (ie. the normal 4 spaces convention should just work).

I think that there are two options now:
A) the small one: try to get TeXmacs to do what we would
   like to have.
B) First go for a full discussion about a wish-list
   for features for something which I called SciPyWorkBench
   in a private mail to Fernando a while ago.
   (Maybe PythonWorkBench or PyNumWorkBench might be
   a better and more general name...;-).
   I updated my notes on this and append them at the end of this mail.

Realizing all wishes from B) would be a huge project, I fear,
and I for myself don't have any time left beyond
devoting time for testing/bug reports/etc.
Still it might be useful to spend a bit of time on B)
to gather some ideas.
(One could even think of inviting people from c.l.p, Numeric
and scipy to the discussion).

> While Alex's code works great, I have the impression that Texmacs is a more
> appropriate environment than X/Emacs for having our dream 'Mathematica
> notebook' interface.  I could imagine even implementing styled text regions
> where one could type arbitrarily font-prettifyed text (including mathematics).
> These could simply be encoded inside the resulting file as top-level
> """strings""" with special markers on their first line defining format.  This
> would allow any 'session' to remain valid python code, while also being (when
> used inside the Texmacs environment) a mathematically commented document.

I like this idea a lot!

Best,

Arnd

########################
.. -*- mode: rst -*-

=========================
SciPyWorkBench
=========================

.. contents::


Remark ahead
============

These notes are basically a collection of
wish-list items I made some time ago.
They are of different priority and
difficulty. The purpose is to trigger some discussion
on which things are really wanted and
to figure out what approaches one might take to
tackle these.
Notice that this text was mostly written late at night,
so take care for all the holes ;-)



Why a workbench?
================

A notebook in the style of Mathematica or Maple
can be useful to collect all ideas/remarks (text),
formulae (math), computations (python)
and plots in one document.


What features?
==============

+ all of IPython's features
+ auto-indent
+ multiline edits
+ colorization of keywords
+ tooltips popup (as in idle or PyCrust)
+ integrated help browser (in addition to the online help)
+ TeX (like?) text
+ inclusion of figures, automatically as they are generated
  (could one this working with *any* plot-tool, e.g.
   gnuplot, scipy.xplt, matplotlib, MayaVi output, wxPython graphics,
   Tkinter graphics...)
+ Save and load of sessions
+ Re-run sessions
+ storing the full state of a session (might be difficult ?)
+ good print out
+ store the whole session as a normal LaTeX text (?)
+ Fernando's idea

  I could imagine even implementing styled text regions
  where one could type arbitrarily font-prettifyed text
  (including mathematics).
  These could simply be encoded inside the resulting file as top-level
  """strings""" with special markers on their first line defining format.
  This would allow any 'session' to remain valid python code,
  while also being (when used inside the Texmacs environment)
  a mathematically commented document.


Some of the above points might not be realizable at the same time ...


Help Browser
````````````

This would be a long topic on its own
(requiring the discussion of the contents and display).
Let me still mention a few basic issues:

There should be
+ normal online help, however with output directed to a separate
  window
+ search
+ addition of books (eg. the Numeric manual or
  python tutorials or the scipy tutorial)

One very nice option in this direction
is Vaclav Slavik's documancer
http://cvs.sourceforge.net/viewcvs.py/documancer/documancer/src/
(I have been using this for a while now and it is *very*
useful!).


Generally, for a package like Numeric/SciPy
the documentation should also allow for mathematical
formulae (in whatever markup, TeX or mathml).
When using a graphical output window this could be typeset nicely.

Also more background information for Lapack/Atlas and
other routines might be helpful




Possible implementations
========================

IPython as basis and then:

+ texmacs
+ PyCrust
+ Lyx
+ specifically written one

Remark: each of these would deserve a more extensive discussion
and evaluation



Recent discussion on c.l.p.
--------------------------

On the c.l.p. mailing list Michael Hudson (mwh at python.net)
recently (13 Feb 2004) mentioned
in the thread *Mathematica-style notebook in Python*
that he and  Armin Rigo, Holger Krekel started
such a thing (called shpy)  but haven't gotten very far
yet...

In the same thread Erik Lechak writes::

  I have been working the last several months on just that issue.  It is
  a library that contains interactive plotting, block diagram, imaging,
  and text rendering capabilities.  It is written in 100% python.  It
  currently can use either wxWindows or pygame to display its diagrams
  (I am working on TK now ... others to come).  The nice thing about it
  is no matter what underlying GUI library you use to display the
  diagram it always looks the same.

  I am about ready to release the second version of the library (its
  called Pyxel).  BTW its opensource - free for commercial and
  opensource use.

  I can send anyone the code that wants to preview it before the
  release. Just drop me a line.  I could use some help on the plotting
  aspect, if anyone is interested.

  Thanks,
  Erik Lechak
  prochak at netzero.net

This topic already came up before as A.M. Kuchling pointed out::

  James Tauber suggested it last June in the thread starting here:

  http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=mailma
  n.1056218558.29567.python-list%40python.org

  However, at the end of it he went off to investigate wxPython
  and never posted a final result, so whether he succeeded or not is
  unknown. I'd suggest e-mailing him.





More information about the IPython-user mailing list