[Discussion] GSOC 2020: Python3 support for sympy-live

227 views
Skip to first unread message

Prashant Rawat

unread,
Feb 23, 2020, 3:48:33 AM2/23/20
to sympy
I am Prashant from IIIT, Gwalior. I am a 3rd-year B.Tech student.
I am working on the issue for python3 support for sympy-live. As python2 is not supported anymore and to use python3 on google AppEngine, we need to use a web framework, and I think Django will be better than Flask. I have deployed many web apps and have good experience in the same. I think using GoogleCompute Engine instead of AppEngine is better as it is more flexible and economic. I have been working on this for 10 days. For now, I have successfully run sympy-live on my localhost with python3. I have used function-based views in Django and used inbuilt Django sessions for storing statements. It could be extended to sympy-gamma also. These changes may contain many bugs and work is still in progress. I think this is a good GSOC project and want to work for it.
I have hosted it on Google compute engine for now.
link: http://160.50.70.34.bc.googleusercontent.com/
It will ask for a login.
ID: test
Password: test9876

Sudhanshu Mishra

unread,
Feb 23, 2020, 6:34:08 AM2/23/20
to sy...@googlegroups.com
Hi Prashant,

Why do you think Django is better for Sympy live. From what I understand, Django is designed for big websites where as Flask works well with light apps.

Also, I was under the assumption that App Engine is a free service from Google. A quick Google search says it's not. I'll check it out.

 I'd suggest you to create an outline of the things that are absolutely necessary or adds value to the project in order to asses whether it qualifies for a GSoC project.

Thanks!

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/sympy/3f333113-3462-4c42-973e-c51b81bec94e%40googlegroups.com.

Prashant Rawat

unread,
Feb 23, 2020, 1:59:25 PM2/23/20
to sympy
Hi Sudhanshu,

Django is a full-stack web framework while Flask is a lightweight, minimalist web framework. The hack used for faking continuous Python session makes use of sessions to store the previous commands. In Django, sessions can be managed in a better way, previous commands can be stored in a better way. Django has a better admin interface that can be used to simplify website content administration. And most important, keeping scalability in mind Django is the best choice. Flask is a better choice for simple sites with static content like blogs, but for dynamic content like sympy-live Django is a better alternative.

I have made changes to resolve issue #121 and have read SymPy Live not working properly. Using Compute Engine make it easier to run sympy-live locally on the systems and thus easier to test and debug.

Some of the ideas I would like to work on:
1. The sympy-live and sympy-gamma consoles are very basic and with limited options. I suggest making them interactive like Jupyter Notebooks.
2. Solving parsing problems for sympy-gamma so it can support non-python syntax.
3. Improve pickling support and/or use other methods to store data to fake Python Session.
4. Continuous Python session without any time limit for queries taking a long time.
5. Making sympy-live more generic, so that other projects can use it in their documentation.

Thanks!
To unsubscribe from this group and stop receiving emails from it, send an email to sy...@googlegroups.com.

Aaron Meurer

unread,
Feb 24, 2020, 6:17:03 PM2/24/20
to sympy
On Sun, Feb 23, 2020 at 11:59 AM Prashant Rawat
<prashant...@gmail.com> wrote:
>
> Hi Sudhanshu,
>
> Django is a full-stack web framework while Flask is a lightweight, minimalist web framework. The hack used for faking continuous Python session makes use of sessions to store the previous commands. In Django, sessions can be managed in a better way, previous commands can be stored in a better way. Django has a better admin interface that can be used to simplify website content administration. And most important, keeping scalability in mind Django is the best choice. Flask is a better choice for simple sites with static content like blogs, but for dynamic content like sympy-live Django is a better alternative.
>
> I have made changes to resolve issue #121 and have read SymPy Live not working properly. Using Compute Engine make it easier to run sympy-live locally on the systems and thus easier to test and debug.
>
> Some of the ideas I would like to work on:
> 1. The sympy-live and sympy-gamma consoles are very basic and with limited options. I suggest making them interactive like Jupyter Notebooks.

Making Live work with Python 3 is great. That will allow it to
continue working with future releases of SymPy. But if we want to
improve it in this direction, I think we should instead look into if
we can reuse something like Binder, which is already being developed
by people who are experts on this sort of thing. The main issue is
that very few of us in the SymPy community are web developers, so
anything that gets built along those lines like SymPy Live and SymPy
Gamma tends to stagnate.

