The chapter explores the limitations of PiScript and the collaboration between MicroPython and PiScript teams to run PiScript in the browser using MicroPython. The hosts introduce guests Brett and Fabio, who talk about their backgrounds and roles in PyScript and WebAssembly. The chapter discusses the challenges and limitations of using Python in a browser-based environment and the collaborative efforts of the Python community. It explores the potential of integrating Python with WebAssembly, highlighting the challenges of packaging and distributing code. The chapter also discusses MicroPython, a scripting language created by Damien George, its ability to run in highly constrained environments, and the use of Python in the browser through PyScript and WebAssembly. The speakers discuss future plans for the code base and empowering others in education through web development runtime environments.
Read more
AI Summary
AI Chapters
Episode notes
auto_awesome
Podcast summary created with Snipd AI
Quick takeaways
The collaboration between PyScript and MicroPython has led to significant improvements in running Python in the browser, making it more accessible and efficient.
WebAssembly serves as a portable CPU target that allows code from various languages, including Python, to be executed in the browser, with efforts underway to develop a component model for effective interoperation.
PyScript, powered by WebAssembly, offers a lightweight and efficient way to use Python in web and front-end development, with potential applications in data science, real-time applications, education, and exploration.
Deep dives
PiScript Enables Python in the Browser
PiScript is a project that allows you to write Python files and run them in the browser in place of JavaScript. The project aims to provide an alternative to JavaScript and enable interactions between Python and JavaScript. The runtime for PiScript initially had a limitation of being a 9 megabyte web assembly file, which restricted its use. However, a recent collaboration between the PiScript and MicroPython teams has resulted in significant improvements. MicroPython's web assembly runtime is now just 300k to download and loads in under 100 milliseconds. This breakthrough opens up new possibilities for using Python in the browser, making it more accessible and efficient.
WebAssembly as a Portable CPU Target
WebAssembly (Wasm) is considered a portable CPU target that allows you to compile code from various languages to be executed in the browser. It functions as an instruction set that can run anywhere and is stack-based, similar to C Python's interpreter. However, WebAssembly does not provide a complete operating system environment like an actual CPU does. Projects like M-scripten and Wazzy play significant roles in bridging the gap by implementing functions for file access and other functionalities traditionally associated with operating systems. While there are challenges in integrating Python with WebAssembly due to differences in execution models, efforts are underway to develop a component model that allows different WebAssembly modules, including those written in Python, to interoperate effectively.
Python in the Browser: Expanding Possibilities
The collaboration between the PyScript and MicroPython teams has brought Python into the browser in a more lightweight and efficient manner. This development opens doors for using Python in various contexts, such as content web and front-end web development. PyScript's platform provides the flexibility to write Python code that interacts with JavaScript events and modifies DOM elements. It is not meant to be a complete framework, but rather a foundation on which developers can build their own frameworks and create innovative applications. The possibilities include using Python for data science, real-time applications, education, and exploration, among others. As the Python community explores and experiments with PyScript, the ecosystem is set to evolve with potentially smaller standard libraries and improved packaging strategies specific to the browser environment.
Advancements in MicroPython
MicroPython, developed by Damien George, is a scripting language designed to update robots quickly. What started as a Kickstarter project has now become a successful implementation. MicroPython is optimized for highly constrained environments, supporting devices with limited RAM. It is a full reimplementation of Python 3, albeit with some differences in the standard library and API support. MicroPython is aimed at education and is used on platforms like the micro:bit. It offers a smaller, lightweight version of Python that is suitable for applications such as IoT and running on mobile devices.
Expanding Python's Reach with PyScript
PyScript, an exciting new project, aims to make programming and Python more accessible. By leveraging WebAssembly, PyScript enables the creation of lightweight, web-based Python applications. It provides a way for beginners and learners to quickly build websites and mobile apps using Python. With PyScript, the focus is on democratizing programming and enabling users to easily experiment with Python. It opens up opportunities for web development, pluggable coding environments, and more. Although still in active development, PyScript's release is expected in the near future, likely in the spring of 2021.