An offline-capable browser built in Python. HTML is ingested into a JSON DOM bundle, page scripts are translated with Js2Py, and pages can be rendered in a Qt window or a terminal (TUI) viewer.
- Fetch or load HTML and serialize a DOM + scripts bundle (
www2json.py) - Offline Qt renderer with navigation, bookmarks, history, and media helpers (
json2qt.py) - Interactive terminal renderer with sixel image support (
json2tui.py) - Online browser mode that combines ingest + Qt viewing (
browser.py) - Local test server with mock search, uploads, and webmail for XHR demos
- Python 3
- Dependencies listed in
requirements.txt(PyQt5, Rich, Pillow, yt-dlp, and Js2Py-related packages)
Optional for the TUI image path: a terminal that supports sixel graphics.
make setupThis creates a .venv and installs dependencies from requirements.txt.
# Build a bundle from the sample page and open it in Qt
make run-example
# Same page in the terminal viewer
make run-example-tui
# Fetch Google (basic HTML) and open in Qt
make run-googleGenerated bundles and assets live under /tmp/offline-browser/.
| Command | Description |
|---|---|
make setup |
Create venv and install dependencies |
make test |
Run the full automatic test suite |
make parse-example |
Build DOM.json from example.html |
make parse-lenna |
Build Lenna.json (fetches Wikipedia if needed) |
make run-example |
Open the example page in the Qt viewer |
make run-google |
Open Google in the Qt viewer |
make serve |
Start the localhost test webserver (port 8765) |
make run-mock-search-viewer |
Qt viewer against the mock search home |
make run-browser |
Combined online browser with mock mail |
make clean |
Remove generated files under /tmp/offline-browser |
Run make help for the full list of targets.
- Ingest —
www2json.pyloads HTML (file or URL), translates scripts, and writes a JSON bundle. - Render (Qt) —
json2qt.pyreads a bundle (or fetches online) and displays it with PyQt5. - Render (TUI) —
json2tui.pyrenders the same bundle in the terminal. - Online browser —
browser.pywires ingest + Qt viewing and can host the mock mail server.
make testUses an offscreen Qt platform so GUI tests can run without a display.