..

Running CHIRP radio drivers unmodified in the browser

tl;dr: The web-based CPS runs on webchirp.org

A radio for everyone’s budget

If you’re an amateur radio operator like me, you probably own at least a few cheap Chinese handhelds, like a Baofeng UV-5R, a BF-888, or some other HT that’s cheap enough to throw in your car and forget about. They have their quirks, sure, but their low price is what made it possible for a lot of people on a tight budget to get into the hobby.

One well-known downside of these radios (and, to be fair, plenty of more reputable brands too) is the quality of their Customer Programming Software (CPS). Companies that are good at hardware are rarely good at software. Just look at any printer’s web interface if you need proof. Worse, vendor CPS tools are often Windows-only, which means if you’re on an ARM Mac you end up firing up a sluggish 10GB VM just to program a handful of channels.

Fortunately, this problem was solved years ago. CHIRP is a cross-platform (Python and wxPython) desktop CPS that supports hundreds of radios. It’s battle-tested, actively maintained, and extended by volunteers who are willing to risk bricking their own radios for everyone else’s benefit.

My only real annoyance with it was the desktop app cycle itself: having to download and install a new release every time there was an update, on whichever machine I happened to be using.

Fixing my own problem

I’ve wanted a browser-based CPS for years, ever since I got my license in 2014 and later realized the Web Serial API was a thing. I tried starting the project several times, only to abandon it each time once the reality sank in: porting and testing dozens (let alone hundreds) of radio drivers in JavaScript would take forever, and I always had less tedious things to work on.

Until early 2026.

Enter coding agents

I had been using LLMs for tedious coding tasks for a while, and after experimenting with coding agents, I figured this was a good excuse to see how far one could take a weekend project.

Instead of porting every driver to JavaScript, I stopped to ask whether I even needed to. What if I could run CHIRP’s Python drivers unmodified? After so many years, CHIRP’s driver interface is rock solid, and the drivers themselves have been combed through and tested by thousands of users.

Then I remembered Pyodide, a full Python 3 runtime and standard library compiled to WebAssembly. In theory, it could run the drivers directly in the browser. The one big question mark was how to reconcile JavaScript’s asynchronous I/O model with CHIRP’s synchronous drivers. Could we somehow pause the Python interpreter while waiting on serial I/O?

Without overthinking it, I asked Codex to put an MVP together: build a harness to load a CHIRP driver in Pyodide and wire its I/O up to Web Serial. I went from idea to working prototype in about two hours. That genuinely shocked me. At best, I expected it to sketch out an approach, maybe complain that the async/sync boundary was hard, and get stuck. Instead, it got me to a local build that could actually read and write radio memory.

Blocking pyserial on top of async Web Serial

CHIRP’s clone-mode drivers are completely synchronous. I actually prefer it that way: they’re easy to read and you don’t have to trace through layers of callbacks. Web Serial is the exact opposite: everything is asynchronous and Promise-based.

I assumed bridging the two would be the hardest part, requiring some nasty trick to jump out of Python to JavaScript for I/O and jump back in to resume execution. Turns out someone had already solved this cleanly: Pyodide exposes pyodide.ffi.run_sync(), which uses WebAssembly JSPI to suspend the Wasm stack until a JavaScript Promise resolves (a Web Serial read or write) and then resume Python execution as if the call were synchronous.

With run_sync (wrapped here in a small _await_js helper), bridging CHIRP to Web Serial collapses into a minimal pyserial-compatible shim inside web/python/runtime_bridge.py:

class WebSerialPipe:
    """Minimal pyserial-like API over JS bridge for CHIRP drivers."""

    def __init__(self, timeout=0.5):
        self.timeout = timeout
        self.baudrate = None
        self.rts = None
        self.dtr = None

    def write(self, data):
        if isinstance(data, str):
            data = data.encode("latin1")
        _await_js(serial_write_bytes(list(data)))

    def read(self, count=1):
        timeout_ms = max(1, int(float(self.timeout) * 1000))
        data = _await_js(serial_read_bytes(int(count), timeout_ms))
        if hasattr(data, "to_py"):
            data = data.to_py()
        return bytes((int(x) & 0xFF) for x in data)

Once this shim was in place, I deleted the BF-888 test code I had started with and didn’t need any radio-specific protocol code at all. Downloading from any supported CHIRP radio became roughly:

radio = _create_radio_for_serial(radio_cls)
radio.sync_in()

Lazy-loading upstream CHIRP with a Python import hook

With generic clone-mode drivers working, bundling CHIRP as a local git submodule started to feel awkward. Shipping hundreds of driver files yourself means maintaining a copy of CHIRP and serving a pile of Python files the user will never touch for the one radio sitting on their desk.

Because jsDelivr serves files directly from GitHub (kk7ds/chirp@master) and exposes a flat JSON file index, the app can discover the driver catalog straight from upstream with no backend at all.

At first I wrote a small JavaScript scanner to regex-parse import statements and prefetch driver dependencies before running Python. It worked, but re-implementing Python’s import resolution with regexes is fragile. The much cleaner solution turned out to be a standard Python sys.meta_path import hook using the exact same run_sync trick:

class ChirpCdnFinder(importlib.abc.MetaPathFinder):
    """Lazy materializer for missing chirp.* modules from jsDelivr."""

    def find_spec(self, fullname, path=None, target=None):
        if fullname != "chirp" and not fullname.startswith("chirp."):
            return None
        try:
            _ensure_chirp_module_file(fullname)
        except Exception:
            return None
        return None

When Python executes importlib.import_module("chirp.drivers.<model>") (or when that driver transitively imports a shared helper like chirp.drivers.baofeng_common), ChirpCdnFinder intercepts the lookup, fetches the .py file from jsDelivr via JavaScript, writes it into /webchirp_runtime/... in Pyodide’s virtual filesystem, and returns None so Python’s normal PathFinder finishes loading it.

Letting CHIRP drive the UI

There’s another nice bonus to running the real driver in Python: you don’t have to hardcode UI constraints either. Calling radio.get_features() on the selected CHIRP driver gives you everything the memory table needs: valid memory bounds, supported frequency bands, duplexes, tone modes, CTCSS/DTCS lists, power levels, tuning steps, and even the radio’s maximum channel name length and allowed character set.

Passing that metadata back to the frontend turns the channel table into a radio-aware editor automatically, whether you’re programming a 16-channel BF-888 with no channel names or a dual-band transceiver with full alphanumeric labels.

WebCHIRP prototype running in the browser

Where it stands

This is still an early prototype with plenty of rough edges:

Even in this rough state, I’m surprised by how cleanly it all fits together. Between Pyodide, JSPI, and a coding agent to get past the initial boilerplate, an idea I kept shelving for years turned into a working browser-based radio programmer in an afternoon.