Hello Yun Bao, Le lun. 11 nov. 2019 à 04:15, yun bao <dayun...@gmail.com> a écrit : > > Hi, > > I'm planning to go to grad school next fall, and I'm in the process of > refining my thesis idea.
Asking for advice is the good approach. > My basic idea is connected to Python running in a web browser. There is several ways to go. There is something like dozens of attempts and two or three actively maintained solutions. Here is one: https://www.plynth.net Here is a project of mine: https://github.com/amirouche/beyondjs > However, I'm still trying to hone in on a good research idea I do not think that any kind of Python in the browser effort is a research, as in a PhD thesis kind of work. > that will be useful and relevant to the Python community. The Python community is vast, prolific, with diverse and sometimes conflicting interests. There is no situations where it is possible to please everybody. You should take a stand, pick a particular niche where browser frontend software are useful and try to solve that problem. My favorite frontend application is back-office applications that are behind a login form and do not require server-side rendering. See also, so called, universal web applications and progressive web apps. > I've been reaching out to a few different communities to better understand > the current state of, and problems associated with, getting Python running in > a browser. I spoke to someone at Mozilla, who said he thought that pursuing > WebAssembly was the best option. I agree, but not without some kind of a Foreign Function Interface (FFI) which is still missing in Firefox. Whereas, V8 has the thing called anyref. See also https://hacks.mozilla.org/2019/08/webassembly-interface-types/. > He said it was very unlikely that browser vendors would drastically modify > their products to host a dedicated Python engine. True. > He pointed me to the Pyodide project, Working with Pyodide or emscripten is too difficult as of right now, and I would not go in production with it. > which has gotten quite a few scientific Python packages running in a web > browser What is the point of doing that?! That is what I meant by "choose a niche". Scientific computing in the web browser, if it becomes a thing, will be a big mistake, and a performance bottleneck for no good reasons. People that know what they are doing are moving more things to the backend (server side) and take advantage of computation grids. The particular project I am thinking about is still in private beta. It support not only scientific Python libraries and any other library written in any programming language posgresql et al. And you can publish the notebooks in production (for DNA and more generaly biology research). > using the WebAssembly version of CPython. The Pyodide team compiled CPython > to WebAssembly using Emscripten. This is pretty exciting, as most of the > solutions I'd previously seen involved translating or transpiling Python to > JavaScript (Transcrypt, Brython, PypyJS), and then executing that. I've > reached out to the Pyodide people, but thought I would see if anyone in the > Python community was involved in this kind of work. Brython is an interpreter. Transpiling to JavaScript works very well, when it is done correctly. So far, I have not seen a good enough Python to JavaScript compiler. Like I wrote previously emscripten is a way of a hundred pains, at the moment, it might change. But who wants more C, C++ (including a compiler) in their Python project? > Any thoughts or advice that you could share would be most welcome. I think something in the spirit of Schism (https://github.com/google/schism), a self-hosted compiler, is an interesting idea. It is missing an interpreter and source maps. Evenif it use anyref, it does not allow to pause / resume wasm for xhr or dom events. Mind the fact that, it is possible to fully compile Python "directly" to wasm with possibly an embedded interpreter for use with `eval` with support for asynchronous behaviors xhr, dom events and a JavaScript foreign function interface (js ffi), it will only work where V8 JavaScript VM is used, but maybe it will convince Mozilla that anyref is good enough. Also see https://github.com/beeware/ouroboros Hope this helps! -- Amirouche ~ https://hyper.dev _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: https://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com