PyScript

PyScript 是一个框架,允许用户利用 HTML 界面、Pyodide、MicroPython 和 WASM 的强大功能以及现代网络技术,在浏览器中创建丰富的 Python 应用程序。「PyScript is a framework that allows users to create rich Python applications in the browser using HTML's interface and the power of Pyodide, MicroPython and WASM, and modern web technologies.」

  • 所有者: pyscript/pyscript
  • 平台: Linux,Mac,Windows,Web browsers
  • 许可证: Apache License 2.0
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

PyScript

What is PyScript

Summary

PyScript is a framework that allows users to create rich Python applications in the browser using HTML's interface and the power of Pyodide, MicroPython and WASM, and modern web technologies.

To get started see the Beginning PyScript tutorial.

For examples see here.

Other useful resources:

Every Tuesday at 15:30 UTC there is the PyScript Community Call on zoom, where we can talk about PyScript development in the open. Most of the maintainers regularly participate in the call, and everybody is welcome to join.

Every other Thursday at 16:00 UTC there is the PyScript FUN call: this is a call in which everybody is encouraged to show what they did with PyScript.

For more details on how to join the calls and up to date schedule, consult the official calendar:

Longer Version

PyScript is a meta project that aims to combine multiple open technologies into a framework that allows users to create sophisticated browser applications with Python. It integrates seamlessly with the way the DOM works in the browser and allows users to add Python logic in a way that feels natural both to web and Python developers.

Try PyScript

To try PyScript, import the appropriate pyscript files into the <head> tag of your html page:

<head>
    <link
        rel="stylesheet"
        href="https://pyscript.net/releases/2023.11.2/core.css"
    />
    <script
        type="module"
        src="https://pyscript.net/releases/2023.11.2/core.js"
    ></script>
</head>
<body>
    <script type="py" terminal>
        from pyscript import display
        display("Hello World!") # this goes to the DOM
        print("Hello terminal") # this goes to the terminal
    </script>
</body>

You can then use PyScript components in your html page. PyScript currently offers various ways of running Python code:

  • <script type="py">: can be used to define python code that is executable within the web page.
  • <script type="py" src="hello.py">: same as above, but the python source is fetched from the given URL.
  • <script type="py" terminal>: same as above, but also creates a terminal where to display stdout and stderr (e.g., the output of print()); input() does not work.
  • <script type="py" terminal worker>: run Python inside a web worker: the terminal is fully functional and input() works.
  • <py-script>: same as <script type="py">, but it is not recommended because if the code contains HTML tags, they could be parsed wrongly.
  • <script type="mpy">: same as above but use MicroPython instead of Python.

Check out the official docs for more detailed documentation.

How to Contribute

Read the contributing guide to learn about our development process, reporting bugs and improvements, creating issues and asking questions.

Check out the developing process documentation for more information on how to setup your development environment.

Governance

The PyScript organization governance is documented in a separate repository.

主要指标

概览
名称与所有者pyscript/pyscript
主编程语言Python
编程语言 (语言数: 5)
平台
许可证Apache License 2.0
所有者活动
创建于2022-02-21 04:55:20
推送于2025-07-01 12:41:39
最后一次提交
发布数36
最新版本名称2025.7.1 (发布于 )
第一版名称2022.05.1 (发布于 )
用户参与
星数18.4k
关注者数170
派生数1.5k
提交数1.3k
已启用问题?
问题数829
打开的问题数17
拉请求数1003
打开的拉请求数3
关闭的拉请求数187
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?