sympy / sympy.github.com

SymPy's web page (sympy.org)
https://sympy.org/
188 stars 108 forks source link

Browser testing of new JupyterLite-based live shell sympy.org/en/shell.html #176

Open ivanistheone opened 2 years ago

ivanistheone commented 2 years ago

We recently launched a new version of the SymPy Live shell on the website and need eveyone's help testing the shell works on various browsers and operating systems (in particular mobile browsers).

Context: this testing will help us iron out any issues before we move forward migrating https://live.sympy.org/ to use the JupyterLite-based shell.

Instructions:

  1. Using your mobile device, go to the URL: bit.ly/sympyjstest
    • click the first link to the shell and try entering some SymPy commands
    • click on one of the links under "evaluate commands" to test the backward compatibility of saved sessions
  2. Add a comment to this issue to indicate the results:
    • did it work or did it hang (code cells stuck showing [*])
    • if it worked, how long did it take to load?

Be sure to include information about the browser you used and the operating system version. If you see errors displayed, please take a screenshot and post image in your comment.

ivanistheone commented 2 years ago

Edge on iOS WORKS

Edge on iOS works

A little slow (30 seconds) but overall works fine.

ivanistheone commented 2 years ago

Safari, Opera, and Firefox on iOS doesn't work

iOS browser testing

