-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use JupyterLite and Pyodide for the online shell #169
Conversation
For reference https://numpy.org is also now using JupyterLite to let folks try numpy in the browser: numpy/numpy.org#547 |
A follow-up to this would be to make a custom JupyterLite in a repo under the The custom deployment can easily be made from this GitHub template: https://github.com/jupyterlite/demo This means the URL of the IFrame could then be updated to https://sympy.org/live/repl/ |
Hey, this looks like a good start. I have a few comments.
I also still need to figure out how to test this on mobile. The existing site works very well on mobile, so it would be a shame to give that up if jupyterlite isn't mobile friendly. |
By the way, are persistent sessions possible with jupyterlite? If the answer is "no" that's fine, but I'm curious if it's possible. |
Thanks for the feedback 👍
Maybe there could be a splash screen in the app itself (would need to be added).
Sounds good.
This could even be pre-executed by default.
On mobile
I think
Agree. This is because the repl reusing the JupyterLab code console as is. jupyterlite/jupyterlite#148 has some mockups and discussions on what a single cell app would look like.
This might require the call to On mobile the repl takes the whole width, but the page is still scrollable so I would expect it to be usable: |
If "presistent" means being able to reuse the same execution context (kernel), then not yet. But it might be possible via a service worker at some point (wip started in jupyterlite/jupyterlite#137). |
It sounds like a lot of these issues will be fixed automatically over time as the jupyterlite console improves. So we don't need to block this on anything of that nature (including the splash screen assuming that's something that would load instantly; otherwise we should add something static to this page).
Adding an explicit call to The examples thing presumably is just happening because MathJax isn't being loaded on the page.
Yes, this was just me opining on the existing options at live.sympy.org. I think the only option that needs to be present is Enter vs. Shift-Enter, and that's probably another thing that should be part of jupyterlite itself rather than on the SymPy site. And once again, I would strongly encourage you to make Enter the default (everywhere, not just on mobile). I don't know how hard that is to change, but if it can't be fixed before this is merged we will need to add some text on the page explaining to use Shift-Enter to execute.
I want to test this on an actual phone too. I guess we can push this up somewhere to test it. |
@asmeurer ok, it seems this PR is the way to go. As you commented at sympy/sympy-live#198 (comment), it seems that what needs to be done is:
Can you be more specific? Let's get this done soon. If it's simple enough, I can help. |
Yes, see my comments above. I'd also like to have a demo of this PR published somewhere so that I can actually test it out, including on mobile. |
Maybe there could be a new GitHub Action that builds the website, and uploads it as an artifact? So it could be downloaded and run locally with Probably could be done in a separate PR, since it also benefits other changes made to the website. |
Here is a slightly modified deployed via gh-pages branch on my fork (for testing functionality): https://ivanistheone.github.io/sympy.github.com/en/shell.html Initial testing comments:
@jtpio Good idea about adding gh actions in general to the repo (separete from this PR). I'd like work on integration and testing of this PR and the updates in sympy-live repo/website. I'll have some time in coming weeks, and put together a google doc that combines all the links from various PRs and issues + checklist for next steps: |
@ivanistheone that all sounds good. Maybe you can start a new PR based off this one. We definitely need to fix the header thing on mobile. I've noticed that issue before. I don't remember it being a problem in the past, so maybe something broke it at some point. |
This looks amazing! |
Thanks all! Let me know if there is something else to be done here. Looks like most of the points raised above could be done in separate follow-up PRs as they are not strictly related to this change?
@asmeurer @certik I'll let you handle this one then. In other words happy to merge and iterate, so we can also get feedback from end users too! |
@asmeurer why don't we merge an iterate on that? I tested the link above in Firefox on Apple M1 max, the first time it takes about 10-20s until sympy fully loads, but the execution is immediate. For the sphinx docs, possibly we can start loading the shell immediately in the background, so by the time a user clicks some prompt to evaluate, it will be immediate. |
Changed iframe src to use jinja variables
If we merge this, it would serve as a "soft launch". The "online shell" button at the top of https://www.sympy.org/en/index.html would go to the jupyterlite shell, but live.sympy.org would still point to the GAE site. Just looking at it, I have two issues with the demo site which I think are pretty important:
The last three are really issues with the upstream jupyterlite. Presumably they can be fixed upstream without us having to modify the site here. Even so, they are pretty big UX problems in my view, so I'd like to at least make sure they are being tracked upstream. And some less important improvements:
Some of these seem quite straightforward to fix so we should just do them now. |
Actually, it looks like the header on mobile has this problem on every page on sympy.org, not just this one. |
Actually, it looks like the header on mobile has this problem on every page on sympy.org, not just this one.
Yes I saw that. This afternoon I’ll be looking into this and if I manage to fix I’ll open a PR.
|
@asmeurer Please merge sympy/sympy-web-static#13 for the mobile menu fixes and #172 for a html template restrucuring prerequisite for this PR. Previewable here: https://ivanistheone.github.io/sympy.github.com/en/index.html (this link contains code from this branch, which contains both of the above PRs. Testing notes:
@jtpio When #172 gets merged, please rebase this PR so that we'll be able to take advantage of the overwritable After this, I'll follow up with separate work (PHASE 3) on new
Exactly! It makes sense to have https://sympy.org/en/shell.html run in parallel (soft launch) to the future https://live.sympy.org/index.html for a little while so that we'll have some time to do testing (PHASE 2) and research before "launching" to https://live.sympy.org/ |
Thank you @ivanistheone and @jtpio for all your hard work! |
I'd rather just upstream the fixes to jupyterlite. I don't want to have a separate repo to maintain. The suggestions I made should make sense for jupyterlite in general, I would think. Any SymPy specific customizations ought to be done in this repo. |
Maybe you should just start a new PR with a branch based off of this one, so that you don't have to wait for @jtpio. |
@asmeurer Thx for merging the two prereq. PRs. I don't see the new main.js on the website though https://www.sympy.org/en/index.html Is there some additional step required to deploy to sympy.org? I'm guessing the For the life of me I don't understand how git submodules work (and I've tried many times!), so if someone could do what's needed (bonus points for explain what needs to be done too). |
I'm not great with submodules either, but I think the process goes like this: If you haven't already cloned the submodule you can use
To update it, just
and then
|
By the way, sympy-live is the only other repo that uses sympy-web-static, so we really should just move everything there into this repo and get rid of the submodule. |
Posting here for visibility. @ivanistheone has proposed taking over this PR, thanks! The diff is quite minimal, so feel free to adjust and modify as needed, based on your other updates to the website. Happy to help on the JupyterLite side if needed.
Yes you can easily generate your own JupyterLite static website from that template. Then use the settings system via the |
Closing in favor of #174, thanks @ivanistheone! |
This is an alternative to sympy/sympy-live#198
Fixes sympy/sympy-live#83
Closes sympy/sympy-live#198
Copying the PR description from sympy/sympy-live#198 to here for reference:
JupyterLite is a JupyterLab distribution that runs entirely in the web browser, backed by in-browser language kernels including the WebAssembly powered Pyodide kernel.
The embeddable code console is currently deployed as a static website on Vercel, and the source code is currently living in the following repository: https://github.com/jtpio/replite
It supports rich rendering of outputs just like in Jupyter Notebook and JupyterLab, for example:
TODO
iframe
: https://jupyterlite.readthedocs.io/en/latest/applications/repl.htmlThis also means the https://github.com/sympy/sympy-live repo could then be archived after this PR is merged, and the Google App Engine deployment be deleted.