Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Inline Python where all you have to do is put in <python></python>


You can do that today with PyScript:

  <script type="module" src="https://pyscript.net/releases/2025.8.1/core.js"></script>
  <py-script>
  import sys
  from pyscript import display
  display(sys.version)
  </py-script>
Demo: https://static.simonwillison.net/static/2025/pyscript-demo.h...

Or you can use MicroPython which is much smaller:

    <mpy-script>
      import sys
      from pyscript import display
      display(sys.version)
    </mpy-script>
Demo: https://static.simonwillison.net/static/2025/pyscript-microp...


Since they compiled the python interpreter to webassembly, yes you can now totally do a <python></python> webcomponent if you like. Of course it requires the extra work of importing this interpreter. Web browsers aren't going to come with multiple interpreters built-in, it would be too heavy.

I would be interested to see how short the time to run "Hello World" can be with python in a webpage, counting the time to load the whole page without cache.


Try benchmarking https://static.simonwillison.net/static/2025/pyscript-microp... and see. It's pretty minimal.


What kind of safeguards would we need in place with this sort of feature in html? What are the security implications?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: