Skip to main content

Convert Streamlit Python apps to stlite HTML apps

Project description

🔦 streamlit2stlite

Turn your Streamlit apps into standalone HTML files in seconds.

streamlit2stlite is a simple tool that bundles your Streamlit application and all its dependencies into a single HTML file. This file can be opened in any modern browser, running entirely purely on the client side using WebAssembly (via stlite). No server, no hosting costs, no deployment headaches.

💡 Perfect for sharing data dashboards, prototypes, and tools with colleagues or clients who don't have Python installed.

🚀 Quick Start

  1. Install the tool:

    pip install streamlit2stlite
    
  2. Convert your app:

    streamlit2stlite my_app.py
    
  3. Open my_app.html in your browser. That's it!


✨ Features

  • 📦 Auto-Magic Dependency Detection: Automatically scans your imports to determine which packages to install in the browser (e.g., proper handling of pandas, numpy, scipy for lmfit, etc.).
  • � LaTeX Support: Correctly handles backslashes in your math equations so they render perfectly.
  • �️ Smart Titles: Automatically detects your app's title from st.set_page_config() or st.title().
  • 🛠️ Full Control: Override requirements, titles, or the stlite version via CLI flags if you need to.

� Usage Guide

Basic Conversion

The simplest way to use it. Defaults to creating an HTML file with the same name as your script.

streamlit2stlite dashboard.py
# -> Creates dashboard.html

Custom Output Name

Specify exactly where you want the file to go.

streamlit2stlite script.py -o ./dist/awesome_dashboard.html

Managing Dependencies

We try to guess your dependencies, but sometimes you need to be specific.

Add extra packages:

streamlit2stlite app.py --add-requirements "scikit-learn,purple-air"

Override completely:

streamlit2stlite app.py --requirements "streamlit,pandas,numpy"

Full CLI Options

usage: streamlit2stlite [-h] [-o OUTPUT] [-r REQUIREMENTS] [-t TITLE]
                        [--stlite-version STLITE_VERSION]
                        [--add-requirements ADD_REQUIREMENTS] [-v]
                        input

positional arguments:
  input                 Path to the input Streamlit Python file

options:
  -h, --help            show this help message
  -o, --output          Path to the output HTML file
  -r, --requirements    Comma-separated list of packages to install
  -t, --title           Title for the HTML page
  --add-requirements    Additional packages to add to auto-detected ones
  -v, --verbose         Print verbose output

❓ FAQ

How does this work? It embeds your Python code into a template that loads stlite (a port of Streamlit to WebAssembly). When you open the HTML file, your browser downloads a mini Python environment (Pyodide) and runs your code locally.

Can I read local files? Because this runs in the browser, it cannot read files from your hard drive directly (sandbox security). You should use st.file_uploader to let users provide files, or embed data directly into your script.

Does it support all Python packages? It supports packages available in Pyodide (including numpy, pandas, scipy, matplotlib, scikit-learn) and pure Python packages from PyPI (micropip).

📄 License

MIT License. Feel free to use this for whatever you want!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit2stlite-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit2stlite-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file streamlit2stlite-0.1.0.tar.gz.

File metadata

  • Download URL: streamlit2stlite-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for streamlit2stlite-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3f281156fbd8327e88f97fd13d17f6631c760e6181dbec6e77728d76a92821ee
MD5 0bc3822f4aba8ab8bcfc774a981ba607
BLAKE2b-256 9966aa3ddb789bcb631878360c64abb0cea6702369e8c29652057f44f7395d4f

See more details on using hashes here.

File details

Details for the file streamlit2stlite-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit2stlite-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 adf153a236bb4cf73b24b16d802341e13c0b3e4633f569431ce60e212484334c
MD5 097c8eb77bc249606417f2d293ce179c
BLAKE2b-256 54a27be1f10fe257b817d5306ab57372fb66faa33bca18410dc813349789132a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page