Name | instaui JSON |
Version |
0.3.6
JSON |
| download |
home_page | None |
Summary | insta-ui is a Python-based UI library for rapidly building user interfaces. |
upload_time | 2025-07-12 09:36:50 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <3.13,>=3.8 |
license | None |
keywords |
gui
ui
web
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# insta-ui
<div align="center">
English| [įŽäŊ䏿](./README.md)
</div>
## đ Introduction
insta-ui is a Python-based UI library for quickly building user interfaces.
## âī¸ Features
Three modes:
- Web mode: Generate web (stateless) applications.
- Web View mode: Generate web view applications that can be packaged as native apps (no need to start a web server).
- Zero mode: Generate pure HTML files that run directly in browsers without any dependencies.
## đĻ Installation
Zero mode:
```
pip install instaui -U
```
web mode
```
pip install instaui[web] -U
```
Web View mode
```
pip install instaui[webview] -U
```
## đĨī¸ Quick Start
Below is a simple example of number summation. The result color changes dynamically based on the sum:
```python
from instaui import ui, arco
arco.use()
@ui.page('/')
def home():
num1 = ui.state(0)
num2 = ui.state(0)
# Automatically recalculates result when num1 or num2 changes
@ui.computed(inputs=[num1, num2])
def result(num1: int, num2: int):
return num1 + num2
# Automatically updates text_color when result changes
@ui.computed(inputs=[result])
def text_color(result: int):
return "red" if result % 2 == 0 else "blue"
# UI components
arco.input_number(num1)
ui.label("+")
arco.input_number(num2)
ui.label("=")
ui.label(result).style({"color": text_color})
# when you deploy your web application, you need to set debug=False.
ui.server(debug=True).run()
```
Replace `ui.server().run()` with `ui.webview().run()` to switch to Web View mode:
```python
...
# ui.server(debug=True).run()
ui.webview().run()
```
To execute computations on the client side instead of the server, use `ui.js_computed` instead of `ui.computed`:
```python
from instaui import ui, arco
arco.use()
@ui.page('/')
def home():
num1 = ui.state(0)
num2 = ui.state(0)
result = ui.js_computed(inputs=[num1, num2], code="(num1, num2) => num1 + num2")
text_color = ui.js_computed(inputs=[result], code="(result) => result % 2 === 0? 'red' : 'blue'")
# UI components
...
...
```
In this case, all interactions will run on the client side. Use `Zero mode` to generate a standalone HTML file:
```python
from instaui import ui, arco,zero
arco.use()
@ui.page('/')
def home():
num1 = ui.state(0)
num2 = ui.state(0)
result = ui.js_computed(inputs=[num1, num2], code="(num1, num2) => num1 + num2")
text_color = ui.js_computed(inputs=[result], code="(result) => result % 2 === 0? 'red' : 'blue'")
# UI components
arco.input_number(num1)
ui.label("+")
arco.input_number(num2)
ui.label("=")
ui.label(result).style({"color": text_color})
with zero() as z:
home()
z.to_html('index.html')
```
Raw data
{
"_id": null,
"home_page": null,
"name": "instaui",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.8",
"maintainer_email": null,
"keywords": "gui, ui, web",
"author": null,
"author_email": "CrystalWindSnake <568166495@qq.com>",
"download_url": "https://files.pythonhosted.org/packages/2e/a6/d60e08d8a2eefcace2fc9e1f8c6951711e599cf63f4061c3e5d69195c83c/instaui-0.3.6.tar.gz",
"platform": null,
"description": "# insta-ui\n\n<div align=\"center\">\n\nEnglish| [\u7b80\u4f53\u4e2d\u6587](./README.md)\n\n</div>\n\n## \ud83d\udcd6 Introduction\ninsta-ui is a Python-based UI library for quickly building user interfaces.\n\n## \u2699\ufe0f Features\nThree modes:\n\n- Web mode: Generate web (stateless) applications.\n- Web View mode: Generate web view applications that can be packaged as native apps (no need to start a web server).\n- Zero mode: Generate pure HTML files that run directly in browsers without any dependencies.\n\n \n## \ud83d\udce6 Installation\n\nZero mode:\n\n```\npip install instaui -U\n```\n\nweb mode\n\n```\npip install instaui[web] -U\n```\n\nWeb View mode\n```\npip install instaui[webview] -U\n```\n\n\n## \ud83d\udda5\ufe0f Quick Start\nBelow is a simple example of number summation. The result color changes dynamically based on the sum:\n\n```python\nfrom instaui import ui, arco\narco.use()\n\n@ui.page('/')\ndef home():\n num1 = ui.state(0)\n num2 = ui.state(0)\n\n # Automatically recalculates result when num1 or num2 changes \n @ui.computed(inputs=[num1, num2])\n def result(num1: int, num2: int):\n return num1 + num2\n\n # Automatically updates text_color when result changes\n @ui.computed(inputs=[result])\n def text_color(result: int):\n return \"red\" if result % 2 == 0 else \"blue\"\n\n # UI components \n arco.input_number(num1)\n ui.label(\"+\")\n arco.input_number(num2)\n ui.label(\"=\")\n ui.label(result).style({\"color\": text_color})\n\n# when you deploy your web application, you need to set debug=False.\nui.server(debug=True).run()\n```\n\nReplace `ui.server().run()` with `ui.webview().run()` to switch to Web View mode:\n\n```python\n...\n\n# ui.server(debug=True).run()\nui.webview().run()\n```\n\nTo execute computations on the client side instead of the server, use `ui.js_computed` instead of `ui.computed`:\n\n```python\nfrom instaui import ui, arco\narco.use()\n\n@ui.page('/')\ndef home():\n num1 = ui.state(0)\n num2 = ui.state(0)\n\n result = ui.js_computed(inputs=[num1, num2], code=\"(num1, num2) => num1 + num2\")\n text_color = ui.js_computed(inputs=[result], code=\"(result) => result % 2 === 0? 'red' : 'blue'\")\n\n # UI components\n ...\n\n...\n\n```\n\nIn this case, all interactions will run on the client side. Use `Zero mode` to generate a standalone HTML file:\n\n```python\nfrom instaui import ui, arco,zero\narco.use()\n\n@ui.page('/')\ndef home():\n num1 = ui.state(0)\n num2 = ui.state(0)\n\n result = ui.js_computed(inputs=[num1, num2], code=\"(num1, num2) => num1 + num2\")\n text_color = ui.js_computed(inputs=[result], code=\"(result) => result % 2 === 0? 'red' : 'blue'\")\n\n # UI components\n arco.input_number(num1)\n ui.label(\"+\")\n arco.input_number(num2)\n ui.label(\"=\")\n ui.label(result).style({\"color\": text_color})\n\nwith zero() as z:\n home()\n z.to_html('index.html')\n\n```",
"bugtrack_url": null,
"license": null,
"summary": "insta-ui is a Python-based UI library for rapidly building user interfaces.",
"version": "0.3.6",
"project_urls": null,
"split_keywords": [
"gui",
" ui",
" web"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f6a6a12da0f189dfeaa3ffc20f1cae3dca65c2adf402186188d369a8aa4d82f8",
"md5": "bc44a08f9d15ceba4efe04cab736c95d",
"sha256": "96d0806b7532cfdc59f5151deb8eed0a564851530fc2f0022184370b44468c67"
},
"downloads": -1,
"filename": "instaui-0.3.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bc44a08f9d15ceba4efe04cab736c95d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.8",
"size": 605967,
"upload_time": "2025-07-12T09:36:45",
"upload_time_iso_8601": "2025-07-12T09:36:45.820009Z",
"url": "https://files.pythonhosted.org/packages/f6/a6/a12da0f189dfeaa3ffc20f1cae3dca65c2adf402186188d369a8aa4d82f8/instaui-0.3.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2ea6d60e08d8a2eefcace2fc9e1f8c6951711e599cf63f4061c3e5d69195c83c",
"md5": "608da592f5bc32d9ae1a2ccfaa2c344f",
"sha256": "52969cd31bd5a2ce23f32382bc17c046a2dbb2d269baa3f043f12c658d0bc398"
},
"downloads": -1,
"filename": "instaui-0.3.6.tar.gz",
"has_sig": false,
"md5_digest": "608da592f5bc32d9ae1a2ccfaa2c344f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.8",
"size": 537633,
"upload_time": "2025-07-12T09:36:50",
"upload_time_iso_8601": "2025-07-12T09:36:50.099619Z",
"url": "https://files.pythonhosted.org/packages/2e/a6/d60e08d8a2eefcace2fc9e1f8c6951711e599cf63f4061c3e5d69195c83c/instaui-0.3.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-12 09:36:50",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "instaui"
}