insta-ui
English| 简体中文
📖 Introduction
insta-ui is a Python-based UI library for quickly building user interfaces.
⚙️ Features
Three modes:
- web mode: generates a stateless web application.
- Web View mode: generates a web view application, which can be packaged as a local app (no need to start a web service).
- Zero mode: generates a pure HTML file that can run directly in a browser without installing any dependencies.
📦 Installation
Zero mode:
pip install instaui -U
uv add instaui
web mode
pip install instaui[web] -U
uv add instaui[web]
Web View mode
pip install instaui[webview] -U
uv add instaui[webview]
🖥️ Quick Start
Install the TDesign UI library:
uv add instaui-tdesign[web]
# main.py
from instaui import ui
from instaui_tdesign import td
td.use(locale="en_US")
@ui.page('/')
def home():
ui.text("Hello, world!")
ui.server(debug=True).run()
📚 Getting Started
Below is a simple example of summing two numbers. The text color of the result changes dynamically based on whether the result is even or odd.
from instaui import ui
from instaui_tdesign import td
td.use(locale="en_US")
@ui.page('/')
def home():
num1 = ui.state(0)
num2 = ui.state(0)
# When num1 or num2 changes, result will be automatically recalculated
@ui.computed(inputs=[num1, num2])
def result(num1: int, num2: int):
return num1 + num2
# When result changes, text_color will be automatically updated
@ui.computed(inputs=[result])
def text_color(result: int):
return "red" if result % 2 == 0 else "blue"
# UI
td.input_number(num1, theme="column")
ui.text("+")
td.input_number(num2, theme="column")
ui.text("=")
ui.text(result).style({"color": text_color})
# When deploying a web app, remove debug=True
ui.server(debug=True).run()
Replace ui.server().run() with ui.webview().run() to run in web view mode:
...
# ui.server(debug=True).run()
ui.webview().run()
Methods bound with ui.computed are executed on the server side. If you want to run calculations on the client side, use ui.js_computed.
from instaui import ui
from instaui_tdesign import td
td.use(locale="en_US")
@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
...
...
In this case, all interactions are executed in the browser (client side). With zero mode, you can generate a pure HTML file that works without installing any dependencies:
from instaui import ui, zero
from instaui_tdesign import td
td.use(locale="en_US")
@ui.page('/')
def home():
...
zero().to_html(home, file='index.html')
Metadata
Release files for instaui 0.11.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| instaui-0.11.2.tar.gz | 389.9 kB | Without provenance | Details for instaui-0.11.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| instaui-0.11.2-py3-none-any.whl | Python 3 | none | any | Details for instaui-0.11.2-py3-none-any.whl |
Total release size: 895.2 kB
Release files / instaui-0.11.2.tar.gz
| Download URL | instaui-0.11.2.tar.gz |
|---|---|
| Size | 389.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5e515a781819b1f5b7f906eecade917ba6353d27ae737f7e81dad0342bf2988
|
|
BLAKE2b-256 checksum How to use checksums |
3aff26ad9511eb508740694f8d9fed0fd198ae8170ab36ca16e78fe64a3d51d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / instaui-0.11.2-py3-none-any.whl
| Download URL | instaui-0.11.2-py3-none-any.whl |
|---|---|
| Size | 505.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c55258a78b21cecdf176d50b57a6dfe0601f1503bf64593cb5e08e6f6874037
|
|
BLAKE2b-256 checksum How to use checksums |
d29a8a5d62342748cb0741c8f35bd650e1d1566cc9fd645f04bdd5123ff65a04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for instaui 0.11.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.