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, and print button.
  • 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.


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.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.2

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.2
File Size Uploaded Provenance Actions
hotkoffee-0.1.2.tar.gz 39.2 kB Without provenance Details for hotkoffee-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 77.9 kB

Release files / hotkoffee-0.1.2.tar.gz

Download URL hotkoffee-0.1.2.tar.gz
Size 39.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6136852cde66988bd54e312dd98c30f2bc0838e05ff0ce553437bd45b7ac47c4
BLAKE2b-256 checksum
How to use checksums
a8ba41bba861b658e274e087bdc8837b900261d4bb263d9eaaba49e118d7c476
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.2-py3-none-any.whl

Download URL hotkoffee-0.1.2-py3-none-any.whl
Size 38.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da0c4913db1fc9ccaef97ce3a7725b5ab1c31ccf6ac193940fb54daa7205a7ed
BLAKE2b-256 checksum
How to use checksums
2b2baa1141ee34077860d6078c53b1c25f3101e49905d7959e0d56ab52432527
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.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.

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