sagemathinc / cocalc

CoCalc: Collaborative Calculation in the Cloud
https://CoCalc.com
Other
1.14k stars 207 forks source link

Sage interact library doesn't seem to work within sagews files #4626

Open kcrisman opened 4 years ago

kcrisman commented 4 years ago

The command

interacts.calculus.definite_integral()

should "just work", but doesn't appear to, in .sagews sheets. The error is that it simply returns the html rather than said html being rendered. It does seem to work in the Jupyter notebook.

williamstein commented 4 years ago

For some reason the interacts library is using the sagenb version of the interacts codes and widgets. This is controlled by this code, in sage/interacts/library.py which amusingly it seems that @haraldschilly and I wrote like a decade ago:

image

I don't know if we ever modified Sage or patched Sage to make this work in CoCalc, and I don't know of any workaround to make this work, except "use Jupyter" instead.

kcrisman commented 4 years ago

For some reason the interacts library is using the sagenb version of the interacts codes and widgets.

I think that was intentional at that time, yes. It's not clear to me where else these things live (I mean inside vanilla Sage).

I don't know if we ever modified Sage or patched Sage to make this work in CoCalc, and I don't know of any workaround to make this work, except "use Jupyter" instead.

But interacts do work in CoCalc Sage worksheets, so presumably there could be a way to make this work. How do these particular globals in Jupyter get "known" by Sage?

williamstein commented 4 years ago

so presumably there could be a way to make this work.

Yes definitely. One way would be to somehow patch the version of sage/interacts/library.py that is on CoCalc.com. I can't remember if we every tried doing that, but it would work if done right.

kcrisman commented 4 years ago

Possibly also relevant is https://github.com/sagemath/sagecell/issues/385 where you mention monkey patching something in "Salvus" (haven't seen that name in some time!).