Documentation Index
Fetch the complete documentation index at: https://mintlify.com/whitphx/stlite/llms.txt
Use this file to discover all available pages before exploring further.
@stlite/desktop lets you ship any Streamlit application as a fully self-contained desktop application for Windows, macOS, and Linux. Because Python runs entirely inside Pyodide — a WebAssembly port of CPython — end-users never need to install Python, pip, or any other dependency. The finished product is a native executable (.exe, .app, .dmg, etc.) that works completely offline.
How It Works
@stlite/desktop wraps the Stlite browser runtime inside an Electron shell:
- Pyodide runs Python in WebAssembly. Your Streamlit app’s Python code executes inside Pyodide compiled to Wasm, hosted in an Electron renderer process (a sandboxed Chromium environment by default).
- Packages are pre-bundled at build time. When you run the
dumpcommand, the CLI resolves and downloads all declared Python packages, the Pyodide runtime, and your app source files into a localbuild/directory — no internet connection is needed at runtime. - Electron provides the native shell. Electron wraps the Stlite web runtime and exposes it as a native desktop window, complete with a native application menu and OS-level window management.
electron-builderpackages the result. A singlenpm run app:distcommand bundles everything into a distributable installer for each target platform.
Getting Started
Install the package, write your app, and build your first desktop executable.
Configuration
Full reference for every option in the
stlite.desktop field of package.json.File System
Persist data with IndexedDB (IDBFS) or mount host OS directories via NODEFS.
Key Features
- Cross-platform distribution. Build
.exeinstallers for Windows,.dmgdisk images for macOS, and.AppImage/.debpackages for Linux — all from the same codebase. - Pre-bundled Python packages. Declare dependencies with
stlite.desktop.dependenciesor point to arequirements.txtfile; thedumpcommand downloads and embeds wheels at build time so nothing is fetched at runtime. - IndexedDB persistence (IDBFS). Mount virtual file system paths backed by IndexedDB so that files your app writes survive application restarts. Data is stored in Electron’s app-data directory.
- Host file system access (NODEFS). Optionally enable the NodeJS worker mode and mount real host OS directories into the virtual file system, giving your Python code direct read/write access to local files.
- Embed mode. Set
stlite.desktop.embed: trueto hide Streamlit’s toolbar, hamburger menu, and footer for a cleaner desktop UI. - Custom application menu. Set
stlite.desktop.appMenu: falseto hide the native menu bar entirely. - Custom Pyodide source. Supply a local or alternative Pyodide distribution via
--pyodide-sourceif JsDelivr CDN access is restricted in your environment.
The
dump script in your package.json calls the dump-stlite-desktop-artifacts binary provided by @stlite/desktop. Re-run it any time you change your app source files, add new packages, or update the stlite.desktop configuration.