Streamlit file browser
A streamlit component serve as web file browser from local directory.
Install
pip install st-file-browser
Usage Example
import streamlit as st
from streamlit_file_browser import st_file_browser
st.header('Default Options')
event = st_file_browser("example_artifacts", key='A')
st.write(event)
st.header('With Artifacts Server, Allow choose file, disable download')
event = st_file_browser("example_artifacts", artifacts_site="http://localhost:1024", show_choose_file=True, show_download_file=False, key='B')
st.write(event)
st.header('Show only molecule files')
event = st_file_browser("example_artifacts", artifacts_site="http://localhost:1024", show_choose_file=True, show_download_file=False, glob_patterns=('molecule/*',), key='C')
st.write(event)
API
| name | usage | type | required | default |
|---|---|---|---|---|
| key | react key | string | No. But I suggest giving each component a different key | None |
| path | the path of dir | strubg | Yes | |
| glob_patterns | To control file shows, the usage is the same as the patterns of glob.glob | string (regex) | No | '**/*' |
| ignore_file_select_event | If ignore the 'file_selected' event | bool | No | False |
| extentions | Only show the files included in the extentions | list | No | None |
| show_delete_file | If show the button of delete file | bool | No | False |
| show_choose_file | If show the button of choose file | bool | No | False |
| show_new_folder | If show the button of new folder | bool | No | False |
| show_upload_file | If show the button of upload file | bool | No | False |
| limit | File number limit | int | No | 10000 |
| use_cache | If cache file tree | bool | No | False |
Run example
Build
If any changes were made to the frontend, go to st_file_browser/frontend and run npm run build (npm install --legacy-peer-deps if you don't have the packages on your machine). Then push the changes made to the frontend/build folder to the repo.
You may need to follow this help if you run into issues while building.
Now all you have to do is make a release and the github action will push to PyPi (make sure setup.py has a new verison)
Release files for st-file-browser 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| st-file-browser-0.1.1.tar.gz | 1.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| st_file_browser-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.7 MB
Release files / st-file-browser-0.1.1.tar.gz
| Download URL | st-file-browser-0.1.1.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ebbff97e95347a4fdffef4e45eda1492d9583ac7303d7b5a63259a2233916cc
|
|
BLAKE2b-256 checksum How to use checksums |
c09921f7ffa5336ee11e34ced6c3db844ab8d3d3f48804b220c230e2ede26291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / st_file_browser-0.1.1-py3-none-any.whl
| Download URL | st_file_browser-0.1.1-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f44b2c889123e210fdbda4103acc28770617ae1522ce7563b67550544b85d395
|
|
BLAKE2b-256 checksum How to use checksums |
0eb161aebb087078ad746f007d82347f27859b61e2f0daef66d77202d0fa182d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|