A package for converting streamlit apps to stlite apps to remove the need for hosting
Project description
stlitepack
stlitepack is a Python utility that helps you turn your existing Streamlit apps into stlite apps — lightweight, browser-only Streamlit apps that run entirely in the client without a server.
With stlitepack, you can:
- 📦 Pack your Streamlit app into a stlite-ready format
- 🗂️ Include additional resources like config.toml
- 🚀 Generate GitHub Actions workflows to (almost) auto-deploy your app to GitHub Pages
📦 Installation
pip install stlitepack
🚀 Usage
from stlitepack import pack
# Pack your Streamlit app (e.g., "app.py") into a stlite bundle
pack("app.py")
This will create an index.html file with all of the required stlite additions, which you can then serve as a static file using a hosting platform such as github pages.
⚠️ Heads Up!
Opening index.html directly in your browser may show navigation or media errors if you use session state in multi-page apps or if you are loading in external file. This is normal — it only happens when using file:// URLs.
Fix: Serve the app over HTTP (e.g., python -m http.server) or deploy to GitHub Pages.
Everything will work correctly once served via a web server!
For local testing prior to deployment, try running
python -m http.server 8000
from the root of your local repository.
Then open http://localhost:8000/index.html (or change the path to reflect the final location of your created index.html file - e.g. http://localhost:8000/docs/index.html)
Documentation
Check out the quickstart guide at sammirosser.com/stlitepack/stlitepack_docs/stlitepack_quickstart.
You can also find the full reference for each function at sammirosser.com/stlitepack/reference/.
🔮 Roadmap
- ✅ v0.1.0: Single-page app packing
- ✅ v0.2.0: Helper functions for GitHub Pages auto-deploy (via GitHub Actions workflow generation)
- ✅ v0.3.0: Multi-page app support (for
pages/subfolder method) and simple additional file inclusion - ✅ v0.4.0: Lots of improvements!
- Better support for resource bundling (images, CSVs, assets, config files etc.) of local or web-based file, also leading to multi-page app support via
st.navigation()method - Starting to automate changes of known stlite/streamlit differences (e.g.
await asyncio.sleep(1)being required when usingst.spinner) - Optional automatic spinning up of a preview server for the deployed app
- Support for material icons
- Better support for resource bundling (images, CSVs, assets, config files etc.) of local or web-based file, also leading to multi-page app support via
- v0.4.1: Bugfix for asyncio code
- v0.4.2: Better documentation of v0.4 features
- v0.5.0: Further auto-handling of stlite-specific required changes
- v0.6.0: Add support for generating the required package.json for desktop app bundling
- v0.7.0: Add helpers for generating files for additional deployment options e.g. Docker, Caddy, Nginx, Apache
- v0.8.0: TOML or YAML file support as optional alternative to the packing function
- v1.0.0: Full toolkit for packaging, deploying, and managing stlite apps
Examples of Use
eFIT-tool
All credits go to Peter Saiu and collaborators for the original repository!
- stlite Repository: github.com/Bergam0t/eFIT-tool-stlitepack
- Original Repository: github.com/pete4nhs/eFIT-tool
- Packing script: github.com/Bergam0t/eFIT-tool-stlitepack/blob/main/pack_to_stlite.py
- Hosted stlite app: sammirosser.com/eFIT-tool-stlitepack/
Non-elective Flow Simulation
All credits go to Helena Robinson and collaborators for the original repository!
- stlite Repository: github.com/Bergam0t/hr_Non-Elective-Flow-Simulation
- Original Repository: github.com/Countess-of-Chester-Hospital-NHS-FT/Non-Elective-Flow-Simulation
- Packing script: github.com/Bergam0t/hr_Non-Elective-Flow-Simulation/blob/main/app/pack.py
- Hosted stlite app: http://sammirosser.com/hr_Non-Elective-Flow-Simulation/
🤝 Contributing
Contributions, feature requests, and feedback are welcome!
Open an issue or submit a pull request to help improve stlitepack.
📜 License
Apache 2.0 License. See LICENSE for details.
Acknowledgements
Generative AI Use Disclosure
This package was developed with the assistance of ChatGPT (OpenAI’s GPT-5 model) as a coding and documentation partner. All code and design decisions were reviewed and finalized by a human, and ChatGPT’s output was used as a foundation rather than a final product.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stlitepack-0.4.1.tar.gz.
File metadata
- Download URL: stlitepack-0.4.1.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7203c6f31187dec4ef9077dcc05e1112cf979a87719750f7199280d0b1fcc538
|
|
| MD5 |
437112f385b509fe9a5f69671b326513
|
|
| BLAKE2b-256 |
f8a8bb66b4210a143e2bd81ced5e2ec2593ba63936f91f36d82e8f16212e2314
|
File details
Details for the file stlitepack-0.4.1-py3-none-any.whl.
File metadata
- Download URL: stlitepack-0.4.1-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e55585204690f099fede023531efc0a8461b241d225dfd6d5993aa44fa07f6f7
|
|
| MD5 |
57acd1028756f6a324e94d6394601549
|
|
| BLAKE2b-256 |
41d216ab9d9ae84c6572004875d9a7149d08f919656a7eec54b859868cbc28d8
|