Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#17234 closed enhancement (fixed)

Rich output and the IPython Notebook

Reported by: vbraun Owned by:
Priority: major Milestone: sage-6.4
Component: graphics Keywords:
Cc: novoselt, ohanar, gagern Merged in:
Authors: Volker Braun Reviewers: R. Andrew Ohana, Emmanuel Charpentier
Report Upstream: N/A Work issues:
Branch: a173e92 (Commits) Commit:
Dependencies: #16996, #16640, #17284 Stopgaps:

Description (last modified by vbraun)

This framework separates the construction of rich output (images, mathjax, 3d scenes, ...) from the viewer details. Displaying rich output is handled by interchangeable plugins that encapsulate the differences between various notebooks, the command line, etc.

As a side effect, mathjax output in the ipython notebook works now.

Attachments (1)

failing_doctests.log (5.7 KB) - added by ohanar 5 years ago.

Download all attachments as: .zip

Change History (73)

comment:1 Changed 5 years ago by vbraun

  • Component changed from PLEASE CHANGE to notebook
  • Description modified (diff)
  • Type changed from PLEASE CHANGE to enhancement

comment:2 Changed 5 years ago by jdemeyer

  • Component changed from notebook to graphics
  • Dependencies set to #16996, #16640

comment:3 Changed 5 years ago by jdemeyer

  • Dependencies changed from #16996, #16640 to #16996, #16640, #17284

comment:4 Changed 5 years ago by vbraun

  • Branch set to u/vbraun/rich_output_and_the_ipython_notebook

comment:5 Changed 5 years ago by git

  • Commit set to 1bac881576cbe06722f06c6d4d7967b7983777c0

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

1bac881WIP

comment:6 Changed 5 years ago by git

  • Commit changed from 1bac881576cbe06722f06c6d4d7967b7983777c0 to 9e1c35522ffa063c01ade492c9cefd1bfa4a9823

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

9e1c355WIP

comment:7 Changed 5 years ago by git

  • Commit changed from 9e1c35522ffa063c01ade492c9cefd1bfa4a9823 to b902167a1565ae44784352e33c0fb89913a42bc3

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

b902167WIP

comment:8 Changed 5 years ago by git

  • Commit changed from b902167a1565ae44784352e33c0fb89913a42bc3 to 14c147e89d1da0939764301e4e09ba5ccdbe4856

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

14c147eWIP

comment:9 Changed 5 years ago by git

  • Commit changed from 14c147e89d1da0939764301e4e09ba5ccdbe4856 to 3411efa27dc074ddada3365a65cde2fb70e3db3c

Branch pushed to git repo; I updated commit sha1. New commits:

3411efatest

comment:10 Changed 5 years ago by git

  • Commit changed from 3411efa27dc074ddada3365a65cde2fb70e3db3c to 14c147e89d1da0939764301e4e09ba5ccdbe4856

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

comment:11 Changed 5 years ago by novoselt

  • Cc novoselt added

comment:12 Changed 5 years ago by git

  • Commit changed from 14c147e89d1da0939764301e4e09ba5ccdbe4856 to f78a5d3c07381f328bbc8a34db84f659c945f27e

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

fc4e54aWIP
830e463rebase, minor fixes
07adf45save builtins._
f78a5d3WIP: SageNB jmol

comment:13 Changed 5 years ago by git

  • Commit changed from f78a5d3c07381f328bbc8a34db84f659c945f27e to 5dc00909b94bcdfc89d9bd463da693692f853cfb

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

7296703WIP
ed9bc27rebase, minor fixes
f8f8386save builtins._
a88a042WIP: SageNB jmol
5dc0090Make SageNB j(s)mol work

comment:14 Changed 5 years ago by git

  • Commit changed from 5dc00909b94bcdfc89d9bd463da693692f853cfb to 7633dc373e4b6c38c0cd72fe99fb8f816d733c53

Branch pushed to git repo; I updated commit sha1. New commits:

db74693make sagenb temp filen world-readable
a13e0f1Add canvas3d graphics support
7633dc3hook up the Java3d (sage3d) viewer

comment:15 Changed 5 years ago by git

  • Commit changed from 7633dc373e4b6c38c0cd72fe99fb8f816d733c53 to 037d0ebcdc35c1b10800c3b89eaa117147b8fe5f

Branch pushed to git repo; I updated commit sha1. New commits:

037d0ebFinish lightwave support

comment:16 Changed 5 years ago by jdemeyer

Regarding changes of the form

