|
1 | | -# s3-explorer |
| 1 | +# S3 Explorer |
2 | 2 |
|
3 | | -## Setup |
4 | | -Install `uv`: https://docs.astral.sh/uv/getting-started/installation/ |
| 3 | +A Streamlit-based web application for exploring S3-compatible storage buckets and previewing their contents. |
5 | 4 |
|
6 | | -```bash |
7 | | -git init |
8 | | -uv sync --dev |
9 | | -git add . |
10 | | -git commit -m "Initial commit" |
11 | | -uv run pre-commit install # optional |
12 | | -``` |
| 5 | +## Features |
13 | 6 |
|
| 7 | +- **Browse S3 Buckets**: Select from configured buckets and view all objects with path, size, and last modified date |
| 8 | +- **Search**: Filter objects by path with case-insensitive search |
| 9 | +- **File Preview**: |
| 10 | + - **Images**: Preview PNG, JPG, JPEG, GIF, WebP, and SVG files |
| 11 | + - **GeoParquet**: Visualize geospatial data on an interactive Folium map (first 2000 features) |
| 12 | + - **Parquet**: Display tabular data |
| 13 | + - **Text files**: Syntax-highlighted preview for TXT, MD, JSON, YAML, CSV, and XML |
| 14 | + - **Other files**: Download button for unsupported formats |
| 15 | +- **Anonymous Access**: Supports S3 buckets without authentication |
| 16 | +- **Cache Management**: Refresh bucket contents with a single click |
14 | 17 |
|
15 | | -### Run |
16 | | -To execute your software you have two options: |
| 18 | +## Setup |
17 | 19 |
|
18 | | -**Option 1: Direct execution** |
19 | | -```bash |
20 | | -uv run main.py |
21 | | -``` |
| 20 | +Install [uv](https://docs.astral.sh/uv/getting-started/installation/), then: |
22 | 21 |
|
23 | | -**Option 2: Run as installed package** |
24 | 22 | ```bash |
25 | | -uvx --from . s3-explorer |
| 23 | +uv sync |
26 | 24 | ``` |
27 | 25 |
|
28 | | -### Development |
29 | | -Just run `uv run main.py` and you are good to go! |
| 26 | +## Configuration |
30 | 27 |
|
31 | | -### Update from template |
32 | | -To update your project with the latest changes from the template, run: |
33 | | -```bash |
34 | | -uvx --with copier-template-extensions copier update --trust |
35 | | -``` |
| 28 | +Copy the example config and edit it: |
36 | 29 |
|
37 | | -You can keep your previous answers by using: |
38 | 30 | ```bash |
39 | | -uvx --with copier-template-extensions copier update --trust --defaults |
| 31 | +cp config.example.yaml config.yaml |
40 | 32 | ``` |
41 | 33 |
|
42 | | -### (Optional) pre-commit |
43 | | -pre-commit is a set of tools that help you ensure code quality. It runs every time you make a commit. |
| 34 | +Configure your buckets in `config.yaml`: |
44 | 35 |
|
45 | | -First, install pre-commit: |
46 | | -```bash |
47 | | -uv tool install pre-commit |
| 36 | +```yaml |
| 37 | +buckets: |
| 38 | + my-bucket: |
| 39 | + endpoint: https://s3.amazonaws.com |
| 40 | + bucket: actual-bucket-name # optional, defaults to the key name |
| 41 | + access_key: your-access-key # optional, omit for anonymous access |
| 42 | + secret_key: your-secret-key |
48 | 43 | ``` |
49 | 44 |
|
50 | | -Then install pre-commit hooks: |
51 | | -```bash |
52 | | -pre-commit install |
53 | | -``` |
| 45 | +You can also set the config path via environment variable: |
54 | 46 |
|
55 | | -To run pre-commit on all files: |
56 | 47 | ```bash |
57 | | -pre-commit run --all-files |
| 48 | +export S3_EXPLORER_CONFIG=/path/to/config.yaml |
58 | 49 | ``` |
59 | 50 |
|
60 | | -### How to install a package |
61 | | -Run `uv add <package-name>` to install a package. For example: |
| 51 | +## Run |
| 52 | + |
62 | 53 | ```bash |
63 | | -uv add requests |
| 54 | +uv run streamlit run app.py |
64 | 55 | ``` |
65 | 56 |
|
66 | | -#### Visual studio code |
67 | | -If you are using visual studio code install the recommended extensions |
| 57 | +Then open http://localhost:8501 in your browser. |
68 | 58 |
|
| 59 | +## Docker |
69 | 60 |
|
70 | | -### Tools installed |
71 | | -- uv |
72 | | -- pre-commit (optional) |
73 | | - |
74 | | -#### What is an environment variable? and why should I use them? |
75 | | -Environment variables are variables that are not populated in your code but rather in the environment |
76 | | -that you are running your code. This is extremely useful mainly for two reasons: |
77 | | -- security, you can share your code without sharing your passwords/credentials |
78 | | -- portability, you can avoid using hard-coded values like file-system paths or folder names |
79 | | - |
80 | | -you can place your environment variables in a file called `.env`, the `main.py` will read from it. Remember to: |
81 | | -- NEVER commit your `.env` |
82 | | -- Keep a `.env.example` file updated with the variables that the software expects |
| 61 | +Build and run with Docker: |
| 62 | +```bash |
| 63 | +docker compose up |
| 64 | +``` |
0 commit comments