Jupyter-server-proxy url parameter

I created a package to run streamlit on a python file on jupyterhub.

https://gitlab.com/logilab/jupyterlab-streamlit-server/-/blob/master/jupyter_streamlit_server/__init__.py

It works, if a go to https://{base_url}/jupyter_streamlit_server I can see the result.

The problem is that the python file is hardcoded (app/index.py).

Is there a solution to pass the path of the file in the url?

I would like to go to https://{base_url}/jupyter_streamlit_server/myfile.py run the command streamlit run myfile.py

Regards

It may not be strictly possible to do this within configuration.

If streamlit doesn’t support dynamically dispatching to multiple apps on the same port, you’ll probably have to implement your own mechanism.

Still in jupyter-server-proxy, you could write a simple “server” that just starts another server, per file, on a new port, and serves a one-line redirect HTML to {base_url}/proxy/{new_port}. No idea how you’d clean them up, though!

The weirdest thing might be to run streamlit inside the jupyter_server: it looks like streamlit uses tornado under the hood: you could probably figure out some way to use the “guts” of it more directly, and implement multiple app endpoints yourself, as a serverextension, where they share the same app… but this is kinda crazy.

1 Like

Thank you for your answer @bollwyvl even if it does not suit me :slight_smile: . I will continue to search for a solution.