Skip to main content

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:
  1. 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).
  2. Packages are pre-bundled at build time. When you run the dump command, the CLI resolves and downloads all declared Python packages, the Pyodide runtime, and your app source files into a local build/ directory — no internet connection is needed at runtime.
  3. 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.
  4. electron-builder packages the result. A single npm run app:dist command 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 .exe installers for Windows, .dmg disk images for macOS, and .AppImage / .deb packages for Linux — all from the same codebase.
  • Pre-bundled Python packages. Declare dependencies with stlite.desktop.dependencies or point to a requirements.txt file; the dump command 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: true to hide Streamlit’s toolbar, hamburger menu, and footer for a cleaner desktop UI.
  • Custom application menu. Set stlite.desktop.appMenu: false to hide the native menu bar entirely.
  • Custom Pyodide source. Supply a local or alternative Pyodide distribution via --pyodide-source if 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.

Build docs developers (and LLMs) love