lofigui
Latest: v0.17.39Lofi GUI - A minimalist Go library for creating really simple web-based GUIs for CLI tools and small projects. It provides a print-like interface for building lightweight web UIs with minimal complexity.
The application is where you have a single real object (e.g. machine or long-running process) which then has a number of pages around it to show various aspects of it.
In the spirit of Niklaus Wirth — computer systems should be simpler and more readable. Every dependency, every JavaScript byte, every layer of indirection has to justify itself against the alternative of just printing HTML. See Philosophy for the longer argument.
Overview
lofigui provides a print-like interface for building lightweight web applications with minimal complexity. Perfect for:
- Creating quick GUIs for command-line tools
- Internal tools for small teams (1-10 users)
- Single-process or single-object front-ends
- Rapid prototyping without JavaScript overhead
Key Features
- Simple API: Print-like interface (
Print(),Markdown(),HTML(),Table()) - No JavaScript: Pure HTML/CSS using the Bulma framework
- Single binary: Deploy as one executable, no dependencies
- WebAssembly: Same code runs in the browser via WASM
- Responsive layouts: Bulma-based templates with optional
base.htmlinheritance — see example 03 (Style Sampler) for the catalogue
Quick Start
package main
import (
"net/http"
"codeberg.org/hum3/lofigui"
)
func model(app *lofigui.App) {
lofigui.Print("Hello world")
app.EndAction()
}
func main() {
ctrl, _ := lofigui.NewControllerWithLayout(lofigui.LayoutNavbar, "My App")
app := lofigui.NewApp()
app.SetController(ctrl)
app.SetDisplayURL("/display")
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
app.HandleRoot(w, r, model, true)
})
http.HandleFunc("/display", func(w http.ResponseWriter, r *http.Request) {
app.HandleDisplay(w, r)
})
http.HandleFunc("/favicon.ico", lofigui.ServeFavicon)
http.ListenAndServe(":8080", nil)
}
Element
Your project is essentially a web site. To make design simple you completely refresh pages so no code for partial refreshes. To make things dynamic it has to be asynchronous, using goroutines for background processing.
Like a normal terminal program you essentially just print things to a screen but now have the ability to print enriched objects.
Model View Controller architecture
All I really want to do is to write the model. The controller and view (in the browser and templating system) are a necessary evil. The controller includes the routing and web server. The controller is split between the app (single instance) and a model-specific controller. The view is the HTML templating (html/template in Go, Jinja2 in Python) and the browser.
Buffer
In order to decouple the display from the output and be able to refresh, you need to buffer the output. It is more efficient to buffer the output in the browser but more complicated. Moving the buffer to the server simplifies the software but requires you to refresh the whole page. lofigui relies on hyperlinks to perform updates. HTMX plays nicely here for improving interactivity (examples 09-10).
Installation
go get codeberg.org/hum3/lofigui
Examples & Documentation
See the documentation site for interactive examples (including WASM demos), research notes, and the roadmap.
To run examples locally, use Task:
task --list # Show all available tasks
task go-example:09 # Run any Go example by number
Python
A Python implementation also exists with the same API using FastAPI and Jinja2. See Python Notes for installation, API reference, and development instructions.
Roadmap
See ROADMAP.md for planned features and future direction.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
MIT License - see LICENSE file for details.
Author
Humphrey Drummond - hum3@drummond.info
Links
| Documentation | https://h3-lofigui.statichost.page/ |
| PyPI | https://pypi.org/project/lofigui/ |
| Source (Codeberg) | https://codeberg.org/hum3/lofigui |
| Mirror (GitHub) | https://github.com/drummonds/lofigui |
Metadata
Release files for lofigui 0.17.39
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lofigui-0.17.39.tar.gz | 90.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lofigui-0.17.39-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 105.8 kB
Release files / lofigui-0.17.39.tar.gz
| Download URL | lofigui-0.17.39.tar.gz |
|---|---|
| Size | 90.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c128c461a077234b7fbabeb8427b9d614aadfedd7688f034d112afec2acc60cd
|
|
BLAKE2b-256 checksum How to use checksums |
95d01d9db907a736d83b77d922d1a6071aed480af3cce2a0dc696754c3cc8381
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / lofigui-0.17.39-py3-none-any.whl
| Download URL | lofigui-0.17.39-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7ef5e7278462ed45ef0661a858418b0553b97982e97b76281f899bda98bbba3
|
|
BLAKE2b-256 checksum How to use checksums |
0dba20f0ef6bd23810bbac0b8f7c5586e3d2e1a114757d13592eebba8037c6a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for lofigui 0.17.39
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.