Skip to main content

ItWorks

A ridiculously simple Python + Browser bridge using plain text files.

itworks lets Python and JavaScript communicate without any complex:

  • servers
  • sockets
  • APIs
  • Flask
  • WebSockets
  • dependencies

It's perfect for:

  • local dashboards
  • automation tools
  • browser + Python projects
  • rapid and easy prototyping
  • offline applications
  • beginners who find Flask complicated
  • people who find flask and javascript hard (Like me:))

How It Works

Communication uses 2 files only!

from_js.txt - Browser writes, Python reads to_js.txt - Python writes, Browser reads

The flow:

Browser -> from_js.txt -> Python Python -> to_js.txt -> Browser

Python clears incoming messages after reading them to avoid complicated issues.

Functions:

itworks.throw(filepath, data)

Write data from Python -> Browser.

Example:

import itworks

itworks.throw("to_js.txt", "Hello from Python")

itworks.catch(filepath)

Read data from Browser -> Python.

Automatically clears the file after reading.

Returns:

message string if data exists None if file is empty or missing

Example:

import itworks

msg = itworks.catch("from_js.txt")

if msg:
    print(msg)

itworks.peek(filepath)

Read a file WITHOUT clearing it.

Useful for debugging.

Example:

print(itworks.peek("from_js.txt"))

itworks.lazy(from_js, to_js, output_html="index.html", poll_interval=500)

Automatically generates a full browser UI.

Includes:

input box output panel send button folder picker auto polling connection tester

Example:

import itworks

itworks.lazy(
    from_js="from_js.txt",
    to_js="to_js.txt"
)

This creates:

index.html

Open it in Chrome for it to work

itworks.engine(from_js, to_js, poll_interval=500)

Generates a minimal JavaScript engine for custom UIs.

Example:

import itworks

js = itworks.engine(
    from_js="from_js.txt",
    to_js="to_js.txt"
)

with open("engine.html", "w") as f:
    f.write(js)

Full Example

import time
import itworks

while True:
    msg = itworks.catch("from_js.txt")

    if msg:
        print("Browser:", msg)

        response = f"Python received: {msg}"
        itworks.throw("to_js.txt", response)

    time.sleep(0.5)

Browser UI generator:

import itworks

itworks.lazy("from_js.txt", "to_js.txt")

Open the generated HTML in chrome file.

Browser Requirements

ONLY Works in:

Chrome Edge Chromium browsers

Does NOT fully work in Firefox.

Error Handling

throw() raises OSError for:

missing directories permission problems unexpected write errors

catch() safely returns None on most failures.

Minimal Echo Example

import time
import itworks

while True:
    msg = itworks.catch("from_js.txt")

    if msg:
        itworks.throw("to_js.txt", f"Echo: {msg}")

    time.sleep(0.5)

Metadata

Release files for itworks 1.0.0

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

Source distribution (sdist)

Source distribution for itworks 1.0.0
File Size Uploaded Provenance
itworks-1.0.0.tar.gz 6.8 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 13.8 kB

Release files / itworks-1.0.0.tar.gz

Download URL itworks-1.0.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bc6674707762d3699af66589a221fd0af11d9fb2837dfe8c8ebe9c1dc5cc3991
BLAKE2b-256 checksum
How to use checksums
d63d5f7c21a2abc96fcb616202535fa205d9821d1af7ca855e6bd475c16f875c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / itworks-1.0.0-py3-none-any.whl

Download URL itworks-1.0.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4b34ab5145f4b8c72bf8ed92763f06cb638ea6f2cfa29a519c50cbcfa4e6d69
BLAKE2b-256 checksum
How to use checksums
dc61f98d1eb73d3aefe3b64d97be1675d8fc15552361780a175ede182baa8c8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for itworks 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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