Aaron Meurer
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/7d17b8de-60a2-4009-875c-93b36e105974%40googlegroups.com.

Jason Moore

unread,
Feb 24, 2020, 7:40:53 PM2/24/20
to sympy
It could be fairly easy to use thebelab for the sympy examples in the docs, e.g.: https://github.com/minrk/thebelab

Jason

Jason Moore

unread,
Feb 24, 2020, 7:41:41 PM2/24/20
to sympy
Actually, this has thebelab built in: https://github.com/jupyter/jupyter-sphinx

sympy-live in the docs was way ahead of its time! Just now people are trying to do the same thing with binder.

Jason

Aaron Meurer

unread,
Feb 25, 2020, 1:30:57 AM2/25/20
to sympy
Interesting. I didn't know that existed. We should definitely look
into using it. I've been trying to nudge the right people to build a
more generic SymPy Live like thing for years. I think whatever we use,
we should try to aim for something that is not SymPy specific. That
way, it will naturally get support from the larger community.

The downside to binder is that it can be slow. The example at
https://thebelab.readthedocs.io/en/latest/ takes about 10 seconds to
launch a kernel.I don't know if there's anything we can do about that,
but maybe we can mitigate it somehow.

SymPy Live has two components, the extension in the docs, and the
interactive interpreter at live.sympy.org. Both are used quite
heavily, from what I can tell, so any kind of rewrite solution needs
to consider both. There's also SymPy Gamma, but updating it is less
important (actually, the SymPy running on SymPy Gamma is already quite
old).

Aaron Meurer
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAP7f1Agd2Xx%3Dw02PbvQU_zPApSz2PB4YqhfdzG8WmC_oUjC%2BGg%40mail.gmail.com.

Jason Moore

unread,
Feb 25, 2020, 11:36:12 AM2/25/20
to sympy
Yes, thebelab is slow due to having to launch a docker container via binder.

Jason

Prashant Rawat

unread,
Feb 25, 2020, 4:31:23 PM2/25/20
to sympy
I was also thinking of integrating Jupyter Notebook. I read the documentation of the Blinder. It will make our work easier. But I think instead of using the third-party app, we can run  Jupyter Notebooks on the server and for each user, we can use a different notebook. This will be faster as it cuts the use of Blinder. Using Jupyter will solve session issues as files are saved at regular intervals. Continuous Python Session could easily be made for a long time. Also, there will be no need for pickling, so no pickling errors. Jupyter Notebooks/Blinder can also be implemented for Sympy Gamma. I acknowledge your concern. I am looking forward to contributing to this project and bond with the sympy community.

Thanks

Prashant Rawat

unread,
Feb 25, 2020, 4:46:33 PM2/25/20
to sympy
Can you please elaborate on not SymPy specific. 

I think we should consider both Blinder and Jupyter Notebook. I tried to host the Jupyter notebook on the server. Once hosted and started new files can be created in very less time. This might solve the problem. Meanwhile, I am searching for other ways also.

I think for Extensions in docs Jupyter Sphinx will be fine. Very much interested to work on it.

Thanks
>>> > To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/7d17b8de-60a2-4009-875c-93b36e105974%40googlegroups.com.
>>>
>>> --
>>> 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 sy...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6JwSjAubVOnnCHrT1j63OePUku%3DX6q9QDNvwNwczyzKcQ%40mail.gmail.com.
>
> --
> 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 sy...@googlegroups.com.

Aaron Meurer

unread,
Feb 25, 2020, 6:32:32 PM2/25/20
to sympy
On Tue, Feb 25, 2020 at 2:46 PM Prashant Rawat
<prashant...@gmail.com> wrote:
>
> Can you please elaborate on not SymPy specific.

I mean something that is maintained not just by the SymPy community.
Something that can be reused by other projects in the ecosystem, like
numpy, scipy, and so on. They would have to show interest of course.
But right now, SymPy Live is very tied to SymPy. It would not be easy
for another project to reuse it.

Aaron Meurer
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/79a2c9b1-c4ab-4ae0-a45f-9fbfff131397%40googlegroups.com.

Prashant Rawat

