Skip to content
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

Is it possible make chrome extension / firefox add-on for pypyjs #212

Open
devxpy opened this issue Dec 25, 2017 · 14 comments
Open

Is it possible make chrome extension / firefox add-on for pypyjs #212

devxpy opened this issue Dec 25, 2017 · 14 comments

Comments

@devxpy
Copy link

devxpy commented Dec 25, 2017

Just discovered pypyjs.

I was wondering if its possible to make an extension that loads pypyjs with the browser, essentially enabling mainstream python in the web browser

@notzoom
Copy link

notzoom commented Jan 27, 2018

I have exactly the same question, please let us know !

@mardon86
Copy link

mardon86 commented Jan 28, 2018 via email

@notzoom
Copy link

notzoom commented Feb 1, 2018

Hello ?

@devxpy
Copy link
Author

devxpy commented Feb 1, 2018

@notzoom yes?

@crantila
Copy link
Contributor

crantila commented Feb 5, 2018

You can see for yourself that PyPy.js has basically lost steam, yet nobody wants to give up on it.

I can't see a reason why a browser extension wouldn't work, but (1) I'm not really one to know, and (2) I'm not sure it would enable [mainstream python in the web browser." Do any of you have something in mind? Perhaps even a concrete suggestion for how it would work?

@devxpy
Copy link
Author

devxpy commented Feb 7, 2018

I said that because it would eliminate the need for the painful loading time.

As a developer, I can ask users to install a simple extension easily rather than saying "Wait for 5 mins for this thing to load"
A lot of companies do prompt you to use extensions.

I just feel it would be a step further. Its not as good as having native support but certainly better than having to wait after each reload of any pypyjs based page.

@crantila
Copy link
Contributor

Using a browser extension may indeed be a step further, but I think there's an easier way to solve the loading delay. You can use a ServiceWorker to cache the PyPy.js runtime; take a look here for some examples.

@rfk
Copy link
Contributor

rfk commented Feb 24, 2018

You can see for yourself that PyPy.js has basically lost steam, yet nobody wants to give up on it.

Yep :-(

Please weigh in on #213 (comment) if you have thoughts on the right way to handle the fact that development is basically stopped.

@devxpy
Copy link
Author

devxpy commented Feb 25, 2018

@rfk, I am currently (and was) working on something else. I do plan to work on this once i get some time.

I am actually working on a project that requires me to write js. Working with js has made me realise the fact that we need python on web. There is something called dash but its not python on the web browser.

@devxpy
Copy link
Author

devxpy commented Feb 25, 2018

Remind me, does it have a full DOM implementation right now?

@crantila
Copy link
Contributor

I think PyPy.js is able to do dynamic mapping to the DOM?

My question in this area is: does it really have to be Python? The greater web development community has answered "no." Indeed, I too have almost no use for Python in the browser. Modern web development offers many alternatives, including CoffeeScript, TypeScript, ES2015 with Flow, and Elm. Even Rust and C/C++ can be transpiled to standard ES5 JavaScript. In other words, if you have to pre-process your code anyway (at a minimum for minification) then why not add a full compilation step and use any other language that you want?

I believe that, while Python is a much friendlier language than ES5 JavaScript, there are still two big reasons that Python in the browser is unlikely to see wide-spread adoption. First, that people are adopting newer JavaScript (such as ES2015) and JavaScript-like languages (such as TypeScript) that largely reduce the pain points of ES5. Secondly, the advantages of Python over the JavaScript that people are writing are small enough that it doesn't make sense to pursue something like PyPy.js. Of course, these points are based on my experiences and the web developers I know.

So there's only one use case where I see PyPy.js as the best solution: your web app allows users to write and execute their own Python code. Aside from that, even though I love Python, I find that the current state of front-end frameworks is good enough!

@rfk
Copy link
Contributor

rfk commented Feb 26, 2018

Remind me, does it have a full DOM implementation right now?

There's rudimentary access to the host JS environment through import js, which in turn lets you access window.document and the APIs exposed thereon. It's very slow, and there's a bit of jank in the interactions between the host garbage collector and the one in PyPy.js, but it seems to work OK.

@devxpy
Copy link
Author

devxpy commented Mar 14, 2018

@crantila, this looks like a very good solution.

A bit far down the road, but the ideal solution.

@jedie
Copy link
Contributor

jedie commented Mar 14, 2018

@crantila, this looks like a very good solution.

A little more context would be great ;) IMHO a very interesting Talk:

"Beyond Web 2.0: Django and Python in the Modern Web Ecosystem"
https://www.youtube.com/watch?v=M9puQrivfPg

This talk was given at Linux.conf.au 2018 (LCA2018) which was held on 22-26 January 2018 in Sydney Australia.
SPEAKER: Russell Keith-Magee

It's about: https://pybee.org/

See also:
https://github.com/pybee
https://github.com/pybee/batavia - A JavaScript implementation of the Python virtual machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants