Opened 10 years ago

Closed 5 years ago

#7908 closed enhancement (fixed)

Published interacts

Reported by: mpatel Owned by: was
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: notebook Keywords:
Cc: was, jvkersch, kcrisman Merged in:
Authors: Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by mpatel)

Worksheets in the Sage notebook can contain live interact-ive cells, which may make it easier to understand how an object's properties depend on a set of parameters. Please visit the Sage Wiki to view some examples. Currently, however, interact cells do not work in published worksheets.

To enable live published interacts, apply the patch

Note: it depends on #7666 and its dependencies. Or use this spkg with 4.3.1.alpha2:

Please visit the Notebook Settings page to enable live public interacts.

Attachments (3)

trac_7908-pub_interact_c11.patch (403.3 KB) - added by timdumol 10 years ago.
Rebase on a new patch set.
trac_7908-pub_interact_c11(3).patch (381.5 KB) - added by timdumol 10 years ago.
Latest rebase.
trac_7908-pub_interact_c11-rebase.patch (401.7 KB) - added by timdumol 10 years ago.
Rebase of patch to patch set given in comment.

Download all attachments as: .zip

Change History (29)

comment:1 Changed 10 years ago by mpatel

  • Description modified (diff)
  • Status changed from new to needs_review

The chief leftover tasks, I think, are to

  • Allow only interactive public cells to be evaluated, e.g., someone evaluate_cell in a JS console.
  • Limit the use of sage_eval in published interacts.
  • Enforce the 'doc_pool_size' (and a 'pub_pool_size') but avoid any wrap-around problems. We could add checks in *_eval and *_cell_update, return an updated worksheet_filename, and/or send the user a message (e.g., to reload the page or wait a few minutes and try evaluating again).

comment:2 follow-up: Changed 10 years ago by mpatel

One more task:

  • Avoid creating a new cookie (MD5 sum, etc.) for every public request.

comment:3 in reply to: ↑ 2 Changed 10 years ago by mpatel

  • Description modified (diff)

Replying to mpatel:

  • Avoid creating a new cookie (MD5 sum, etc.) for every public request.

I'm not sure about how to set globally just one cookie for anonymous visitors. Setting it twist.AnonymousToplevel.render works only for those who visit the login page. twist.PublicWorksheet.render could be a good place. But it seems we don't actually use anonymous cookies, so we could just not generate them at all (see guard.MySessionWrapper.requestAnonymousAuthentication). The sessions do eventually expire; I don't know how much they affect memory use and performance.

comment:4 Changed 10 years ago by mpatel

V10 allows only published interacts to be evaluated. It also quits the sage process for doc/pub-browser worksheets on unload.

comment:5 follow-up: Changed 10 years ago by mpatel

  • Description modified (diff)

V11 includes an attempt to reduce flicker and jumping during interact updates.

comment:6 Changed 10 years ago by mpatel

By the way, I've also run a few files through the pep8 checker with

pep8 --repeat --show-source --ignore=E251,E301,E302,E501 foo.py

comment:7 in reply to: ↑ 5 Changed 10 years ago by mpatel

Replying to mpatel:

V11 includes an attempt to reduce flicker and jumping during interact updates.

In particular, we may need to adjust the timing or make it an option. A div's 'ready' event fires too early. DIVs don't have 'load' events, unfortunately.

comment:8 Changed 10 years ago by mpatel

  • Description modified (diff)

Changed 10 years ago by timdumol

Rebase on a new patch set.

comment:9 follow-up: Changed 10 years ago by timdumol

This is the patch set this was rebased on,

trac_7650-sagenb_doctesting_v6.patch
trac_7650-reviewer.patch
trac_7648-missing_indent.patch
trac_7663-rstrip_prompt.patch
trac_7847-empty-trash-no-referer.patch
trac_7786-template-jinja-idiomatic.patch
trac_7863-declare_vars_aux_js_v2.patch
trac_7874-typeset_interact_labels.patch
trac_7858-key_binding_vars_v2.patch
trac_7666-alphanumeric_cell_ids_B5.patch
trac_7666-reviewer.patch
trac_7835-preparsing-unicode_v2.patch
trac_7249_jinja2_v5.patch
trac_2779-sagenb-error-message.patch
2779_2_banner.patch
trac_3154-spurious-u0027-output.patch
trac_7969-escaped-backslash.patch
trac_7937-sass_manifest.patch
trac_4217-html-system-formatting.patch
trac_3083-print-documentation.patch
trac_7962-link-worksheets-zip-file.patch
trac_5177-delete-cell-dirs.patch
trac_7908-pub_interact_c11.patch