Shell hangs [*] and sometimes errors are displayed (see https://github.com/jupyterlite/jupyterlite/issues/632 and https://github.com/jupyterlite/jupyterlite/issues/633).

Current guess is that issue is upstream with Pyodide, not something specific to JupyterLite, so we can hope it will be fixed eventually.

ivanistheone commented 2 years ago

Device: iPhone 13 with latest iOS

I tried the online shell in both Safari and Chrome and saw the same error:

Safari on iPhone 13 fails Chrme on iPhone 13 fails

ivanistheone commented 2 years ago

Chrome on recent Samsung Galaxy (Android) works:

Chrome on Samsung Galaxy works

though I noticed some weirdness about the Instructions font size.

certik commented 2 years ago
asmeurer commented 2 years ago

I see this error in the console every time I load the page

GET https://www.sympy.org/live/api/contents/all.json 404
ivanistheone commented 2 years ago

I see this error in the console every time I load the page GET https://www.sympy.org/live/api/contents/all.json 404

That's OK. This is a lookup for pre-loaded notebooks that JupyterLab does on startup. Since we're using only the REPL and not the notebooks feature (we have no content), this occurs.

Maybe we could add a {} content to avoid generating this error, but it's definitely not on the critical path.

jtpio commented 2 years ago

Maybe we could add a {} content to avoid generating this error, but it's definitely not on the critical path.

For reference this could indeed be done by adding some placeholder content to the deployment. For example by adding the following:

# populate placeholder content to avoid 404s errors in the dev tools console when fetching all.json
mkdir contents
cp README.md contents

Before https://github.com/sympy/live/blob/86b6acbe1ed5bc2ee10337345c3b97476c5c2dd0/.github/workflows/deploy.yml#L26

ivanistheone commented 2 years ago

Update on the iOS problems.

Apparently all errors we saw were due to an upsteam issue in pyodide being broken WASM in iOS 5.4, but it that seems to be fixed now in latest iOS 5.5.

I encourage anyone with an iPad/iPhone to try out the links in: https://bit.ly/sympyjstest
EXPECTED: there should be no more errors

If you encounter an errors plz add comment to this thread.

asmeurer commented 2 years ago

I still have issues where it won't load in the builtin browser of the Twitter app. It loads just fine in the safari app.

I also saw an issue with someone else's android phone where it was impossible to type something without autocorrect changing it. I believe what we were trying to type was something like primepi(1000).

ivanistheone commented 2 years ago

Testing report from a friend (received by email).

I finally got around to testing this on a couple of Android devices. On an old Lenovo Android 4.4 device, it does not appear to load at all, but that's not too surprising given the age of both Android and the device. On the Pixel C, with a much newer Android version (at least 8), the examples all seem to run correctly, albeit naturally slower than on desktop.

Generally, though, while it works, it is really hard to know when it's working / ready in the beginning due to lack of feedback during delays. This is mostly during startup, and I did see the note about it, but even on a fast computer it takes so long that basically I'm left wondering if it's still starting up or if something has gone wrong.

asmeurer commented 2 years ago

I agree the feedback could be better (IMHO even the notebook itself has this problem). Presumably this is something that should be improved in the upstream jupyterlite.

jtpio commented 2 years ago

Android 4.4 is indeed extremely old and not supported anymore by most mobile applications anyway.

Improved visual feedback while the shell is loading is tracked in https://github.com/jupyterlite/jupyterlite/issues/619.

asmeurer commented 2 years ago

What needs to be done to complete the SymPy Live migration? The docs no longer have the extension at all, so I believe all that needs to be done is to redirect live.sympy.org to https://www.sympy.org/en/shell.html, and to shut down the app engine service.

ivanistheone commented 2 years ago

Sorry for being so slow with this.

I just finished dev steps for PHASE3, so if anyone wants to review and merge https://github.com/sympy/live/pull/13 then we'll be ready to change the DNS for live.sympy.org (PHASE4).

ivanistheone commented 2 years ago

Okay merged PR#13 and it works: https://www.sympy.org/live/ (this will be the future live.sympy.org)

I'm going to wait to hear from @jtpio about these questions https://github.com/sympy/live/issues/7#issuecomment-1266934802 about the customization I did on the index.html before proceed with DNS switchover.

ivanistheone commented 2 years ago

@certik Would you have time in coming days to do the DNS changes?

I am available tomorrow (Wednesda) and Thursday for "live debugging" in case we need to change anything in the repo at the same time.

certik commented 2 years ago

Yes, let's do that.

asmeurer commented 2 years ago

Looks like the DNS change has happened, and live.sympy.org now points to the webassembly version. Can we disable the billing in the App Engine version now? Also, what remains to be done? Should we archive the sympy-live repository?

ivanistheone commented 2 years ago

Yes we "launched" the wasm version (served from github pages) with Certik last week, so we can shut down the GAE project (nothing points to it anymore). I tagged you with that task in the google doc.

I had a few more cleanup tasks planned in PHASE 5 and I hope to get to them later this week (finishing up some work on a deadline today/tomorrow).

Also, I was thinking of posting a twitter thread with examples of various useful things you can do with the live shell (with screenshots and links). It would be great if the SymPy account can re-tweet. I suck at marketing, but I think we need to promote the live shell more since it's such a good tool for learning/teaching.

Let me know if any objections if I post form my personal account or if y'all have suggestions for people we can tag in the tweets to attract more attention.

asmeurer commented 2 years ago

Yes we "launched" the wasm version (served from github pages) with Certik last week, so we can shut down the GAE project (nothing points to it anymore). I tagged you with that task in the google doc.

I have disabled the billing for SymPy Live in the App Engine.

Also, I was thinking of posting a twitter thread with examples of various useful things you can do with the live shell (with screenshots and links). It would be great if the SymPy account can re-tweet. Lol... I suck at marketing, but I think we need to promote the live shell more since it's such a good tool for learning/teaching.

I can also just post the thread directly from the SymPy account if you'd like. Either way, let me know (I control the SymPy Twitter account).

ivanistheone commented 2 years ago

Okay cool. I'll work ont he thread and adding preparing the evaluate=? URLs for each example and let you know when it's ready. I guess it makes more sense to post from the official SymPy account (since I don't have much followers).

Here is the code I wrote last week that takes a string of commands (separated by blank lines) and turns them into a evaluate query sting

from urllib.parse import quote

BASE_URL = "https://live.sympy.org/"
SAFE_CHARS = "-_.!~*'()"  # according to `encodeURIComponent` in JS

def hist_to_qs(codein):
    codein = codein.strip()
    cells = codein.split("\n\n")
    cellouts = []
    for cell in cells:
        lines = cell.split("\n")
        cellout = ""
        for line in lines:
            cellout += line + "\n"
        cellouts.append(cellout)
    codeout = "#--\n".join(cellouts)
    return "evaluate=" + quote(codeout, safe=SAFE_CHARS)

See this notebook for usage examples: https://github.com/minireference/noBSstatsnotebooks/blob/main/notebooks/explorations/SymPy_Live_evaluate_URL_encoder.ipynb

It would be cool to package this funtion as some kind of jupyter notebook plugin to make it easy to "share" sympy commands, but for now just use manually.