Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #15737 > unrolled thread

(don't bash me too hard) Python interpreter in JavaScript

Started byPassiday <passiday@gmail.com>
First post2011-11-15 12:37 -0800
Last post2011-11-22 07:46 -0800
Articles 14 — 11 participants

Back to article view | Back to comp.lang.python


Contents

  (don't bash me too hard) Python interpreter in JavaScript Passiday <passiday@gmail.com> - 2011-11-15 12:37 -0800
    Re: (don't bash me too hard) Python interpreter in JavaScript Chris Angelico <rosuav@gmail.com> - 2011-11-16 07:45 +1100
    Re: (don't bash me too hard) Python interpreter in JavaScript Ian Kelly <ian.g.kelly@gmail.com> - 2011-11-15 13:52 -0700
    Re: (don't bash me too hard) Python interpreter in JavaScript Stef Mientki <stef.mientki@gmail.com> - 2011-11-15 22:08 +0100
    Re: (don't bash me too hard) Python interpreter in JavaScript Terry Reedy <tjreedy@udel.edu> - 2011-11-15 17:15 -0500
    Re: (don't bash me too hard) Python interpreter in JavaScript Alan Meyer <ameyer2@yahoo.com> - 2011-11-15 18:05 -0500
      Re: (don't bash me too hard) Python interpreter in JavaScript Passiday <passiday@gmail.com> - 2011-11-15 23:07 -0800
    Re: (don't bash me too hard) Python interpreter in JavaScript Carl Banks <pavlovevidence@gmail.com> - 2011-11-15 18:51 -0800
      Re: (don't bash me too hard) Python interpreter in JavaScript Passiday <passiday@gmail.com> - 2011-11-15 23:05 -0800
      Re: (don't bash me too hard) Python interpreter in JavaScript Lorenzo <loluengo@gmail.com> - 2011-11-20 18:16 -0800
      Re: (don't bash me too hard) Python interpreter in JavaScript "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-11-21 07:41 +0000
        Re: (don't bash me too hard) Python interpreter in JavaScript Alec Taylor <alec.taylor6@gmail.com> - 2011-11-21 20:07 +1100
        Re: (don't bash me too hard) Python interpreter in JavaScript Lorenzo <loluengo@gmail.com> - 2011-11-22 06:15 -0800
    Re: (don't bash me too hard) Python interpreter in JavaScript becky_lewis <bex.lewis@gmail.com> - 2011-11-22 07:46 -0800

#15737 — (don't bash me too hard) Python interpreter in JavaScript

FromPassiday <passiday@gmail.com>
Date2011-11-15 12:37 -0800
Subject(don't bash me too hard) Python interpreter in JavaScript
Message-ID<11816254.67.1321389423944.JavaMail.geo-discussion-forums@vbay19>
Hello,

I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, of course, would be done in JavaScript. I'd like to avoid any client-server transactions, so all the interpretation should take place on the client side. The purpose of all this would be to create educational platform for learning the programming in python.

I hoped somebody already had done something like this, but I couldn't google up anything. I've found some crazy project emulating PC in JavaScript (and even running Linux on top of it), but not a python interpreter.

Of course, I could take the python source and brutally recode it in JavaScript, but that seems like awful lot of work to do. Any ideas how I should proceed with this project?

[toc] | [next] | [standalone]


#15738

FromChris Angelico <rosuav@gmail.com>
Date2011-11-16 07:45 +1100
Message-ID<mailman.2747.1321389956.27778.python-list@python.org>
In reply to#15737
On Wed, Nov 16, 2011 at 7:37 AM, Passiday <passiday@gmail.com> wrote:
> The app would have basic IDE for writing and debugging the python code, but the interpretation, of course, would be done in JavaScript. I'd like to avoid any client-server transactions, so all the interpretation should take place on the client side. The purpose of all this would be to create educational platform for learning the programming in python.

Hmm. If it's to be an educational platform, I would recommend doing
something like the W3Schools "tryit" page [1] and just go back to the
server each time. You have potential security issues to watch out for
(so it may be worth chrooting your interpreter), but it's sure to be
easier than rewriting the entire interpreter in another language. You
would have to maintain your implementation as the language evolves,
keep it bug-free, etc, etc.

ChrisA

[1] eg http://www.w3schools.com/html/tryit.asp?filename=tryhtml_basic

[toc] | [prev] | [next] | [standalone]


#15739

FromIan Kelly <ian.g.kelly@gmail.com>
Date2011-11-15 13:52 -0700
Message-ID<mailman.2748.1321390401.27778.python-list@python.org>
In reply to#15737
On Tue, Nov 15, 2011 at 1:37 PM, Passiday <passiday@gmail.com> wrote:
> Hello,
>
> I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, of course, would be done in JavaScript. I'd like to avoid any client-server transactions, so all the interpretation should take place on the client side. The purpose of all this would be to create educational platform for learning the programming in python.
>
> I hoped somebody already had done something like this, but I couldn't google up anything. I've found some crazy project emulating PC in JavaScript (and even running Linux on top of it), but not a python interpreter.

You could take a look at pyjamas, but it's precompiled.  I don't know
whether they have support for runtime compilation at all.

[toc] | [prev] | [next] | [standalone]


#15740

FromStef Mientki <stef.mientki@gmail.com>
Date2011-11-15 22:08 +0100
Message-ID<mailman.2749.1321391302.27778.python-list@python.org>
In reply to#15737
On 15-11-2011 21:37, Passiday wrote:
> Hello,
>
> I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, of course, would be done in JavaScript. I'd like to avoid any client-server transactions, so all the interpretation should take place on the client side. The purpose of all this would be to create educational platform for learning the programming in python.
>
> I hoped somebody already had done something like this, but I couldn't google up anything. I've found some crazy project emulating PC in JavaScript (and even running Linux on top of it), but not a python interpreter.
>
> Of course, I could take the python source and brutally recode it in JavaScript, but that seems like awful lot of work to do. Any ideas how I should proceed with this project?
skulpt ?

cheers,
Stef

[toc] | [prev] | [next] | [standalone]


#15745

FromTerry Reedy <tjreedy@udel.edu>
Date2011-11-15 17:15 -0500
Message-ID<mailman.2754.1321395335.27778.python-list@python.org>
In reply to#15737
On 11/15/2011 3:52 PM, Ian Kelly wrote:
> On Tue, Nov 15, 2011 at 1:37 PM, Passiday<passiday@gmail.com>  wrote:
>> Hello,
>>
>> I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, of course, would be done in JavaScript. I'd like to avoid any client-server transactions, so all the interpretation should take place on the client side. The purpose of all this would be to create educational platform for learning the programming in python.
>>
>> I hoped somebody already had done something like this, but I couldn't google up anything. I've found some crazy project emulating PC in JavaScript (and even running Linux on top of it), but not a python interpreter.
>
> You could take a look at pyjamas, but it's precompiled.  I don't know
> whether they have support for runtime compilation at all.

Perhaps one could use pyjamas to compile pypy to javascript ;-).

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#15752

FromAlan Meyer <ameyer2@yahoo.com>
Date2011-11-15 18:05 -0500
Message-ID<4EC2F04D.5030801@yahoo.com>
In reply to#15737
On 11/15/2011 3:37 PM, Passiday wrote:
> Hello,
>
> I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, of course, would be done in JavaScript. I'd like to avoid any client-server transactions, so all the interpretation should take place on the client side. The purpose of all this would be to create educational platform for learning the programming in python.
>
> I hoped somebody already had done something like this, but I couldn't google up anything. I've found some crazy project emulating PC in JavaScript (and even running Linux on top of it), but not a python interpreter.
>
> Of course, I could take the python source and brutally recode it in JavaScript, but that seems like awful lot of work to do. Any ideas how I should proceed with this project?

I don't have any good ideas for how to do this, but I do have a warning. 
  The JavaScript security model prohibits a lot of things that Python 
does not prohibit.  So if you need to do anything like access a file on 
the user's machine or talk to some computer other than the one you came 
from, it won't work.

    Alan

[toc] | [prev] | [next] | [standalone]


#15764

FromPassiday <passiday@gmail.com>
Date2011-11-15 23:07 -0800
Message-ID<11268744.795.1321427235257.JavaMail.geo-discussion-forums@yqff21>
In reply to#15752
Of course, I am aware of this. But the file system can be emulated, and certain networking can be mediated via the server, too. But for starts, I don't plan to go beyond the basic file operations, if at all.

[toc] | [prev] | [next] | [standalone]


#15755

FromCarl Banks <pavlovevidence@gmail.com>
Date2011-11-15 18:51 -0800
Message-ID<27174986.458.1321411879812.JavaMail.geo-discussion-forums@yqoo7>
In reply to#15737
On Tuesday, November 15, 2011 12:37:03 PM UTC-8, Passiday wrote:
> Hello,
> 
> I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, of course, would be done in JavaScript. I'd like to avoid any client-server transactions, so all the interpretation should take place on the client side. The purpose of all this would be to create educational platform for learning the programming in python.
> 
> I hoped somebody already had done something like this, but I couldn't google up anything. I've found some crazy project emulating PC in JavaScript (and even running Linux on top of it), but not a python interpreter.
> 
> Of course, I could take the python source and brutally recode it in JavaScript, but that seems like awful lot of work to do. Any ideas how I should proceed with this project?


Some people have already made an LLVM-to-Javascript compiler, and have managed to build Python 2.7 with it.

The LLVM-to-Javascript project is called emscripten.

https://github.com/kripken/emscripten/wiki

Demo of Python (and a bunch of other languages) here:

http://repl.it/


Carl Banks

[toc] | [prev] | [next] | [standalone]


#15763

FromPassiday <passiday@gmail.com>
Date2011-11-15 23:05 -0800
Message-ID<27707069.794.1321427121532.JavaMail.geo-discussion-forums@yqff21>
In reply to#15755
Thanks Carl, this looks like a good base to start from.

[toc] | [prev] | [next] | [standalone]


#15976

FromLorenzo <loluengo@gmail.com>
Date2011-11-20 18:16 -0800
Message-ID<90f6dc69-1b8a-49d7-aa00-662c6baefda5@n14g2000vbn.googlegroups.com>
In reply to#15755
On Nov 15, 11:51 pm, Carl Banks <pavlovevide...@gmail.com> wrote:
> Some people have already made an LLVM-to-Javascript compiler, and have managed to build Python 2.7 with it.
>
> The LLVM-to-Javascript project is called emscripten.
>
> https://github.com/kripken/emscripten/wiki
>
> Demo of Python (and a bunch of other languages) here:
>
> http://repl.it/
>
> Carl Banks

It definitely looks great!!

[toc] | [prev] | [next] | [standalone]


#15990

From"OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net>
Date2011-11-21 07:41 +0000
Message-ID<Xns9FA3F0EC5DCBBOKB@88.198.244.100>
In reply to#15755
Carl Banks wrote:

> Some people have already made an LLVM-to-Javascript compiler, and
> have managed to build Python 2.7 with it. 
> 
> The LLVM-to-Javascript project is called emscripten.
> 
> https://github.com/kripken/emscripten/wiki
> 
> Demo of Python (and a bunch of other languages) here:
> 
> http://repl.it/

    	Very interesting.  Is there a simple way to add third-party 
libraries to these?  I assume that for pure-Python modules you could 
just put a python file in the appropriate place and import it, but what 
about if you wanted a web app that used numpy or something?  Is that 
feasible?

-- 
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail."
	--author unknown

[toc] | [prev] | [next] | [standalone]


#15992

FromAlec Taylor <alec.taylor6@gmail.com>
Date2011-11-21 20:07 +1100
Message-ID<mailman.2891.1321866477.27778.python-list@python.org>
In reply to#15990
Just compile your python to C

:]

On Mon, Nov 21, 2011 at 6:41 PM, OKB (not okblacke)
<brenNOSPAMbarn@nobrenspambarn.net> wrote:
> Carl Banks wrote:
>
>> Some people have already made an LLVM-to-Javascript compiler, and
>> have managed to build Python 2.7 with it.
>>
>> The LLVM-to-Javascript project is called emscripten.
>>
>> https://github.com/kripken/emscripten/wiki
>>
>> Demo of Python (and a bunch of other languages) here:
>>
>> http://repl.it/
>
>        Very interesting.  Is there a simple way to add third-party
> libraries to these?  I assume that for pure-Python modules you could
> just put a python file in the appropriate place and import it, but what
> about if you wanted a web app that used numpy or something?  Is that
> feasible?
>
> --
> --OKB (not okblacke)
> Brendan Barnwell
> "Do not follow where the path may lead.  Go, instead, where there is
> no path, and leave a trail."
>        --author unknown
> --
> http://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [next] | [standalone]


#16072

FromLorenzo <loluengo@gmail.com>
Date2011-11-22 06:15 -0800
Message-ID<70a4b790-b51b-4eb9-b487-07771895056c@w7g2000yqc.googlegroups.com>
In reply to#15990
>         Very interesting.  Is there a simple way to add third-party
> libraries to these?  I assume that for pure-Python modules you could
> just put a python file in the appropriate place and import it, but what
> about if you wanted a web app that used numpy or something?  Is that
> feasible?
>

I cannot imagine how slow can be a python interpreter in javascript
crunching numbers using numpy, and converting those numeric libraries
(ATLAS, LAPACK,MKL,ACML) to javascript.

[toc] | [prev] | [next] | [standalone]


#16075

Frombecky_lewis <bex.lewis@gmail.com>
Date2011-11-22 07:46 -0800
Message-ID<39d7d689-6953-4ae5-84f5-83d44eb9fd39@w7g2000yqc.googlegroups.com>
In reply to#15737
On Nov 15, 8:37 pm, Passiday <passi...@gmail.com> wrote:
> Hello,
>
> I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, of course, would be done in JavaScript. I'd like to avoid any client-server transactions, so all the interpretation should take place on the client side. The purpose of all this would be to create educational platform for learning the programming in python.
>
> I hoped somebody already had done something like this, but I couldn't google up anything. I've found some crazy project emulating PC in JavaScript (and even running Linux on top of it), but not a python interpreter.
>
> Of course, I could take the python source and brutally recode it in JavaScript, but that seems like awful lot of work to do. Any ideas how I should proceed with this project?

I think you may find it a little time consuming to reimpliment python
in javascript. I'm inclined to say "go for it" though since you may
create something awesome in the process ;)

If you want to take an easier route, may I point out
pythonanywhere.com? It doesn't run in the browser but does give safe
access to multiple python interpreters and from my own use I can say
that it works pretty well. You can even set up web apps using it. For
educational purposes it might be helpful to you.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web