streamlit-file-explorer 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. streamlit_file_explorer-0.1.0/.streamlit/config.toml +6 -0
  2. streamlit_file_explorer-0.1.0/CHANGELOG.md +15 -0
  3. streamlit_file_explorer-0.1.0/CONTRIBUTING.md +36 -0
  4. streamlit_file_explorer-0.1.0/LICENSE +202 -0
  5. streamlit_file_explorer-0.1.0/MANIFEST.in +15 -0
  6. streamlit_file_explorer-0.1.0/PKG-INFO +226 -0
  7. streamlit_file_explorer-0.1.0/README.md +195 -0
  8. streamlit_file_explorer-0.1.0/SECURITY.md +9 -0
  9. streamlit_file_explorer-0.1.0/THIRD_PARTY_NOTICES.md +121 -0
  10. streamlit_file_explorer-0.1.0/build_support.py +39 -0
  11. streamlit_file_explorer-0.1.0/docs/releasing.md +70 -0
  12. streamlit_file_explorer-0.1.0/docs/slurm.md +61 -0
  13. streamlit_file_explorer-0.1.0/docs/verification.md +30 -0
  14. streamlit_file_explorer-0.1.0/example.py +16 -0
  15. streamlit_file_explorer-0.1.0/examples/data/scratch/README.txt +4 -0
  16. streamlit_file_explorer-0.1.0/examples/data/workspace/.example-hidden +1 -0
  17. streamlit_file_explorer-0.1.0/examples/data/workspace/config.yaml +6 -0
  18. streamlit_file_explorer-0.1.0/examples/data/workspace/notes.md +9 -0
  19. streamlit_file_explorer-0.1.0/examples/data/workspace/results/ranked_hits.tsv +4 -0
  20. streamlit_file_explorer-0.1.0/examples/data/workspace/run.sbatch +8 -0
  21. streamlit_file_explorer-0.1.0/examples/data/workspace/scores.csv +6 -0
  22. streamlit_file_explorer-0.1.0/examples/data/workspace/structures/receptor.pdb +5 -0
  23. streamlit_file_explorer-0.1.0/examples/launch_slurm.sbatch +24 -0
  24. streamlit_file_explorer-0.1.0/pyproject.toml +72 -0
  25. streamlit_file_explorer-0.1.0/scripts/check_distribution.py +57 -0
  26. streamlit_file_explorer-0.1.0/scripts/check_release.py +42 -0
  27. streamlit_file_explorer-0.1.0/scripts/smoke_install.py +154 -0
  28. streamlit_file_explorer-0.1.0/setup.cfg +4 -0
  29. streamlit_file_explorer-0.1.0/streamlit_app.py +93 -0
  30. streamlit_file_explorer-0.1.0/streamlit_file_explorer/__init__.py +12 -0
  31. streamlit_file_explorer-0.1.0/streamlit_file_explorer/component.py +145 -0
  32. streamlit_file_explorer-0.1.0/streamlit_file_explorer/controller.py +232 -0
  33. streamlit_file_explorer-0.1.0/streamlit_file_explorer/filesystem.py +235 -0
  34. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/build/index-C1s3fNox.js +6995 -0
  35. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/build/index-_hash_.css +2 -0
  36. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/package-lock.json +2323 -0
  37. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/package.json +39 -0
  38. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/src/Explorer.test.tsx +223 -0
  39. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/src/Explorer.tsx +608 -0
  40. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/src/PreviewPane.tsx +100 -0
  41. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/src/format.ts +17 -0
  42. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/src/index.tsx +39 -0
  43. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/src/style.css +799 -0
  44. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/src/test-setup.ts +4 -0
  45. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/src/types.ts +57 -0
  46. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/src/vite-env.d.ts +1 -0
  47. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/tsconfig.json +21 -0
  48. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/vite.config.ts +46 -0
  49. streamlit_file_explorer-0.1.0/streamlit_file_explorer/frontend/vitest.config.ts +6 -0
  50. streamlit_file_explorer-0.1.0/streamlit_file_explorer/models.py +47 -0
  51. streamlit_file_explorer-0.1.0/streamlit_file_explorer/py.typed +0 -0
  52. streamlit_file_explorer-0.1.0/streamlit_file_explorer/pyproject.toml +8 -0
  53. streamlit_file_explorer-0.1.0/streamlit_file_explorer.egg-info/PKG-INFO +226 -0
  54. streamlit_file_explorer-0.1.0/streamlit_file_explorer.egg-info/SOURCES.txt +61 -0
  55. streamlit_file_explorer-0.1.0/streamlit_file_explorer.egg-info/dependency_links.txt +1 -0
  56. streamlit_file_explorer-0.1.0/streamlit_file_explorer.egg-info/requires.txt +1 -0
  57. streamlit_file_explorer-0.1.0/streamlit_file_explorer.egg-info/top_level.txt +1 -0
  58. streamlit_file_explorer-0.1.0/tests/apps/visual.py +32 -0
  59. streamlit_file_explorer-0.1.0/tests/conftest.py +38 -0
  60. streamlit_file_explorer-0.1.0/tests/test_component.py +94 -0
  61. streamlit_file_explorer-0.1.0/tests/test_controller.py +162 -0
  62. streamlit_file_explorer-0.1.0/tests/test_filesystem.py +150 -0
  63. streamlit_file_explorer-0.1.0/uv.lock +3422 -0
