Skip to main content

hotkoffee

PyPI version License: MIT Python versions

hotkoffee is a lightweight, reactive UI framework for building Python-based web dashboards and applications. It offers a streamlined development experience by allowing developers to construct fully interactive interfaces using pure Python, eliminating the need for a separate frontend layer.

Under the hood, hotkoffee is powered by FastAPI and WebSockets, giving you real-time, reactive updates between your Python state and the rendered UI — in the browser or as a native desktop window.


Features

  • Reactive state — hk.state() wraps any value; updating .value automatically re-renders everything bound to it.
  • Widgets — text, title, button, input, image, chart, table, print button, toast, and notifications.
  • Layouts — column, row, grid, and card containers for structuring your UI.
  • Auto-schema tables — tables can start with zero columns and automatically detect and extend their schema as new fields stream in.
  • CSV support — read and save CSV data directly with read_csv / save_csv.
  • MQTT integration — build live, streaming dashboards fed by MQTT data sources.
  • Background workers — run long-lived or polling tasks with run_background without blocking the UI.
  • Theming — customize colors and border radius via set_config.
  • Desktop mode — run the same app as a native desktop window using pywebview, no browser required.

Installation

Install from PyPI:

pip install hotkoffee

For desktop mode support:

pip install hotkoffee[desktop]

Installing from source (development)

git clone https://github.com/Jiyo-pv/hotkoffee.git
cd hotkoffee
pip install -r requirements.txt

Requirements

  • Python 3.8+
  • fastapi >= 0.95.0
  • uvicorn >= 0.20.0
  • websockets >= 11.0
  • paho-mqtt >= 1.6.1
  • pandas >= 2.0.0
  • pywebview >= 4.0.0 (only required for desktop mode)
  • pytest >= 8.0.0 (for running tests)

Quickstart

import hotkoffee as hk

count = hk.state(0)
hk.text("Count:", count)
hk.button("Increment +1", on_click=lambda: setattr(count, 'value', count.value + 1))
hk.run()

Run the script and hotkoffee will start a local server and open your default browser automatically:

[hotkoffee] Running at http://127.0.0.1:8000

Usage Examples

Layouts and reactive input

import hotkoffee as hk

count = hk.state(0)
username = hk.state("Developer")

def inc():
    count.value += 1

with hk.card():
    hk.text("hotkoffee Application")
    hk.text("User Profile: <b>", username, "</b>")
    hk.input(username, placeholder="Type your name...")
    hk.break_()
    hk.text("Reactive Click Count: <b>", count, "</b>")
    hk.button("Click to Increment", on_click=inc)

hk.run()

Auto-detecting live tables

Tables can start empty and automatically extend their schema as new fields appear in streamed data — useful for sensor feeds, telemetry, or any evolving JSON payload:

import hotkoffee as hk

with hk.card():
    hk.text("Live Sensor Table")
    tbl = hk.table(max_rows=10, editable=True)

def sensor_worker():
    tbl.append({"timestamp": "10:00:01", "temp": 22.4, "humidity": 45.0})
    tbl.append({"timestamp": "10:00:02", "temp": 23.1, "humidity": 44.2, "pressure": 1013.2})

hk.run_background(sensor_worker)
hk.run(open_browser=False)

Desktop mode

Run the exact same app as a native desktop window instead of a browser tab:

hk.run(desktop=True)

More runnable examples are available in the examples/ directory, including a CSV editor, an MQTT dashboard, and a theme builder demo.


Toasts and notifications

import hotkoffee as hk

with hk.row():
    hk.title("Dashboard")
    bell = hk.notifications()

def on_save():
    hk.toast("Saved!", type="success")
    bell.add("File saved", level="success")

hk.button("Save", on_click=on_save)
hk.run()

Theming

hotkoffee supports simple string-based theme configuration:

hk.set_config("table:#141417,text:#d7d7e5,chart:#b5bdc9,button:#3b82f6,input:#3b82f6,body:#1cb54a,radius:rounded")

Configurable keys include table, text, chart, button, input, and body colors (as hex values), plus layout options like radius.


API Overview

Function / Class Description
hk.state(value) Creates a reactive State object
hk.text(...) Renders text, optionally bound to reactive state
hk.title(...) Renders a title element
hk.button(label, on_click=...) Renders a clickable button
hk.input(state, placeholder=...) Renders a text input bound to state
hk.image(...) Renders an image
hk.chart(...) Renders a chart
hk.table(...) Renders a data table with optional auto-schema and editing
hk.print_button(...) Renders a button that triggers printing
hk.toast(message, type=..., duration=...) Shows a transient toast notification (info/success/warning/error)
hk.notifications() Renders a bell icon with an unread badge and dropdown panel; call .add(message, level=...) to push entries
hk.column() / hk.row() / hk.grid() / hk.card() Layout containers (use as context managers)
hk.break_() Inserts a line break in the layout
hk.read_csv(...) / hk.save_csv(...) Read/write CSV data
hk.run_background(fn) Runs a function in a background thread
hk.set_config(...) Applies theme/config settings
hk.run(...) Starts the hotkoffee server

hk.run() parameters

Parameter Default Description
host "127.0.0.1" Interface to bind to. Use "0.0.0.0" to expose on the local network.
port auto (starting at 8000) Port to bind. If occupied, the next free port up to 8010 is selected automatically.
desktop False Launches a native desktop window via pywebview instead of a browser tab.
reload False Enables hot-reload for development.
open_browser True Automatically opens the default browser on startup. Set False for headless/server use.

Testing

hotkoffee ships with a test suite covering core functionality, widgets, and examples. Clone the repo and run:

git clone https://github.com/Jiyo-pv/hotkoffee.git
cd hotkoffee
pip install -r requirements.txt
pytest

Project Structure

hotkoffee/
├── core/          # State management, config, background tasks, app/component core
├── widgets/        # UI widgets (text, button, input, chart, table, etc.)
├── layout/          # Layout containers (row, column, grid, card, break)
├── data/            # CSV read/write utilities
├── renderers/       # Web (FastAPI/WebSocket) and desktop rendering backends
└── theme_builder.py  # Theme/config helpers

examples/            # Runnable example apps
tests/               # Test suite

License

This project is licensed under the MIT License.

Contributing

Contributions, issues, and feature requests are welcome. Feel free to open an issue or submit a pull request on GitHub.

Author

Jiyo P V

Metadata

Release files for hotkoffee 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hotkoffee 0.1.3
File Size Uploaded Provenance Actions
hotkoffee-0.1.3.tar.gz 42.0 kB Without provenance Details for hotkoffee-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hotkoffee 0.1.3
File Interpreter ABI Platform Actions
hotkoffee-0.1.3-py3-none-any.whl Python 3 none any Details for hotkoffee-0.1.3-py3-none-any.whl

Total release size: 84.0 kB

Release files / hotkoffee-0.1.3.tar.gz

Download URL hotkoffee-0.1.3.tar.gz
Size 42.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8ca0567f5747a5315c09b96fce9e621b53a810f373cb259fd0d706707f879b36
BLAKE2b-256 checksum
How to use checksums
de79fe98c78051226990b438c5bcd780afa075c97c4ecea813e8ace67f0f0127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / hotkoffee-0.1.3-py3-none-any.whl

Download URL hotkoffee-0.1.3-py3-none-any.whl
Size 42.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d16cb643e842acd00edfb250610a2d7353ee014ae6d6ced83d82fbcca98aa813
BLAKE2b-256 checksum
How to use checksums
b65b85b1fe411ab1d0b239cab08f002fa67458ff5dda55697492d39a299470b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for hotkoffee 0.1.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page