Please check if the rebase went wrong: I can't seem to access worksheet pages.

comment:10 Changed 10 years ago by timdumol

  • Status changed from needs_review to needs_work

comment:11 Changed 10 years ago by mpatel

Hi Tim, Thanks for piling it on --- in a great way! I'll try to work through the set...

comment:12 in reply to: ↑ 9 Changed 10 years ago by mpatel

  • Work issues set to Rebase

Replying to timdumol:

This is the patch set this was rebased on, [...] Please check if the rebase went wrong: I can't seem to access worksheet pages.

It probably did, given the changes to the queue --- last time I checked, what I posted did work, at least for me. I would really like this reviewed, given that it's large, I don't want to keep rebasing it (this was transplanted from #6855), implements some potentially useful changes (e.g., JSON-encoding for server-to-client data), and because it's important for #6855. I'll try to rebase this later this week, after some dust has settled. Given the many other (and quite welcome) changes afoot right now and the fact that I'm not in Seattle, it doesn't seem practical to this now.

comment:13 Changed 10 years ago by mpatel

To clarify: I mean that, e.g., the spkg worked for me with 4.3.1.alpha2. Of course, much has changed in just a few days.

Changed 10 years ago by timdumol

Latest rebase.

comment:14 Changed 10 years ago by timdumol

I'm having trouble rebasing it properly. Can you please try rebasing it on, say, sagenb-0.6 + #7249? That should do with most of the rebasing. Alternatively, you can wait till sagenb-0.7, which should be coming real soon due to the number of patches fixed, before rebasing. I'm real sorry that I can't rebase the patch all too well.

comment:15 Changed 10 years ago by mpatel

No worries. I'll definitely take care of it after the next version of SageNB is ready. I hope you have/had a safe trip!

Changed 10 years ago by timdumol

Rebase of patch to patch set given in comment.

comment:16 Changed 10 years ago by timdumol

This is the patch set I rebased this on:

sagenb-0.7.5.3 +

trac_5712-interrupt-notification.6.patch
trac_7501-codemirror_partB.patch
trac_7501-codemirror_partA.patch
trac_6069-missing_pub_ws.3.patch
3154_escaping_quotes.5.patch
trac_8249-notebook_cookies.2.patch
trac_8436-no_jsmath_for_wrapped.patch
trac_8092-init_sage.2.patch
trac_8038-email_plus_addressing_v2.patch
trac_693-spawn_notebook.3.patch
trac_7997-ast-display-hook.patch
trac_7633-nb_settings_buttons.patch
trac_7633-nb_settings_buttons-reviewer.patch
trac_7908-pub_interact_c11.patch

I reverted some of the improvements on twist.py (the part with Toplevel's) because it was causing cookie problems. I also renamed cell.py's private variables to use single underscores instead, because that was causing AttributeError?'s.

I may have made a mistake in the rebasing, because I could not get interacts to work on published worksheets. The controls showed and seemed to work, but the graphics did not display.

comment:17 Changed 9 years ago by timdumol

Hi, any updates on this?

comment:18 Changed 9 years ago by jvkersch

  • Cc jvkersch added

Just a comment: Mike Hansen pointed out this ticket after I asked a question about it on AskSage.

comment:19 Changed 8 years ago by kcrisman

  • Cc jvkerschm kcrisman added; jvkersch removed

comment:20 Changed 8 years ago by kcrisman

  • Cc jvkersch added; jvkerschm removed

comment:21 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:22 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:23 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:24 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:25 Changed 5 years ago by kcrisman

  • Authors Mitesh Patel deleted
  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Reviewers set to Karl-Dieter Crisman
  • Status changed from needs_work to positive_review
  • Work issues Rebase deleted

Turns out this has been possible (though a highly experimental feature) for over three years! (Somewhat scarily, they auto-evaluate... but it's cool, very similar in spirit to the cell server.)

comment:26 Changed 5 years ago by vbraun

  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.