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 loom_ui_pkg

⚡ 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.4.tar.gz (8.9 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.4-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: loom_ui_pkg-0.0.4.tar.gz
  • Upload date:
  • Size: 8.9 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.4.tar.gz
Algorithm Hash digest
SHA256 49e4e6d39acb9f38472231ec2e39178eed3ee9e0a7557d05f939d00de68e9b64
MD5 3ef83a98f94b594cadd66d6b5390b1d9
BLAKE2b-256 2288abc940f2c061ddfe39dafbcc0c71e3fb7edf6f9bf2ae1d5f80c96e11a842

See more details on using hashes here.

File details

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

File metadata

  • Download URL: loom_ui_pkg-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9133e55397aaeab7ee46b045206fe979e3ffa07fb6177619695c0b12b81d4b80
MD5 51d0275c34cb786a47ea6570b58541cd
BLAKE2b-256 ad314dcd41db023cf1ecd7edf8be0a26922904e6844acca66d8b759a13ae529f

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