@@ -0,0 +1,6 @@
1
+ [theme]
2
+ primaryColor = "#6777d8"
3
+ baseRadius = "0.5rem"
4
+
5
+ [browser]
6
+ gatherUsageStats = false
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — 2026-10-27
4
+
5
+ Initial implementation:
6
+
7
+ - Finder-style Streamlit v2 component with locations, breadcrumbs, search, sorting and pagination.
8
+ - File/folder selection, multiple selection, typed results and explicit confirmation.
9
+ - Bounded text, table and raster-image previews; isolated theme-aware styling.
10
+ - Root-scoped read-only access, symlink rejection, session-local state and cache.
11
+ - Local demo, SLURM launcher and deployment documentation.
12
+ - Wheels and source distributions with bundled frontend assets; Node-free pip installation.
13
+ - Python/frontend tests, cross-platform CI and a Trusted Publishing release workflow.
14
+
15
+ The public API is new and may change in 0.x releases. Changes will be documented here.
@@ -0,0 +1,36 @@
1
+ # Contributing
2
+
3
+ Start with a small issue describing the problem or a pull request with a focused change. For filesystem bugs, use synthetic files rather than private data. See README for supported platforms and known limits.
4
+
5
+ ## Set up
6
+
7
+ Use Python 3.10+ and Node.js 24+:
8
+
9
+ ```bash
10
+ uv sync --frozen
11
+ npm --prefix streamlit_file_explorer/frontend ci
12
+ uv run streamlit run streamlit_app.py --server.address 127.0.0.1
13
+ ```
14
+
15
+ The production frontend bundle is committed so package users can install directly from source without Node. After editing TypeScript/CSS, run the frontend build and commit the changed bundle alongside source changes. The build cleans old hashed files. CI rebuilds and checks that committed assets are current.
16
+
17
+ ```bash
18
+ npm --prefix streamlit_file_explorer/frontend run format
19
+ npm --prefix streamlit_file_explorer/frontend test
20
+ npm --prefix streamlit_file_explorer/frontend run build
21
+ uv run ruff format .
22
+ uv run ruff check .
23
+ uv run mypy
24
+ uv run pytest
25
+ uv run python scripts/check_release.py
26
+ uv build
27
+ uv run python scripts/check_distribution.py
28
+ uv run twine check --strict dist/*
29
+ uv run python scripts/smoke_install.py
30
+ ```
31
+
32
+ `smoke_install.py` creates a temporary environment, installs both artifacts using pip, and tests the installed code outside the checkout. It needs access to PyPI for dependencies. It also starts a real localhost Streamlit server and verifies the installed JS/CSS asset responses. Before a release, run `tests/apps/visual.py` for real-browser interaction checks in light/dark themes and narrow layouts.
33
+
34
+ Preserve the separation between filesystem I/O, controller state, the Streamlit adapter and frontend presentation. Keep all file reads bounded, use the v2 component API, and never interpolate filenames or preview contents as HTML. Tests should exercise behavior, failures and regressions.
35
+
36
+ See [the release guide](docs/releasing.md) for versioning and publishing.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,15 @@
1
+ include LICENSE THIRD_PARTY_NOTICES.md README.md pyproject.toml uv.lock
2
+ include build_support.py CHANGELOG.md CONTRIBUTING.md SECURITY.md
3
+ include streamlit_app.py example.py
4
+ include .streamlit/config.toml
5
+ include examples/data/workspace/.example-hidden
6
+ recursive-include scripts *.py
7
+ recursive-include docs *.md
8
+ recursive-include examples *.sbatch *.md *.txt *.csv *.tsv *.pdb *.yaml
9
+ recursive-include tests *.py
10
+ include streamlit_file_explorer/pyproject.toml streamlit_file_explorer/py.typed
11
+ recursive-include streamlit_file_explorer/frontend/build *.js *.css
12
+ recursive-include streamlit_file_explorer/frontend/src *.ts *.tsx *.css
13
+ include streamlit_file_explorer/frontend/*.json streamlit_file_explorer/frontend/*.ts
14
+ prune streamlit_file_explorer/frontend/node_modules
15
+ prune tests/__pycache__
@@ -0,0 +1,226 @@
1
+ Metadata-Version: 2.4
2
+ Name: streamlit-file-explorer
3
+ Version: 0.1.0
4
+ Summary: A Finder-style filesystem explorer for local and cluster Streamlit applications
5
+ Author: Streamlit File Explorer contributors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/diliadis/streamlit-file-explorer
8
+ Project-URL: Documentation, https://github.com/diliadis/streamlit-file-explorer#readme
9
+ Project-URL: Repository, https://github.com/diliadis/streamlit-file-explorer
10
+ Project-URL: Issues, https://github.com/diliadis/streamlit-file-explorer/issues
11
+ Project-URL: Changelog, https://github.com/diliadis/streamlit-file-explorer/blob/main/CHANGELOG.md
12
+ Keywords: streamlit,component,file-explorer,file-picker,slurm
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Typing :: Typed
24
+ Classifier: Topic :: Software Development :: User Interfaces
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ License-File: THIRD_PARTY_NOTICES.md
29
+ Requires-Dist: streamlit<2,>=1.53
30
+ Dynamic: license-file
31
+
32
+ # Streamlit File Explorer
33
+
34
+ A reusable Finder-style file picker built with **Streamlit Custom Components v2**, React, and TypeScript. Browse explicitly configured directories on the machine running Streamlit: your laptop, a server, or a SLURM compute node with mounted project storage.
35
+
36
+ Version **0.1.0** is the initial alpha release. Source: [diliadis/streamlit-file-explorer](https://github.com/diliadis/streamlit-file-explorer). It supports macOS and Linux. The public API may change in 0.x releases; a real SLURM deployment has not yet been validated.
37
+
38
+ ## What it does
39
+
40
+ - Location sidebar, breadcrumbs, back/up navigation, and relative path entry.
41
+ - Detailed sortable file list, debounced filename search, paging, and hidden-file toggle.
42
+ - Optional previews for UTF-8 text, CSV/TSV, and small PNG/JPEG/GIF/WebP images.
43
+ - File, folder, or mixed selection; optional multiple selection and suffix filters.
44
+ - Explicit confirmation, returning typed `pathlib.Path` values to Python.
45
+ - Streamlit theme colors, isolated CSS, responsive layout, keyboard controls, and instance-local state.
46
+ - Read-only, shallow directory scans with bounded file reads and clear unavailable/partial states.
47
+
48
+ There are no file mutations, uploads, downloads, recursive search, remote SSH browsing, or extra filesystem HTTP endpoints. A browser connected to a server browses **that server's filesystem**, not the browser user's laptop. Preview contents are sent to the browser.
49
+
50
+ ## Install
51
+
52
+ Requires Python 3.10+ and Streamlit 1.53+. Installing the package does **not** require Node.js: the production frontend is included.
53
+
54
+ Install from PyPI:
55
+
56
+ ```bash
57
+ python -m pip install streamlit-file-explorer
58
+ ```
59
+
60
+ Or install from this checkout:
61
+
62
+ ```bash
63
+ python -m pip install .
64
+ ```
65
+
66
+ Or install a built distribution:
67
+
68
+ ```bash
69
+ python -m pip install dist/streamlit_file_explorer-0.1.0-py3-none-any.whl
70
+ ```
71
+
72
+ Install the current development version directly from GitHub:
73
+
74
+ ```bash
75
+ python -m pip install "git+https://github.com/diliadis/streamlit-file-explorer.git@main"
76
+ ```
77
+
78
+ The GitHub install follows `main`; pin a commit for reproducibility. To pin the initial PyPI release, use `streamlit-file-explorer==0.1.0`.
79
+
80
+ ## Run the demo
81
+
82
+ From this source checkout, after installing the package:
83
+
84
+ ```bash
85
+ streamlit run streamlit_app.py --server.address 127.0.0.1
86
+ ```
87
+
88
+ The demo defaults to bundled example files. To browse your own directories, configure named roots before starting it:
89
+
90
+ ```bash
91
+ export FILE_EXPLORER_ROOTS='{"Projects":"/absolute/path/to/projects","Scratch":"/absolute/path/to/scratch"}'
92
+ streamlit run streamlit_app.py --server.address 127.0.0.1
93
+ ```
94
+
95
+ Use directories visible to the Streamlit process. Missing or unreadable roots produce a recoverable UI error. See the contributor guide for the uv/Node development workflow.
96
+
97
+ ## Use in your app
98
+
99
+ Install the package using one of the available methods above. Use a unique, stable `key` for each explorer.
100
+
101
+ ```python
102
+ from pathlib import Path
103
+ import streamlit as st
104
+ from streamlit_file_explorer import file_explorer
105
+
106
+
107
+ # Replace /path/to/projects with a directory on the Streamlit host.
108
+ @st.fragment
109
+ def choose_input():
110
+ result = file_explorer(
111
+ {"Projects": Path("/path/to/projects")},
112
+ key="input_picker",
113
+ label="Choose input files",
114
+ extensions=[".csv", ".tsv"],
115
+ multiple=True,
116
+ )
117
+ if result.confirmed:
118
+ # Persist accepted values if other parts of your app need them later.
119
+ st.session_state["input_paths"] = result.selection
120
+ if st.session_state.get("input_paths"):
121
+ st.write([str(path) for path in st.session_state["input_paths"]])
122
+
123
+
124
+ choose_input()
125
+ ```
126
+
127
+ Keep result handling inside the fragment. Interactions then rerun only this section. If another part of the page must immediately react to confirmation, call `st.rerun()` after storing the accepted values. A fragment is optional: the component also works with ordinary app reruns. Do not place it inside `st.form`; the explorer requires immediate callbacks.
128
+
129
+ `ExplorerResult` is immutable:
130
+
131
+ | Field | Meaning |
132
+ | --- | --- |
133
+ | `directory: Path` | Current absolute directory on the Streamlit host. |
134
+ | `selection: tuple[Path, ...]` | Highlighted items; highlighting a folder is allowed even in file mode. |
135
+ | `selected_path: Path \| None` | Convenience property: the first selected path, or `None` when nothing is selected. |
136
+ | `confirmed: bool` | True only on the run handling an explicit **Use selection** or **Use this folder** action. Only confirmed values satisfy the configured selection mode. |
137
+ | `error: str \| None` | Recoverable navigation or selection error, also displayed in the component. |
138
+
139
+ Selection is limited to the current folder and clears on navigation. Paths are revalidated at confirmation, but they are references, not open file handles: downstream code must handle files being moved, removed, or replaced later.
140
+
141
+ ### Parameters
142
+
143
+ | Parameter | Default | Purpose |
144
+ | --- | --- | --- |
145
+ | `roots` | required | Mapping of visible location labels to directory paths. |
146
+ | `key` | required | Stable, unique Streamlit component key. |
147
+ | `label` | `"Files"` | Component heading and accessible name. |
148
+ | `environment_label` | `""` | Optional host/location caption. |
149
+ | `selection_mode` | `"file"` | `"file"`, `"directory"`, or `"any"`. |
150
+ | `multiple` | `False` | Enable selection of up to 1,000 items in one directory. |
151
+ | `extensions` | `None` | Case-insensitive suffixes such as `[".csv", ".tar.gz"]`; folders remain visible. |
152
+ | `show_hidden` | `False` | Initial dotfile visibility; user can toggle it. |
153
+ | `preview` | `True` | Initial preview-pane visibility; user can toggle it. |
154
+ | `height` | `420` | File-list height in pixels, 240–500. Toolbar/footer add height; narrow layouts adjust the list. |
155
+ | `page_size` | `100` | Rows sent to the frontend at once, 1–500. |
156
+ | `max_entries` | `10_000` | Entries examined per directory, 1–100,000. Includes hidden entries. |
157
+ | `max_preview_bytes` | `262_144` | File bytes read per preview, 1,024–2,097,152, plus one byte to detect truncation. |
158
+ | `cache_ttl` | `2.0` | Session-local listing lifetime in seconds, 0–60. Refresh bypasses it. |
159
+
160
+ Changing roots or filesystem/selection settings resets that instance's navigation. Changing its label, caption, or height preserves navigation. UI state persists through reruns in the same Streamlit session; it is not stored across new sessions or server restarts.
161
+
162
+ ### Interaction
163
+
164
+ - Click a row to highlight it; double-click a folder, use its chevron, or press Enter to open it.
165
+ - With multiple selection enabled, use checkboxes or Cmd/Ctrl-click to add/remove items.
166
+ - Arrow Up/Down, Home, and End move focus between rows. Space highlights the focused row. Arrow Right opens a folder; Arrow Left goes to its parent.
167
+ - Cmd/Ctrl-F within the component focuses search. Search matches names in the current scanned folder, not file contents or subdirectories.
168
+ - Enter a **relative** path using the path button; an empty path opens the configured root.
169
+
170
+ ## Local and cluster behavior
171
+
172
+ The same Python filesystem adapter runs locally and on a compute node. SLURM supplies an allocation; it is not a filesystem protocol. There is no cluster credential handling in the component. See [the SLURM guide](https://github.com/diliadis/streamlit-file-explorer/blob/main/docs/slurm.md) and [example batch script](https://github.com/diliadis/streamlit-file-explorer/blob/main/examples/launch_slurm.sbatch).
173
+
174
+ Only the current folder is scanned. A short per-session cache reduces repeated metadata operations, and only the current page reaches React. The `max_entries` cap is a **scan limit**, not a directory-wide index: when hit, the UI warns that sorting and search operate on a partial listing. Which entries are scanned first depends on filesystem enumeration order. Raise the limit deliberately or choose a narrower root for large directories.
175
+
176
+ Preview limits are independent: text uses at most 200 lines / 20,000 characters; CSV/TSV uses one header plus 50 data rows, 20 columns, and 300 characters per cell. Large images receive a metadata-only preview. Other binary formats are not decoded. Markup, filenames, and table values are rendered as text.
177
+
178
+ Filesystem calls are synchronous. An unresponsive NFS/Lustre mount can still stall a session despite bounded entry counts; there is no hard I/O timeout. The loading state exposes this, but cannot cancel a blocked kernel read.
179
+
180
+ ## Access model
181
+
182
+ - The Streamlit process's OS identity determines access. Configure roots in trusted application code; do not accept root paths directly from an untrusted browser.
183
+ - On macOS/Linux, traversal uses directory descriptors and `O_NOFOLLOW`. Child symlinks are visible but cannot be opened, including links within the same root. Expose a desired target as its own configured root instead.
184
+ - Roots and their ancestors must be trusted, deployment-controlled directories. OS permissions and your deployment remain the security boundary; the picker does not create filesystem isolation or per-user Unix identities.
185
+ - Hidden-file visibility, suffix filters, and the preview toggle are UI features, not confidentiality controls. Everyone able to access an app instance may browse its configured roots with that process's permissions. A shared service account does not inherit each browser user's permissions.
186
+ - A returned `Path` can change after selection. Apply your app's own access policy and validation when consuming it. Do not use this component as authorization for destructive downstream operations.
187
+ - No root directory is registered as a Streamlit static asset directory. The component serves only its own bundled JS/CSS through the v2 asset manifest.
188
+ - Windows is not a supported target in this release; its path-opening semantics have not been validated.
189
+
190
+ ## Development and release checks
191
+
192
+ Contributors need Node.js 24+ and [uv](https://docs.astral.sh/uv/). Start with `uv sync --frozen` and `npm --prefix streamlit_file_explorer/frontend ci`.
193
+
194
+ ```bash
195
+ uv run pytest
196
+ uv run ruff check .
197
+ uv run ruff format --check .
198
+ uv run mypy
199
+ npm --prefix streamlit_file_explorer/frontend test
200
+ npm --prefix streamlit_file_explorer/frontend run format:check
201
+ npm --prefix streamlit_file_explorer/frontend run build
202
+ uv run python scripts/check_release.py
203
+ uv build
204
+ uv run python scripts/check_distribution.py
205
+ uv run twine check --strict dist/*
206
+ uv run python scripts/smoke_install.py
207
+ ```
208
+
209
+ When changing frontend code, rebuild its assets and commit them **before** building a wheel or sdist. Otherwise, the checked-in production assets are ready to package. The build refuses to create a package if its assets are missing or ambiguous. The resulting wheel contains the compiled assets, component manifest, Python code, and typing marker. Install that wheel into another app environment with `pip install /path/to/streamlit_file_explorer-0.1.0-py3-none-any.whl`. The sdist also contains frontend source and its lockfile so assets can be rebuilt. CI is configured to run the checks on Linux and macOS, verify both artifacts, and install each with pip in a clean environment. The Actions tab reports the status of each pushed commit.
210
+
211
+ For frontend iteration, run `npm --prefix streamlit_file_explorer/frontend run dev` in a second terminal. It rebuilds assets in watch mode. Restart the Streamlit process and reload the browser after a rebuild: registered asset paths can otherwise retain the previous bundle name. No Vite development server is exposed to users.
212
+
213
+ ### Structure
214
+
215
+ - `filesystem.py`: bounded read-only I/O and path validation, independent of UI state.
216
+ - `controller.py`: validated actions, navigation, selection, sorting, pagination, and per-instance listing cache.
217
+ - `component.py`: public typed API, configuration checks, Streamlit callbacks and session state.
218
+ - `frontend/src/`: typed React UI, scoped styles and previews.
219
+ - `tests/`: filesystem, controller, and Streamlit adapter regression tests.
220
+ - `streamlit_app.py`: runnable demo with sample data and a fragment.
221
+
222
+ The template comes from Streamlit's [official v2 React/TypeScript starter](https://github.com/streamlit/component-template/tree/465144fa6764ac1227f299e222ef492262ed70c9/cookiecutter/v2). Component registration follows the [official v2 API](https://docs.streamlit.io/develop/api-reference/custom-components/st.components.v2.component). The interaction concept was inspired by [streamlit-file-browser](https://github.com/pragmatic-streamlit/streamlit-file-browser); this implementation does not depend on or copy that package's code.
223
+
224
+ Licensed under Apache-2.0. See [LICENSE](https://github.com/diliadis/streamlit-file-explorer/blob/main/LICENSE).
225
+
226
+ See the [contributor guide](https://github.com/diliadis/streamlit-file-explorer/blob/main/CONTRIBUTING.md), [changelog](https://github.com/diliadis/streamlit-file-explorer/blob/main/CHANGELOG.md), [release guide](https://github.com/diliadis/streamlit-file-explorer/blob/main/docs/releasing.md), and [security policy](https://github.com/diliadis/streamlit-file-explorer/blob/main/SECURITY.md).