Itworksbetter – 7 functions to give any Python script a browser UI

eyyeyeyeyeyey2 pts0 comments

itworksbetter · PyPI

Skip to main content<br>Switch to mobile version

Warning

You are using an unsupported browser, upgrade to a newer version.

Warning

Some features may not work without JavaScript. Please try enabling it if you encounter problems.

Search PyPI

Search

itworksbetter 1.0.0

pip install itworksbetter

Copy PIP instructions

Latest release

Released:<br>May 28, 2026

Seven functions. Clean and easy. Infinite possibilities.

Navigation

Verified details

These details have been verified by PyPI<br>Maintainers

TeamLeader

Unverified details

These details have not been verified by PyPI<br>Project links

Github

Meta

License: MIT License (MIT)

Author: Atheer B. Muzzammil

Requires: Python >=3.8

Classifiers

Development Status

5 - Production/Stable

Intended Audience

Developers

License

OSI Approved :: MIT License

Operating System

OS Independent

Programming Language

Python :: 3

Python :: 3.8

Python :: 3.9

Python :: 3.10

Python :: 3.11

Python :: 3.12

Topic

Internet :: WWW/HTTP :: HTTP Servers

Software Development :: User Interfaces

Report project as malware

Project description

itworksbetter

Seven functions. One loop. Infinite possibilities.

itworksbetter is a tiny Python library that creates a live communication bridge between Python and your browser.

No frameworks.<br>No WebSockets.<br>No async confusion.<br>No frontend setup.

Just:

msg = iwb.catch()<br>iwb.throw("hello")

That’s it.

Why itworksbetter?

Most browser ↔ Python communication tools are heavy.

You usually need:

Flask

FastAPI

SocketIO

React/Vue

Routes

APIs

async/await

frontend tooling

itworksbetter strips all of that away.

You write a single Python loop.

The browser becomes your UI instantly.

Perfect for:

AI tools

Browser dashboards

Python assistants

Internal tools

Local automation

Rapid prototypes

Teaching

Experiments

Live terminals

Custom browser interfaces

Installation

pip install itworksbetter

The Philosophy

Seven functions.

One loop.

Infinite possibilities.

while True:<br>if msg := iwb.catch():<br>iwb.throw(f"You said: {msg['text']}")

That loop is your backend.

Quick Start

10-Line Echo Bot

import time<br>import itworksbetter as iwb

iwb.lazy(title="Echo Bot", theme="dark")<br>iwb.init()

while True:<br>if msg := iwb.catch():<br>iwb.throw(f"You said: {msg.get('text', '')}")

time.sleep(0.01)

Run it:

python app.py

Your browser opens automatically.

Type messages into the UI.

Python receives them instantly.

How It Works

itworksbetter runs a lightweight local HTTP server.

The browser:

sends messages to Python

polls for responses

displays live output

Internally it uses:

queues

threads

HTTP

JSON

No external services required.

Everything stays local.

The Seven Functions

1. lazy()

Configure the browser UI before launch.

iwb.lazy(title="My App", theme="light")

Parameters

Parameter<br>Type<br>Default

title<br>str<br>"itworksbetter"

theme<br>str<br>"dark"

Themes

Supported:

"dark"

"light"

2. init()

Start the local server and connect to your browser.

iwb.init()

Example

iwb.init(port=8080)

Parameters

Parameter<br>Type<br>Default

port<br>int<br>8000

open<br>bool<br>True

auto_fallback<br>bool<br>True

Features

Automatically opens your browser

Auto-finds an open port if needed

Runs the server in a background thread

Cleans itself up on exit

Example Output

✅ Using port: 8000<br>🚀 itworksbetter v1.0.0 running at http://localhost:8000<br>📡 Echo Bot | Theme: dark<br>💡 Waiting for messages...

3. catch()

Receive messages from the browser.

msg = iwb.catch()

Returns

Message received

{"text": "hello"}

No message waiting

None

Typical Usage

if msg := iwb.catch():<br>print(msg["text"])

4. throw()

Send data to the browser.

iwb.throw("hello")

Supports

Any JSON-serializable data:

iwb.throw("text")

iwb.throw({<br>"user": "alex",<br>"online": True<br>})

iwb.throw([1, 2, 3])

iwb.throw(123)

The browser UI automatically formats and displays the output.

5. close()

Shutdown the server cleanly.

iwb.close()

What it does

Stops browser polling

Shuts down the HTTP server

Frees the port immediately

Clears message queues

Useful if you want to restart the server without restarting Python.

6. help()

Show a built-in mini guide.

iwb.help()

Displays:

all functions

examples

quick usage tips

Great for learning the API quickly.

7. engine()

Get the JavaScript browser engine.

js = iwb.engine()

This lets you build completely custom browser UIs while still using the same Python communication system.

Custom UI Example

Python

import itworksbetter as iwb<br>import time

iwb.init()

while True:<br>if msg := iwb.catch():<br>iwb.throw({<br>"reply": msg["text"].upper()<br>})

time.sleep(0.01)

HTML

html><br>body>

input id="msg"><br>button id="send">Sendbutton>

pre id="output">pre>

script><br>/* paste iwb.engine() output here */<br>script>

script><br>const input = document.getElementById("msg");<br>const output = document.getElementById("output");

document.getElementById("send").onclick = () => {<br>itworksbetter.send(input.value);<br>};

itworksbetter.listen((data) =>...

python browser itworksbetter throw catch output

Related Articles