Skip to main content

The Thread-Safe, State-Aware Interface that Weaves Itself.

Project description

LoomUI: The Thread-Safe Interface That Weaves Itself

LoomUI Demo

PyPI version License: MIT

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 @expose decorator to instantly turn any Python function into a web form with inputs and validation.
  • 🧠 Invisible State: No session_state["key"]. No callbacks. Just modify state.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

loom_ui_pkg-0.0.3.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loom_ui_pkg-0.0.3-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file loom_ui_pkg-0.0.3.tar.gz.

File metadata

  • Download URL: loom_ui_pkg-0.0.3.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for loom_ui_pkg-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f493b0739fb4299b848c510ec61bb3af784844cf17d09cf774aa7e348f97392c
MD5 eab975fd731a421088ff395c5056d4db
BLAKE2b-256 8a0af48dc2ce41ef796852571011939c639c782efb362ca5838e5c84f57f7f81

See more details on using hashes here.

File details

Details for the file loom_ui_pkg-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: loom_ui_pkg-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for loom_ui_pkg-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a971bbe27cc4fb5010ed4286af5cace74851c3c49f762360202e492f0332f3ba
MD5 6c2998cc7af90c73bcf8a35a3c3983e0
BLAKE2b-256 2b31fefd16f7cd4c4eeda0b81db2aecc1bf1eca190a438b9d0f63be31aa75111

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page