unread,
Feb 26, 2020, 6:51:49 PM2/26/20
to sympy
We can start by providing an Interactive Notebook where we will have SymPy, NumPy, SciPy pre imported or are available as an option.
I have hosted jupyter notebooks. I think it is interactive and can be used with other python libraries also. Please have a look.
pass: prashant

Also for testing purpose I have hosted the SymPy Live for on AppEngine .
ID: test
pass: test9876
Message has been deleted
Message has been deleted

Prashant Rawat

unread,
Mar 18, 2020, 8:14:35 AM3/18/20
to sympy

I have made the changes for SymPy Live. Both the interactive interpreter at sympy-live-pr.appspot.com and extension in the docs at https://prshnt19.github.io/sympy-live-docs are working fine with the Updated Python3.
PR Link: https://github.com/sympy/sympy-live/pull/144

For making SymPy more generic, I have added imports from other libraries also like NumPy and SciPy.
import numpy
import scipy
are supported now. And other libraries can be added too. I order to make it more generic we can provide API points for the SymPy Live, Spinx Banner. In this way it can be embedded to other libraries docs also.I will give detailed description for API.

I am working on SymPy Gamma now, I think it could also be improved by updating its SymPy version. Currentl SymPy gamma is running n very Old version of Django. I can also update it to the latest version.

The SymPy Live and SymPy Gamma have not been maintained for a long time. Both of them can be improve signifcantly. For example, The SymPy Live uses a workaround for faking Live Python Shell. This gets slower with number of queries. Also there are other issues which remain open. I would like to work on those issues.

I think this would make a great GSOC Project. I want to make a proposal and contribute to solve these issues during this summer. Please guide me through this.

Aaron Meurer

unread,
Mar 26, 2020, 1:30:09 PM3/26/20
to sympy, Anthony Scopatz
I would suggest that anyone looking at SymPy Live for GSoC to take a
look at RunThis https://regro.github.io/runthis-docs/

It is a new tool being developed by my colleague Anthony Scopatz to do
SymPy Live-like things (running a session in the browser), but in a
more general way. It would be great if we could develop RunThis so
that it is usable by SymPy Live, but also usable by other projects as
well and maintained by the broader community.

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 view this discussion on the web visit https://groups.google.com/d/msgid/sympy/b848bb46-3cb6-4612-acba-c1213f5b0a83%40googlegroups.com.

Prashant Rawat

unread,
Mar 31, 2020, 1:00:49 PM3/31/20
to sympy
I had a look on RunThis, but I see there are issues with it. It gives "connection closed" error. I think working on it will help me to learn more about the problem. I have made some changes in my proposal accordingly.
Thanks and Regards
> To unsubscribe from this group and stop receiving emails from it, send an email to sy...@googlegroups.com.

Amit Kumar

unread,
Apr 11, 2020, 8:37:17 AM4/11/20
to sympy
Hi Prashant,

Thanks for your work, I recently got to know about this. I have no strong opinions on Django, I am happy either ways.
Regarding the debate for App engine vs Compute Engine, I am not convinced on using Compute Engine, the whole
point of using App Engine is that we just have to worry about code and every thing else is taken care of and if you
need more flexibility later on you can use Flexible environment of App engine. When you say economic, you need to
consider the maintenance cost as well.

To summarise:

App Engine
- No servers to manage, scale up fast, scale down to zero
- No patches/updates
- Versioning

Worry about
- Code
- HTTP Request

Compute Engine
- Code, OS, Disk Images
- CPU, RAM, Disk
- Networking, Firewall rules, Load balancer

Secondly, even if we still need to use Compute Engine instead of App Engine
then, we need to have a list of problems we have that we're trying to fix with Compute
Engine.

This is what I would propose, we should do:
- Update dependencies, without changing the infrastructure
- Feel free to use Django or Flask whatever solves the problem
- Deploy 

And then see if we have any problems with App Engine and how any other infrastructure fixes it
and list out pros and cons and evaluate if that's a sustainable solution and then change if required.

Otherwise, we might be solving a problem, we don't have yet and also, we maybe solving too
many problems at once.

-
Amit

Prashant Rawat

unread,
Apr 16, 2020, 3:49:11 PM4/16/20
to sympy
Hi Amit,

Thank you for your suggestions. I have already deployed my code on AppEngine itself. I admit I didn't consider the maintenance costs. We can go with the AppEngine for now and can switch to ComputeEngine if the need arises.
Reply all
Reply to author
Forward
0 new messages