Streamlit Standalone App using Tauri

Hello,

Has anyone had any success implementing Streamlit with Tauri (rust) backend to turn streamlit into a standalone windows/mac app.

I have been able to successfully package streamlit with pyinstaller into a binary and run it as a Tauri binary but found that the streamlit server is never killed when the app is closed.

Thanks

2 Likes

Hi there,
I have the same question after I tried the combination of Streamlit & PyQt (over 900M). I’m looking for the function or component in Tauri that’s similar to QWebEngineView. The issues with PyQt is that for embedding web app, it needs to include chromium while Tauri adops a different and smaller one.
Best,

1 Like

Hey @giiyms did had any success with streamlit in tauri? If possible could you share steps on how to go about it.

Thanks,

You can refer to the following projects:

But this only loads the front-end resources from the url, does not truly achieve full localization.

You can trigger an event that calls a system command to kill the corresponding process when closing the tauri window.

When you load a pyinstaller binary as a Tauri sidecar, it should theoretically be cleaned up when you close the main window, but it seems that this behaviour isn’t consistent (this is also the case based on my own personal experience).

The thread above has some good options, but otherwise I coded a small function to close anything running on port 8501 with the name of my app. Example here if you need it: StatementSensei/tauri/src-tauri/src/lib.rs at 4ab66ba76e9f698ce991b12b47f1fb7fb468fbc1 · benjamin-awd/StatementSensei · GitHub