PyScript – Run Python in the Browser! THE END of JavaScript???



PyScript is a framework that allows users to create Python applications in the browser using HTML. In this video we have a look at it and I show you how it works:

Resources:
– Website: https://pyscript.net/
– Blog: https://engineering.anaconda.com/2022/04/welcome-pyscript.html
– GitHub: https://github.com/pyscript/pyscript
– WASM in 100 seconds: https://youtu.be/cbB3QEwWMlA

Get my Free NumPy Handbook:
https://www.python-engineer.com/numpybook

✅ Write cleaner code with Sourcery, instant refactoring suggestions in VS Code & PyCharm: https://sourcery.ai/?utm_source=youtube&utm_campaign=pythonengineer *

⭐ Join Our Discord : https://discord.gg/FHMg9tKFSN

📓 ML Notebooks available on Patreon:
https://www.patreon.com/patrickloeber

If you enjoyed this video, please subscribe to the channel:
▶️ : https://www.youtube.com/channel/UCbXgNpp0jedKWcQiULLbDTA?sub_confirmation=1

~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

🖥️ Website: https://www.python-engineer.com
🐦 Twitter – https://twitter.com/python_engineer
✉️ Newsletter – https://www.python-engineer.com/newsletter
📸 Instagram – https://www.instagram.com/patloeber
🦾 Discord: https://discord.gg/FHMg9tKFSN
▶️ Subscribe: https://www.youtube.com/channel/UCbXgNpp0jedKWcQiULLbDTA?sub_confirmation=1

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

🅿 Patreon – https://www.patreon.com/patrickloeber

#Python

———————————————————————————————————-
* This is an affiliate link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! 🙏

33 thoughts on “PyScript – Run Python in the Browser! THE END of JavaScript???

  1. Seems interesting I wonder how fast it is? Does it just run a whole Python interpreter in the browser or translate it to web assembly? I love the idea of it

  2. Next thing in life, (future) you will see people working in it and getting unbelievable good. Thus, it will become a meta (just predictions).

  3. LoL how can this replace JS when it's actually written in JS?
    And about the performance cost I don't think it's production ready. Unless you soo obsessed with python…

  4. I mean… I get it, for use cases where you really need specific Python packages…

    But not without some SERIOUS performance issues.

    This comes from just the Hello World Example

    1. 290 kb of CSS and 300 kb of JS dependencies
    2. 7 MB for the Python interpreter
    3. 1.2 MB for dependencies

    Just for a Hello World example.

    Unless this gets built into browsers natively, you're absolutely gonna KILL your site's performance. Almost 9MB you can't get rid of is an INSANE amount of data, and on top you're running a Python interpreter in webassembly.

    Use sparingly when you have no alternatives left.

  5. Ehmm.. this is not running python in the browser… this is just converting python syntax to javascript. Big difference, you will not get the performance advantage of python, in fact the opposite, it will require loads of extra processing. Sure you can now run python libraries, but that's pretty much it.

  6. People, do you guys understand that this is just another js framework, right? How could it be the end of js if it uses js under the hood? Also, since js is single threaded, this is also single threaded.

  7. wouaouw !! what crazy stuff is going to append within 2 years with this new tool ? python in the browser is a milestone for web developpers. It's a bit like if a second javascript was born but with an insanely large community already in place

  8. This is an okay option for AI/ML people and generally people that want to do things Python is good at in the browser.
    For actual web dev… no.

    First, performance. Let's start with loading. The CSS is around 3MB uncompressed and 280 kB compressed. That's kind of a lot, but still… manageable. The JS is 1MB uncompressed and also 280 kB compressed
    That's just for the PyScript parts, by the way. Pyodide, with its whole Python interpreter and runtime components, is around 16.5MB uncompressed. That's… a lot. On my good internet connection it takes 5 seconds to load, and on a good 3G connection (what you could reasonably hope for) it's 40 seconds. 40 SECONDS!

    So, yeah. Not great for anything that users would actually have to use. And that's even without the interpreter performance – it takes a noticeable amount of time for it to start up and actually do anything. Even after startup, the performance is going to be terrible – this is a CPython port, after all. (JavaScript is JIT-compiled to machine code, because in a browser you care about performance. This gives only minimal overhead over C code, for example)

    The Mario example is misleading here – it is written in JavaScript and the Python just does some AIy stuff with it.

    Again: this is an okay option for running data science in the browser, but it is definitely not the end of JavaScript. Especially since it sucks at everything JS is good at.

Leave a Reply

Your email address will not be published.