Will JavaScript type annotations kill TypeScript?
The creators of Svelte and Turbo 8 both dropped TS recently saying that "it's not worth it".
Yes: If JavaScript gets type annotations then there's no reason for TypeScript to exist.
No: TypeScript remains the best language for structuring large enterprise applications.
TBD: The existing user base and its corpensource owner means that TypeScript isn’t likely to reach EOL without a putting up a fight.
I hope they both die. I mean, if you really need strong types in the browser then you could leverage WASM and use a real programming language.
I don’t know and I don’t care.

WebAssembly: When You Hate Rust but Love Python

Python is one of the most popular programming languages in the world, and its WebAssembly implementation seems to be coming along quickly.
Feb 9th, 2023 6:00am by
Featued image for: WebAssembly: When You Hate Rust but Love Python

One of the main attributes of WebAssembly is how it can accommodate a number of different languages that are deployed — in theory at least — wherever there is a CPU device that can run instruction sets. The languages Wasm can run include, in addition to JavaScript, Rust, Go, .NET, C++, Java, PHP — and Python (a lot more about Python below).

As an early web browser application, Wasm has been, and continues to be, heavily entwined with JavaScript. More recently, Rust has entered the fray, and its integration with JavaScript and even when running alone without JavaScript for WebAssembly applications is showing a lot of promise.

But let’s look at the developers. Many developers struggle with Rust, for example. It’s considered just downright hard for many, if not most people who are learning it from scratch, even those who might be reasonably familiar with C++ with which it shares a lot of attributes. There are legions and legions of JavaScript programmers out there who are heavily involved in applications for web applications and mobile applications, of course, and this is all great for those folks, but where does it lead the rest of us?

Python, in particular, is one of the most popular programming languages and as we know is very well-targeted for machine learning, edge cases (like JavaScript in many cases) and other applications. A lot of people just like it (this writer included) because it is comparatively easy to learn and very clean. Theoretically, WebAssembly can accommodate Python along with the other languages, but its actual use with Wasm has remained limited. But this is changing. The good news is that using WebAssembly for Python is beginning to emerge.

Fermyon Technologies CEO and co-founder Matt Butcher agreed, but said he would “go one further.” Indeed, for WebAssembly to become more than a niche technology, it absolutely must gain support from most (if not all) of the top tier languages,” Butcher told The New Stack. “And that includes scripting languages like Python.”

Ironically, for Fermyon, which was created one year ago this February, one of the startup’s mantras was that wide language support was essential to Wasm’s successes. “From web development to machine learning, Python is a vital language,” Butcher said. “I have a hard time imagining WebAssembly reaching its full potential without first-class Python support.”

Indeed, Python will eventually show its merit running in Wasm for a number of applications where it shines much more than JavaScript and/or Rust. Machine learning and big data processing are good examples. Developers of these applications have “long treated Python ‘as their lingua franca,’ Butcher noted. “WebAssembly has a lot to offer those ecosystems — especially on the security and portability front,” Butcher said. “But that potential can only be realized with top-notch Python support.”

Python has also long been a language of choice for web application backends. “With a rich set of packages and technologies, Python has a lot to bring to the table in this domain as well,” Butcher said.

Big up on Data Science

Many data science developers are looking forward to the day when they easily take advantage of Wasm to more seamlessly deploy their Python code in a way that does not have to be recompiled for different edge and other environments, thus also lending support for distributed deployments. Since data science, and specifically, deep learning use cases, have already contributed tremendously to Python’s popularity, the ability to run inference models at the edge on Wasm could drastically streamline and simplify the deployment, operations, upgrades and scalability of these models, Torsten Volk, an analyst for Enterprise Management Associates (EMA), told The New Stack.

Being able to train machine learning models on Wasm would thus enable data scientists to benefit from Wasm’s ability to “scale down to zero” for minimizing cost and to almost instantly scale up to any number of nodes, on-demand, Volk said. “This could enable organizations to use expensive GPUs that accelerate the training of deep learning models in a much more efficient manner, as individual workloads could ‘take shifts’ using this hardware,” Volk said. “What I would love to see is a Wasm SDK for Python that allows me to easily install any Python library so that developers and data scientists can get disposable and easily movable environments set up very quickly,” Volk said.

If Wasm could help make instant Python runtimes available without hassle to the developer and overhead cost and security headaches for the hoster, this would dramatically lower the barriers of entry for many citizen developers and data scientists who often remain intimidated by having to create their own development environments, Volk said. Moreover, “Combined with the ability to then run the resulting code on any machine that supports Wasm, this could significantly accelerate experimentation and convince even more professionals to adopt Python,” Volk said.

Work on

Again, Python’s momentum is building. But Wasm support is not completely ready yet. “Python is one of the most popular programming languages in the world, and its WebAssembly implementation seems to be coming along quickly,” Butcher recently wrote in a blog post. “While it is not yet ready for use, we anticipate it will be functional in the first half of 2022.”

But work needs to be done. While Python is a relatively easy sell given its popularity (after all, the Rust developer community is small compared with other languages, as Sehyo Chang, CTO at InfinyOn, which uses Wasm for event streaming and processing to lower latency, noted) and is becoming the dominant language for data science and machine learning — success is not a given. “We are also focused on supporting Python as a first-class language, especially with regard to WebAssembly,” Chang said. “However, there are significant challenges in supporting Python in WebAssembly, and it will take some time to solve them.”

With CPython — the Python reference interpreter — Emscripten — and WASI-based implementations will soon become a reality. Since CPython is the most popular Python runtime environment, it logically follows that enabling it to run in WASI will spur adoption of WASI in general, Chang said.

While WebAssembly is becoming a general-purpose technology and “will always have a place in the browser,” Esmcripten support is important for browser capabilities. At the same time, WASI is necessary for applications beyond the browser, Butcher said. “The CPython team wisely chose to introduce support for both, giving developers in both camps access to one of the world’s most popular programming languages,” Butcher said.

Python Bandwagon

A number of organizations, both startups and established players, are understandably adding or are looking to add Wasm support.

VMware recently added Python support for Wasm Language Runtimes. In its documentation, its Wasm Language Runtimes offers popular language runtimes such as Ruby and others as well as Python that are precompiled to WebAssembly that are tested for compatibility and kept up to date when new versions of upstream languages are released, according to the project’s documentation.

It provides a build of Python for the wasm32-wasi target. Based on the WASI support that is already available in CPython (the mainstream, C-based implementation of Python), additional libraries and usage examples to make it as easy to use as possible augment the runtimes, VMware’s Asen Alexandrov, a staff engineer, wrote in a blog post.

InfinyOn is working on supporting Python as “a first-class citizen in our SmartModule technology,” Chang said. This will certainly spur further development in supporting Python in WebAssembly environments, he said.

Fermyon will soon release a Python SDK for Spin. This Python SDK is “entirely made possible by the CPython team’s work.” In fact, “a Wasm Python SDK  is one of our most frequently requested features,” Butcher said.

Stay tuned for more coverage about how these and other Python alternatives for Wasm work and how developers can make use of them. To wit, Fermyon offers a tutorial with command-line instructions to show how Python can be used to create a module for WAGI, which should soon serve as the basis for a tutorial from The New Stack.

Stay tuned.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: The New Stack, fermyon.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.