The Thread-Safe, State-Aware Interface that Weaves Itself.
Project description
LoomUI: The Thread-Safe Interface That Weaves Itself
LoomUI is a next-generation Python framework designed to bridge the gap between simple scripts and complex dashboards. Unlike other libraries that require callbacks, manual state management, or reactive graph definitions, LoomUI uses Invisible State Monitoring to update your UI automatically.
Write standard Python. Get a real-time SPA (Single Page Application).
🚀 Key Features
- 🪄 Function-is-the-Interface: Use the
@exposedecorator to instantly turn any Python function into a web form with inputs and validation. - 🧠 Invisible State: No
session_state["key"]. No callbacks. Just modifystate.x = 5, and the UI updates. - ⚡ WebSocket Powered: Built on FastAPI and Uvicorn for bi-directional, real-time communication.
- 🎨 Theme Engine: One-line CSS variable theming. Cyberpunk? Dark mode? Corporate? Just pass a dict.
- 📊 Integrated Charts: Full Chart.js support right out of the box.
📦 Installation
pip install loomui
⚡ Quick Start: The "Magic" Mode
The fastest way to build a tool. LoomUI inspects your function signatures and generates the UI.
from loom import LoomApp, expose
app = LoomApp()
@expose
def calculate_roi(investment: float, rate: float, years: int):
"""Calculates return on investment instantly."""
return investment * ((1 + rate) ** years)
if __name__ == "__main__":
app.run()
🛠️ Advanced: The "Layout" Mode
For full control over dashboards, charts, and state.
from loom import LoomApp, state
# 1. Define Theme
dark_theme = {"background": "#111", "text": "#0f0", "primary": "#d0f"}
app = LoomApp(theme=dark_theme)
# 2. Define State
state.count = 0
# 3. Define Logic
def increment():
state.count += 1
# 4. Build Layout
with app.root:
app.Text("# System Monitor")
with app.Row():
app.Button("INCREASE LOAD", on_click=increment)
app.Text("Current Load: $count") # '$' binds automatically to state
app.Chart(
type="line",
labels=["00:00", "00:01", "00:02"],
data=[10, 25, 60]
)
if __name__ == "__main__":
app.run()
🎨 Theming
LoomUI supports full customization via a simple dictionary:
theme = {
"background": "#ffffff",
"surface": "#f4f4f9",
"text": "#333333",
"primary": "#6200ea",
"radius": "12px"
}
app = LoomApp(theme=theme)
📄 License
MIT License. Free to use for personal and commercial projects.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file loom_ui_pkg-0.0.2.tar.gz.
File metadata
- Download URL: loom_ui_pkg-0.0.2.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d44ea769bef3ae484e9cb549fbce0b7cb6ef2f4fd8450a2ac5dfbda59ff2aaab
|
|
| MD5 |
9983c87bb32e5f30b7f477dd74fca7ac
|
|
| BLAKE2b-256 |
50d8192ad689e55f36a2c891d8e7477689dc398c8496a66e1b2a5cfb687c0929
|
File details
Details for the file loom_ui_pkg-0.0.2-py3-none-any.whl.
File metadata
- Download URL: loom_ui_pkg-0.0.2-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8852d3c1e3f85db94381b66e967993a8565c52d9fe9f809b5f9d03b5343d203
|
|
| MD5 |
23e522871750b9b78a5f0ccb861259b9
|
|
| BLAKE2b-256 |
1f2f44805e3942deb98007ea8c3ed56804ec168881edcc55add6b76d9ce54965
|