- def show(self, filename=None, dpi=DEFAULT_DPI, figsize=None, axes=None, **kwds):
+ def show(self, **kwds):

I also tried once to make the same simplification as you but people complained.

See discussion starting at 25:ticket:16533

comment:17 Changed 5 years ago by vbraun

On the plus side the filename keyword is removed, too: you actually have to call save() to save now. We could add a deprecation workaround but really that was never the intent of the show() method nor match its documentation.

comment:18 Changed 5 years ago by git

  • Commit changed from 037d0ebcdc35c1b10800c3b89eaa117147b8fe5f to 867cf2af36c82d0931068bed27f125ed2b8d9d6a

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

867cf2aWIP

comment:19 Changed 5 years ago by git

  • Commit changed from 867cf2af36c82d0931068bed27f125ed2b8d9d6a to 7747261d04e4ff0105fb514a2109b2d014396e2a

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

7747261Rich output framework

comment:20 Changed 5 years ago by vbraun

  • Authors set to Volker Braun
  • Description modified (diff)

This is now feature complete and all doctests pass. I will not rebase the branch any more, all future additions will be incremental.

The only thing missing is some documentation.

comment:21 Changed 5 years ago by vbraun

  • Description modified (diff)

comment:22 Changed 5 years ago by ohanar

  • Cc ohanar added

comment:23 Changed 5 years ago by git

  • Commit changed from 7747261d04e4ff0105fb514a2109b2d014396e2a to 7dc42d971ba53322fb089307178294b5c3e32fac

Branch pushed to git repo; I updated commit sha1. New commits:

7dc42d9More documentation

comment:24 Changed 5 years ago by vbraun

  • Status changed from new to needs_review

Documentation is complete now, ready for review.

comment:25 Changed 5 years ago by ohanar

  • Status changed from needs_review to needs_work

Some comments for now:

  • It seems like the show method should maybe get moved to the SageObject class. It pops up everywhere, is more or less the same (other than supporting some deprecated functionality in a small handful of places) and as far as I can tell should work for every child of SageObject.
  • Similarly, in graphics.py, a bit of refactoring could be done by creating a common parent for Graphics and GraphicsArray (maybe something like GraphicsBase)
  • In sage.repl.formatter there is presumably a debugging print statement still left in SagePlainTextFormatter.
  • In the module docstring for sage.repl.image you mention the class SageImage, which you presumably renamed to just be Image. I didn't see any other instances of this, but it warrants a double check.
  • In sage.repl.interpreter it would be good to at least have trivial docstrings for the new methods as well as # not tested doctests -- hopefully it reduces the number of coverage complaints (even though it is a bit silly in this case).
  • For the display magic, you deprecate some old values, maybe add a proper deprecation? (or maybe this doesn't work well with magics, I don't know)
  • The only the first pdf assertion in validate method for the doctest backend is being tested at the moment.
  • The display_immediately method on the IPython notebook backend currently does return something.
  • The display_immediately doctest for the test backend is actually testing the base backend.
  • For the various backends, wouldn't it make more sense for the supported_types to return frozensets rather than sets (since really the supported types aren't mutable). You do this later in the display manager.
  • For the display manager, why don't you just make a it have a unique instance (either by using a metaclass, or by using __new__) rather than just assert that there is only one instance?

Once I get a chance to test it and give it a second pass I'll add some more comments. It would also be good to get someone familiar with SageNB to take a look at this, since I have no idea what hacks SageNB depends on and can't really review the SageNB backend.

Last edited 5 years ago by ohanar (previous) (diff)

comment:26 Changed 5 years ago by vbraun

1, 2) I agree on the first two, but I don't want to do any further refactoring on this ticket. It is already way too big...

3) is actually never used, thouugh it might be handy to have a plain IPython formatter. I've clarified the documentation.

6) its still not clear to me what the best syntax is, so for now I think its easiest to just allow different combinations. But I don't like "simple" (not expressive, better: "plain") and "typeset" (probably better: "mathjax").

7) was supposed to be OutputImageDvi, fixed.

10) The backend supported_output can return any iterable. The display manager then turns that into a nice frozen set and performs checks and type demotion. Nobody interacts with the backends directly, the display manager intentionally has no public accessor for the current backend.

11) Just for simplicity, the display manager's type isn't global so you already have to work to try to make a second instance. You aren't going to accidentally call the ctor.

comment:27 Changed 5 years ago by git

  • Commit changed from 7dc42d971ba53322fb089307178294b5c3e32fac to 2d915f086b25c7c72cf1fc9d0dd441015abd9fad

