Brainstorming on new architecture for sympy-live

52 views
Skip to first unread message

Ivan Savov

unread,
Jul 21, 2017, 10:30:13 AM7/21/17
to sympy
Hi All,

A couple of months ago I volunteered to help out as maintainer for sympy-live, but I haven't had any progress since then except to fix minor bugs.

Currently the sympy-live application (and code examples in docs) are backed by google app engine (GAE) application that runs an outdated version of sympy (1.0). I believe sympy 1.1 requires a newer version of numpy than what is available out-of-the-box on GAE. The simplest upgrade path would require somehow installing a custom version of numpy (in lib/), but there was expressed interest in updating the sympy-live architecture to something more flexible like docker containers.

I created a doc to discuss possible new architectures for the sympy-live. Please provide feedback and ideas:
https://docs.google.com/document/d/1vn0SZTdDQl0DOLzu3ITzv2edODBUEGXa7X7laqu8mpA/edit?usp=sharing

I'm available to push on this project in my spare time and looking forward to trying to prototype the approach that is chosen by the community.


Ivan

Aaron Meurer

unread,
Jul 21, 2017, 2:45:58 PM7/21/17
to sy...@googlegroups.com
I added some comments to the doc. 

Aaron Meurer

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/2ef4bfee-bbd2-469e-812b-1c8182efe9a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ivan Savov

unread,
Jul 22, 2017, 7:09:24 PM7/22/17
to sympy
After some further investigation (thx Jason!), it seems `numpy` is not the problem, and current GAE setup works totally fine. The culprit is the session "unpickling" code which is not super robust, so I think my time would be better spent on improving the current setup. I'm going to leave the doc open for editing, in case we want to come back to the deployment setup.

I have a WIP open PR with a fix for Issue#110, but it seems even with the fixes in the PR,
but to really resolve the issue might need a fix in sympy as well
(https://github.com/sympy/sympy/issues/13027).

Ivan Savov

unread,
Sep 24, 2017, 1:21:23 AM9/24/17
to sympy
Hi All,


I did a little experimentation with PyPy.js and it seems to be able to run SymPy in the browser totally fine,
see https://minireference.com/static/tmp/pypyjs_sympy_demo/  (wait 10 seconds for `from sympy import *` to run async
source https://github.com/minireference/sympy-pypyjs

This means switching sympy live shell to js-based is definitely possible, maybe with a fallback to server-side python interperer for older/slower browsers.

I'm not sure when I'll have time to push on this in the coming months, but the above initial test seems very promising!


Ivan

Aaron Meurer

unread,
Sep 24, 2017, 7:32:32 PM9/24/17
to sy...@googlegroups.com
Hi.

For some reason my adblocker blocked the script. You might look into
why it does that.

After disabling it I got it to work.

I guess some modules are excluded from the import? I tried to run the
tests, but the test() function wasn't imported, and when I tried to
import it, I got a failure because it couldn't import the signal
module.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/6fc1b8c8-c833-458a-916d-6a078b1328bd%40googlegroups.com.

Ivan Savov

unread,
Sep 24, 2017, 11:34:26 PM9/24/17
to sympy

For some reason my adblocker blocked the script. You might look into
why it does that.


Were you using AdBlock plus?

 
I guess some modules are excluded from the import? I tried to run the
tests, but the test() function wasn't imported, and when I tried to
import it, I got a failure because it couldn't import the signal
module.

Right. I removed the tests import because I it was failing to import (because of signal).
The only other thing I had to modify in sympy is
from threading import RLock

because threading seems to be a CPython-only thing

I will try to run some tests manually next time I work on this.
I'm particularly interested in numeric-heavy stuff, how slow pypyjs is compared to CPython.


Ivan

Aaron Meurer

unread,
Sep 25, 2017, 1:43:25 AM9/25/17
to sy...@googlegroups.com
On Sun, Sep 24, 2017 at 11:34 PM, Ivan Savov <ivan....@gmail.com> wrote:

For some reason my adblocker blocked the script. You might look into
why it does that.


Were you using AdBlock plus?

I'm using uBlock Origin. 


 
I guess some modules are excluded from the import? I tried to run the
tests, but the test() function wasn't imported, and when I tried to
import it, I got a failure because it couldn't import the signal
module.

Right. I removed the tests import because I it was failing to import (because of signal).

Let's refactor the test runner so that it works without signal. It's only needed for the timeout behavior.
 
The only other thing I had to modify in sympy is
from threading import RLock

because threading seems to be a CPython-only thing

It looks like this is used by the Python 2 compatibility lru_cache. PyPy is Python 2, but I don't think pypy.js needs to worry about threading. Let's refactor it so that it uses a no-op when threading isn't there. 

It's also used by the pyglet plotting library, which obviously isn't going to be used here.

Aaron Meurer


I will try to run some tests manually next time I work on this.
I'm particularly interested in numeric-heavy stuff, how slow pypyjs is compared to CPython.


Ivan

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe@googlegroups.com.

To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
Reply all
Reply to author
Forward
0 new messages