Streamlit workflow in Renku

We are developing a Streamlit application on RenkuLab and there’s somewhat of a workflow challenge. Presently, updating the Streamlit app requires committing and pushing code changes to a git repository, followed by pulling these changes in another session where the Streamlit app is running. This process can be time-consuming, especially during iterative development phases where frequent testing and adjustments are necessary.

Would it be possible to implement a feature that allows developers to run Streamlit applications locally within the same session? This would enable real-time testing and immediate reflection of changes without the need for repetitive commits and session restarts. We would greatly appreciate any guidance on potential solutions or workarounds to achieve this!

2 Likes

Hi @cimeister, thanks for posting your question! You can indeed do this if you set up streamlit in the same image that has jupyterlab. How are you currently setting up your image?

Here’s an example project in renku 2.0 with a launcher that uses an image which includes both jupyterlab and streamlit; the launcher opens up JupyterLab by default. You can start the streamlit server by clicking the icon once in JupyterLab. If you modify the app files, the app will automatically reload.

Hope that helps! If you’re having issues with the configuration, I’m happy to have a look at your project as well if you can share the link.

Awesome! Yes this is what I was looking for. I didn’t realize it would be as straightforward as using a different image when creating the launcher. Thanks so much!

Great!

Are you building your own image for your project? Ideally the image that you use would have all the dependencies you need pre-installed. You’re free to use the one from my project of course, but you’ll need to install all your own packages after the session launches.

I and @cimeister have managed to get everything running by following the tutorial on setting up a Streamlit application and everything is working as expected apart from one thing: the data we’ve connected via a data connector is not mounted when the session is started. We tried opening other sessions and the data successfully mounts in these. We would greatly appreciate if you could assist us in finding a solution to this problem.

1 Like

Hi @cakasa, glad you’re able to make progress! My first guess is that there could be a problem with how the working directory and mount directory paths are configured in the session launcher. How are you setting those?

Thank you for the hint on what to look at. Both directories were set to - when I asked the question. I looked at the example project and it turns out the directories should be set to /home/jovyan/work, instead. That successfully resolved our issue. Thank you for the help!

great, glad to hear that helped. I believe we have an issue already to set better defaults there, so hopefully this won’t cause confusion for much longer.