Branch pushed to git repo; I updated commit sha1. New commits:

2d915f0Fix Andrews comments

comment:28 Changed 5 years ago by vbraun

  • Reviewers set to Andrew Ohana
  • Status changed from needs_work to needs_review

comment:29 Changed 5 years ago by ohanar

  • Reviewers changed from Andrew Ohana to R. Andrew Ohana
  • Status changed from needs_review to needs_work

A few more comments:

  1. I think it would be better to have a latex output type rather than a mathjax output type -- different backends might use different renders for latex, (e.g. the command line currently uses the pdflatex command + a pdf viewer). This should work fine with ipython which supports the text/latex MIME type (which it renders with mathjax).
  1. Sure, we can hold off on the show stuff for another ticket, this is already quite big. (Note for future ticket) From talking with William, he convinced me that show should be an alias for pretty_print, which should always tries to use a rich output for an object (falling back on the plain text), while the plain print function should always use the plain text for the object.
  1. I don't really like right now how the graphics and text are treated very differently at the moment -- the graphics object are responsible for creating their own output types, while the display manager/backend is responsible for creating text output types. I would define both ascii art and latex output as rich output rather than plain text output, and would then move the logic for an object's rich output to the _rich_repr_ method of the object itself (in this case it would go into SageObject._rich_repr_).
  1. I'm getting a lot of doctests failing under sage.plot (I can attach a log if you aren't getting them). A lot of them are fixed with changing tachyon.png.save to tachyon.png.save_as on line 244 of sage.plot.plot3d.base (this also fixes 3d plots in SageNB for me).

comment:30 Changed 5 years ago by git

  • Commit changed from 2d915f086b25c7c72cf1fc9d0dd441015abd9fad to be577ff8984fb70f4bd4963dbc4ec6aa3274201d

Branch pushed to git repo; I updated commit sha1. New commits:

be577ffRename Lightwave -> Wavefront obj

comment:31 Changed 5 years ago by vbraun

1) sounds good, I can make the change

2) agree but thats yet another ticket for sure. a better name for the viewer='...' keyword option that works also for plain text / latex / 2d animation formats / ... would be nice, too. (see also: #17783)

3) our text formatters are special in that they also apply to non-Sage objects, namely tall Python list and alike. So we can't just move them to SageObject._rich_repr_

4) I see, I have Java installed and you don't. Fixed.

comment:32 Changed 5 years ago by git

  • Commit changed from be577ff8984fb70f4bd4963dbc4ec6aa3274201d to af73513af04815e472d1983c4d1d648e0eb780f4

Branch pushed to git repo; I updated commit sha1. New commits:

af73513Fix saving 3d preview image without java

comment:33 Changed 5 years ago by vbraun

I've opened #17821 to collect the ideas for refactoring show / pretty_print

comment:34 Changed 5 years ago by git

  • Commit changed from af73513af04815e472d1983c4d1d648e0eb780f4 to f5b31e40b9881d3b5ce4a5fb6a4681a0731ea7cc

Branch pushed to git repo; I updated commit sha1. New commits:

f5b31e4Rename mathjax -> latex in rich output types

comment:35 Changed 5 years ago by vbraun

  • Status changed from needs_work to needs_review

comment:36 Changed 5 years ago by git

  • Commit changed from f5b31e40b9881d3b5ce4a5fb6a4681a0731ea7cc to 82b4bc1d00adee5f209309ec880d7a82c3ad18f2

Branch pushed to git repo; I updated commit sha1. New commits:

82b4bc1use the plot3d viewer keyword

comment:37 Changed 5 years ago by ohanar

Regarding point 3:

But they don't work consistently, which is precisely the problem with trying to handle the all text with the display manager (the object itself is always going to know best how to represent itself). For instance, the tall list stuff only works for lists and tuples, not sets or dicts or even Sage's Set_object.

I would rather see something like a _call_plain_repr method that checks whether an object is a builtin type that we are giving a our own repr method to, and then call our repr method in that case (rather than the the built in one).

Regardless, there would be a lot of redoing of stuff to make something like that work, so it is probably best to put in another ticket anyway.


I'm still getting doctest errors on my machine (which as you can tell, doesn't have too much on it). I'll attach a log in a moment.

Last edited 5 years ago by ohanar (previous) (diff)

comment:38 Changed 5 years ago by ohanar

  • Status changed from needs_review to needs_work

comment:39 Changed 5 years ago by vbraun

