Why PyPy.js Didn't Work

PyPy.js is a version of the PyPy Python runtime environment that is transpiled into JavaScript so it runs in web browsers. This allows developers to write frontend code in Python instead of JavaScript. The project started several years ago, and has now lost enough momentum that the primary developer has publicly asked whether the project should be officially retired. On this occasion, I wrote a few paragraphs explaining why I believe PyPy.js did not see widespread adoption.


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!