Enable `streamlit run` to serve a list of apps.
See original GitHub issueProblem
You don’t just have one app file. But many. Right now streamlit will only serve one app.
Solution
Enable streamlit run
without a file name to serve a folder of apps. Just like Voila does
Additional context
Consider whether this requires some configuration options in the configuration file
- Serve subfolders as well?
- Serve all python files or just some satisfying a filter like *app.py?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:20
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Configuration - Streamlit Docs
Streamlit provides four different ways to set configuration options. This list is in reverse order of precedence, i.e. command line flags take precedence ......
Read more >Main concepts - Streamlit Docs
As soon as you run the script as shown above, a local Streamlit server will spin up and your app will open in...
Read more >Add statefulness to apps - Streamlit Docs
We define access to a Streamlit app in a browser tab as a session. For each browser tab that connects to the Streamlit...
Read more >Create an app - Streamlit Docs
Running a Streamlit app is no different than any other Python script. Whenever you need to view the app, you can use this...
Read more >How to make "streamlit run example.py" run as a service or ...
Be sure to have Anaconda installed. Give that path to the root variable. Activate that conda environment. The path to your streamlit app...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Questions:
For users and tools: If I recall correctly, around 2016 airbnb open-sourced something called
knowledge repos
for organizing jupyter notebooks. My understanding is that it never took off, however it had some really nice UI features for navigating projects.Here is an example of what the nb navigation gui looked like.
I’m throwing this sort of thinking in as an idea. I am bad at follow-through since I’m not well versed in web.
Heres a link to the knowledge repo: https://github.com/airbnb/knowledge-repo
My thought with this would be to have an
index.py
app which runs at the root path, and then every otherexample.py
test.py
etc would run athttp://hostname.com/example
andhttp://hostname.com/test
.The idea is that the CLI would point to a directory, if that directory does not contain an
index.py
a template one would be created, and it would do a little bit of a sanity check to make sure that the built in names are not being overwritten (healthz
,stream
, etc):https://github.com/streamlit/streamlit/blob/a20aba7fbc0380b8ed05664f33275d81435a2df7/lib/streamlit/server/Server.py#L296-L330
So CLI usage would be:
and the directory tree could look something like:
Importantly, if any of the scripts imports a shared function that is cached, this cache should be shared amongst them so that the server scales appropriately (without doubling up on caching).
An example
index.py
that could be created and placed within that directory if anindex.py
doesn’t exist already might look a bit like the following:This
index.py
template could be further improved by also importingwatchdog
, and when the directory tree changes (such as a new python file added), then the following function could be run:Which would rerun the script, and update the URLs 😃.
[EDIT]
Turns out running the following within a watchdog thread doesn’t actually cause the parent thread to rerun, instead it just causes the watchdog thread to error out and stop:
However the following PR addresses a means to rerun a streamlit session from within a watchdog thread:
https://github.com/streamlit/streamlit/pull/2060
[/EDIT]