Imho the ascii art is the right way to do it, boxes that are aware of height/width and baseline. Then assemble containers etc. Maybe make ascii art the default at one point. I hesitate to kludge too much on top of the plain text, this would lead to massive changes to the Sage libray doctests.

comment:40 Changed 5 years ago by ohanar

Sure, in that case in the _call_rich_repr method you could do something special for builtin python objects.

comment:41 Changed 5 years ago by vbraun

Ok, your libpng puts out a different sub-version of png and no imagemagick/ffmpeg. I'll fix it when I have some time.

There is already a framework around _ascii_art_() methods, so I would recommend to build on top of that.

comment:42 Changed 5 years ago by kcrisman

Apparently fixes #17858 - I haven't personally confirmed this.

comment:43 Changed 5 years ago by vbraun

The failing tests for PNG output actually don't work in the released Sage either, e.g.

sage: sum([dodecahedron(center=[2.5*x, 0, 0], color=(1, 0, 0, x/10)) for x in range(2)]).show(viewer='tachyon')

produces no output. It does create a 0-byte png file, and this ticket is the first to test whether it starts with the PNG magic. The tachyon source file is invalid, but tachyon apparently returns 0 on error.

comment:44 Changed 5 years ago by git

  • Commit changed from 82b4bc1d00adee5f209309ec880d7a82c3ad18f2 to 2c34e3aebb4d7bfb68758e4258381948386305da

Branch pushed to git repo; I updated commit sha1. New commits:

2c34e3aCheck for Tachyon errors, remove the non-blocking tachyion option

comment:45 Changed 5 years ago by git

  • Commit changed from 2c34e3aebb4d7bfb68758e4258381948386305da to cc9a5af4a97236ab06555724ab81ba9717fedb0d

Branch pushed to git repo; I updated commit sha1. New commits:

cc9a5afNormalize plot data (like texture opacity) to float

comment:46 Changed 5 years ago by vbraun

The problem was that tachyon doesn't understand rational input like "Opacity 1/10". Fixed by normalizing everything to float before handing it to plotting backends.

comment:47 Changed 5 years ago by git

  • Commit changed from cc9a5af4a97236ab06555724ab81ba9717fedb0d to 37ae94afecee8011327f72b64405365ee5430bde

Branch pushed to git repo; I updated commit sha1. New commits:

37ae94aMark all animations that require ImageMagick as #optional

comment:48 Changed 5 years ago by vbraun

This should fix all of your doctest failures

Changed 5 years ago by ohanar

comment:49 Changed 5 years ago by ohanar

I've attached other various doctest failures throughout the library. They look trivial (just missed).

comment:50 Changed 5 years ago by git

  • Commit changed from 37ae94afecee8011327f72b64405365ee5430bde to 29853da7890b555e1a172ec224748946a9e8a208

Branch pushed to git repo; I updated commit sha1. New commits:

29853dafix remaining doctest failures

comment:51 follow-up: Changed 5 years ago by git

  • Commit changed from 29853da7890b555e1a172ec224748946a9e8a208 to 6c6becd7cb44b4049471f5e53879ead2ad571cf2

Branch pushed to git repo; I updated commit sha1. New commits:

57469c6correct file permissions
6c6becdmark more animation doctess as optional ImageMagick

comment:52 in reply to: ↑ 51 Changed 5 years ago by charpent

Replying to git:

[ ... ]

A couple data point for this commit (6.6 beta1 built from scratch + this trac branch) : 1) code builds OK, but doc building fails (" make doc-clean && make " succeeds). 2) in the Ipython notebook :

  • %display typeset gives typeset (MathJax?) output. At last ! This was my motivation for testing this branch.
  • %display ascii_art fails for not having an output stream
  • %display simple restores default output (whew...)
  • no 3D viewer available but tachyon."jmol" and "canvas3d" fail silently, "java3d" gives a deprecation warning pointing to "wavefront", which fails silently.

Hoping this helps.

comment:53 Changed 5 years ago by git

  • Commit changed from 6c6becd7cb44b4049471f5e53879ead2ad571cf2 to 38c6db0e5af5d217b7b07cb0d820fee1075a8012

Branch pushed to git repo; I updated commit sha1. New commits:

38c6db0Fix ascii art in the IPython notebook

comment:54 Changed 5 years ago by vbraun

I fixed the ascii art issue.

I'm aware that there is still no 3d graphics in the notebook at this point, but that should go to another ticket.

comment:55 Changed 5 years ago by git

  • Commit changed from 38c6db0e5af5d217b7b07cb0d820fee1075a8012 to 7c17bced498bc2eb9bd10519ffc6dc6d9ab7a142

