sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.41k stars 474 forks source link

Copy sagenb @interact documentation #27747

Open jdemeyer opened 5 years ago

jdemeyer commented 5 years ago

Copy the documentation for @interact from sagenb to Sage, ideally as interact.__doc__

Depends on #27735

CC: @kcrisman @slel @zerline

Component: documentation

Author: Jeroen Demeyer

Branch/Commit: u/jdemeyer/ticket/27747 @ 3756301

Issue created by migration from https://trac.sagemath.org/ticket/27747

jdemeyer commented 5 years ago
comment:1

An interesting question is: how should the docs look like? Currently, in sagenb they are formatted as

        sage: @interact
        ....: def _(title=["A Plot Demo", "Something silly", "something tricky"], a=input_box(sin(x*sin(x*sin(x))), 'function'),
        ....:     clr = Color('red'), thickness=[1..30], zoom=(1,0.95,..,0.1), plot_points=(200..2000)):
        ....:     html('<h1 align=center>%s</h1>'%title)
        ....:     print(plot_points)
        ....:     show(plot(a, -zoom*pi,zoom*pi, color=clr, thickness=thickness, plot_points=plot_points))
        <html>...

This shows the code used to generate the interact, but it doesn't show the resulting widget nor the output of running the interact. It's not easy to do that since interacts are inherently graphical, so there may not be a sensible text representation (although in some cases, the output of an interact is textual).

So it's not that useful as documentation. I wonder if we can do better.

jdemeyer commented 5 years ago

Description changed:

--- 
+++ 
@@ -1 +1 @@
-
+Copy the documentation for `@interact` from sagenb to Sage, ideally as `interact.__doc__`
jdemeyer commented 5 years ago

Branch: u/jdemeyer/ticket/27747

slel commented 5 years ago

Commit: 3756301

slel commented 5 years ago

New commits:

335f0a7Support matrix in interact
3756301Document @interact
embray commented 5 years ago
comment:5

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

dimpase commented 4 years ago
comment:6

Does anyone understand the story of sagenb interacts vs jupyter interacts. With the switch to Python 3, there is no sagenb available.

It appears that some code from sagenb is still used in jupyter interacts, though.

kcrisman commented 4 years ago
comment:7

Does anyone understand the story of sagenb interacts vs jupyter interacts. With the switch to Python 3, there is no sagenb available.

What I do know is that there is some small differences in functionality between Sage cell, CoCalc Sage worksheets (.sagews), Jupyter, and sagenb. I have never seen a 100% reliable list of all such differences, though see #25387 for something related (not directly about interact). See also #27752 for something annoying, and #27735 where at least one instance of less functionality in Jupyter got fixed.

It appears that some code from sagenb is still used in jupyter interacts, though.

Wow.

kcrisman commented 4 years ago
comment:8

So it's not that useful as documentation. I wonder if we can do better.

See the related #28246.