Branch pushed to git repo; I updated commit sha1. New commits:

7c17bceFix documentation build

comment:56 Changed 5 years ago by git

  • Commit changed from 7c17bced498bc2eb9bd10519ffc6dc6d9ab7a142 to fcbc5884e9252b75734c125fb436eb26c8d798d6

Branch pushed to git repo; I updated commit sha1. New commits:

fcbc588fix the last missing optional ImageMagick

comment:57 Changed 5 years ago by vbraun

  • Status changed from needs_work to needs_review

Doctests now also pass without ImageMagick

comment:58 Changed 5 years ago by charpent

I got 3 failures after "ID 215-02-28-17-11-36-39ff4408", testlong got three failures in src/sage/plot/plot3d/base.pyx (see below) , all bound to 3D graphics. The rest got no failures.

I got no build failure after integrating the last commit(s), but I did not rebuild from scratch.

Is that enough for "positive review" ? Do you need a scratch build (long since serial : I didn't integrate #17839...) ?

HTH.

The three errors :

charpent@asus16-ec:/usr/local/sage-6.6$ sage -t --long --warn-long 24.8 src/sage/plot/plot3d/base.pyx
Running doctests with ID 2015-02-28-19-11-29-0b70177c.
Git branch: t/17234/rich_output_and_the_ipython_notebook
Doctesting 1 file.
sage -t --long --warn-long 24.8 src/sage/plot/plot3d/base.pyx
**********************************************************************
File "src/sage/plot/plot3d/base.pyx", line 1422, in sage.plot.plot3d.base.Graphics3d.save_image
Failed example:
    G.save_image(gif)
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/sage-6.6/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 492, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/sage-6.6/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 854, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.plot.plot3d.base.Graphics3d.save_image[5]>", line 1, in <module>
        G.save_image(gif)
      File "sage/plot/plot3d/base.pyx", line 1434, in sage.plot.plot3d.base.Graphics3d.save_image (build/cythonized/sage/plot/plot3d/base.c:16182)
        Image.open(png).save(filename)
      File "build/bdist.linux-x86_64/egg/PIL/Image.py", line 2006, in open
        raise IOError("cannot identify image file")
    IOError: cannot identify image file
**********************************************************************
File "src/sage/plot/plot3d/base.pyx", line 1423, in sage.plot.plot3d.base.Graphics3d.save_image
Failed example:
    assert open(gif).read().startswith('GIF')
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/sage-6.6/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 492, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/sage-6.6/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 854, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.plot.plot3d.base.Graphics3d.save_image[6]>", line 1, in <module>
        assert open(gif).read().startswith('GIF')
    AssertionError
**********************************************************************
File "src/sage/plot/plot3d/base.pyx", line 1474, in sage.plot.plot3d.base.Graphics3d.save
Failed example:
    cube().save(tmp_filename(ext='.gif'))
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/sage-6.6/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 492, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/sage-6.6/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 854, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.plot.plot3d.base.Graphics3d.save[5]>", line 1, in <module>
        cube().save(tmp_filename(ext='.gif'))
      File "sage/plot/plot3d/base.pyx", line 1480, in sage.plot.plot3d.base.Graphics3d.save (build/cythonized/sage/plot/plot3d/base.c:16543)
        self.save_image(filename)
      File "sage/plot/plot3d/base.pyx", line 1434, in sage.plot.plot3d.base.Graphics3d.save_image (build/cythonized/sage/plot/plot3d/base.c:16182)
        Image.open(png).save(filename)
      File "build/bdist.linux-x86_64/egg/PIL/Image.py", line 2006, in open
        raise IOError("cannot identify image file")
    IOError: cannot identify image file
**********************************************************************
2 items had failures:
   1 of   7 in sage.plot.plot3d.base.Graphics3d.save
   2 of   8 in sage.plot.plot3d.base.Graphics3d.save_image
    [297 tests, 3 failures, 44.46 s]
----------------------------------------------------------------------
sage -t --long --warn-long 24.8 src/sage/plot/plot3d/base.pyx  # 3 doctests failed
----------------------------------------------------------------------
Total time for all tests: 44.6 seconds
    cpu time: 1.3 seconds
    cumulative wall time: 44.5 seconds

comment:59 Changed 5 years ago by vbraun

I don't know what "ID 215-02-28-17-11-36-39ff4408" is, but these failures might be the same ones that I fixed in cc9a5af.

comment:60 Changed 5 years ago by git

  • Commit changed from fcbc5884e9252b75734c125fb436eb26c8d798d6 to a173e92ae42f3fb9fda3c70963ff29dcdffca7e6

Branch pushed to git repo; I updated commit sha1. New commits:

a173e92Do not change permissions on doctest sample files

comment:61 Changed 5 years ago by vbraun

Passed tests on the buildbot!

comment:62 Changed 5 years ago by charpent

  • Reviewers changed from R. Andrew Ohana to R. Andrew Ohana, Emmanuel Charpentier
  • Status changed from needs_review to positive_review

a173e92 builds without a hitch and passes (p)testlong with no failure ; the Ipython notebook is functional and displays Mathjax and asci art ==> positive review.

The (temporary) loss of 3D plotting is a (small) nuisance, though. Are there already tickets to watch for this functionality ?

I also note that plot3d(..) or p1=plot3d(...) ; p1 does display in the Ipython notebook, as long as no argument of plot3d has to be passed to show() and friends. Is this "vestigial" (or "embryonic") 3D displaying the intended behaviour ?

Last edited 5 years ago by charpent (previous) (diff)

comment:63 follow-up: Changed 5 years ago by kcrisman

The (temporary) loss of 3D plotting is a (small) nuisance, though.

I assume you mean only in the IPython notebook, not in the sagenb?

comment:64 in reply to: ↑ 63 Changed 5 years ago by charpent

Replying to kcrisman:

The (temporary) loss of 3D plotting is a (small) nuisance, though.

I assume you mean only in the IPython notebook, not in the sagenb?

Yes, indeed. My curiosity was towards the notebook functionality : the Ipython notebook, wit its one-file container, is a real boon.

But, for me at least, not having typeset math (or at least decent ascii_art display) is a pain. So I'm eager to see an Ipython notebook with typesetting functionality.

comment:65 Changed 5 years ago by vbraun

  • Branch changed from u/vbraun/rich_output_and_the_ipython_notebook to a173e92ae42f3fb9fda3c70963ff29dcdffca7e6
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:66 Changed 5 years ago by gagern

  • Cc gagern added
  • Commit a173e92ae42f3fb9fda3c70963ff29dcdffca7e6 deleted

The changes committed here interfere heavily with my work from #7298 for animations displayed in the HTML5 <video> tag, and raise new questions for #16650 about APNG integration. I'd be very happy if the people involved in landing this code here could have a look at those tickets as well, advise how to proceed there and perhaps re-evaluate some design decisions made here.

comment:67 Changed 5 years ago by novoselt

Volker - what is the relation between stuff here and EMBEDDED_MODE? The latter is still spread over the source.

comment:68 Changed 5 years ago by vbraun

This ticket wasn't about removing the remaining 55 occurrences of EMBEDDED_MODE, thats another job... It should be removed, but its going to take time.

comment:69 follow-up: Changed 5 years ago by iandrus

I would like to use this to typeset the output in Emacs, but I need some sort of delimiters on the latex, so that I don't try to typeset backtraces, the result of print statements, etc. In fact, it would be nice to have both plain text and latex outputs properly delimited so that I can switch between the two. e.g. display the plain text until the latex rendering is finished.

Does it make sense to add a OutputDelimitedLatex? class and update BackendIPythonCommandline? I run an ipython shell from inside Emacs.

comment:70 in reply to: ↑ 69 Changed 5 years ago by iandrus

Replying to iandrus:

Does it make sense to add a OutputDelimitedLatex? class and update BackendIPythonCommandline? I run an ipython shell from inside Emacs.

I have a very experimental branch at u/iandrus/emacs-typeset-output with the basics of what I'm thinking of. It's definitely not finished, but if the general approach seems reasonable, I'll polish it up and open a ticket etc.

comment:71 follow-up: Changed 5 years ago by vbraun

IMHO emacs-mode should define its own backend, possibly by inheriting from the ipython command line backend. Thats why there are pluggable backends. Then you can format OutputLatex in precisely the way the emacs-mode needs without stepping on anybody else's toes.

comment:72 in reply to: ↑ 71 Changed 5 years ago by iandrus

Replying to vbraun:

IMHO emacs-mode should define its own backend, possibly by inheriting from the ipython command line backend. Thats why there are pluggable backends. Then you can format OutputLatex in precisely the way the emacs-mode needs without stepping on anybody else's toes.

Thanks. I opened #18115 with the new approach. It seems to work, but I've probably forgotten something.

Note: See TracTickets for help on using tickets.