datasette-files S3 backend
Project description
datasette-files-s3
S3 storage backend for datasette-files.
Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-files-s3
Usage
Configure a datasette-files source to use S3 storage by setting "storage": "s3" and providing the required configuration options:
plugins:
datasette-files:
sources:
my-s3-files:
storage: s3
config:
bucket: my-bucket-name
region: us-east-1
access_key_id: AKIAIOSFODNN7EXAMPLE
secret_access_key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Or using Datasette's -s flag:
datasette data.db \
-s plugins.datasette-files.sources.my-s3-files.storage s3 \
-s plugins.datasette-files.sources.my-s3-files.config.bucket my-bucket-name \
-s plugins.datasette-files.sources.my-s3-files.config.region us-east-1
Configuration options
- bucket (required): The name of the S3 bucket.
- region (optional, default
us-east-1): The AWS region. - prefix (optional): A prefix to add to all S3 object keys. This allows you to store files under a specific path within the bucket. A trailing slash will be added automatically if not provided -
"uploads"and"uploads/"are equivalent. - endpoint_url (optional): A custom S3 endpoint URL, for use with S3-compatible services.
- access_key_id (optional): AWS access key ID.
- secret_access_key (optional): AWS secret access key.
Authentication
The plugin resolves AWS credentials using the following priority:
- Direct configuration:
access_key_idandsecret_access_keyin the config block. - datasette-secrets: If datasette-secrets is installed, the plugin will look for
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYsecrets. - Default AWS credential chain: If no credentials are provided through the above methods, the plugin falls back to the default AWS credential chain (environment variables, IAM roles, etc.).
Prefix
The prefix option lets you scope all files to a specific path within the bucket. For example, with prefix: "uploads/", a file uploaded as photo.jpg will be stored at the S3 key uploads/photo.jpg.
It does not matter whether you include a trailing slash or not - "uploads" and "uploads/" will both result in files stored under uploads/.
Development
To set up this plugin locally, first checkout the code.
cd datasette-files-s3
Run tests like this:
uv run pytest
You can use SeaweedFS to run a local development server against a local imitation of the S3 API:
brew install seaweedfs
./dev-server.sh
To run a local development server against a real S3 bucket, create a dev-s3.sh script (this file is in .gitignore):
#!/bin/bash
set -e
BUCKET="your-bucket-name"
REGION="us-east-1"
ACCESS_KEY="your-access-key-id"
SECRET_KEY="your-secret-access-key"
uv run datasette data.db --create --internal internal.db --root --secret 1 --reload \
-s plugins.datasette-files.sources.s3-live.storage s3 \
-s plugins.datasette-files.sources.s3-live.config.bucket "$BUCKET" \
-s plugins.datasette-files.sources.s3-live.config.region "$REGION" \
-s plugins.datasette-files.sources.s3-live.config.access_key_id "$ACCESS_KEY" \
-s plugins.datasette-files.sources.s3-live.config.secret_access_key "$SECRET_KEY" \
-s plugins.datasette-files.sources.s3-live.config.prefix "demo-prefix/" \
-s permissions.files-browse true \
-s permissions.files-upload true \
-s permissions.files-edit true
Then run it with bash dev-s3.sh and follow the login token URL printed to the console.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datasette_files_s3-0.1a0.tar.gz.
File metadata
- Download URL: datasette_files_s3-0.1a0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05e42c69076e49cd00d2e9d4e9a05d8ad99a66fb6aa0677940b75138f6593d75
|
|
| MD5 |
d78cf6e1c8846421db8c05ac30982ef2
|
|
| BLAKE2b-256 |
a58d971cbc5c3df9e0be3debd420983a40032b681cefbaaa07c544bc3d413bbe
|
Provenance
The following attestation bundles were made for datasette_files_s3-0.1a0.tar.gz:
Publisher:
publish.yml on datasette/datasette-files-s3
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datasette_files_s3-0.1a0.tar.gz -
Subject digest:
05e42c69076e49cd00d2e9d4e9a05d8ad99a66fb6aa0677940b75138f6593d75 - Sigstore transparency entry: 971991571
- Sigstore integration time:
-
Permalink:
datasette/datasette-files-s3@0c3bbbeaa6b5e7fc2d6002d708cd5021cbe39bfb -
Branch / Tag:
refs/tags/0.1a0 - Owner: https://github.com/datasette
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0c3bbbeaa6b5e7fc2d6002d708cd5021cbe39bfb -
Trigger Event:
release
-
Statement type:
File details
Details for the file datasette_files_s3-0.1a0-py3-none-any.whl.
File metadata
- Download URL: datasette_files_s3-0.1a0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d05edfd69627295f88638b76638b6e8970511f4aefbc56d5039377ba478079b
|
|
| MD5 |
4c1b2b5cd7c4ce308005a01a03e300d1
|
|
| BLAKE2b-256 |
835da054e367bf42d43080bff753566cfad53f000d042477cbbbb894d52bcf46
|
Provenance
The following attestation bundles were made for datasette_files_s3-0.1a0-py3-none-any.whl:
Publisher:
publish.yml on datasette/datasette-files-s3
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datasette_files_s3-0.1a0-py3-none-any.whl -
Subject digest:
6d05edfd69627295f88638b76638b6e8970511f4aefbc56d5039377ba478079b - Sigstore transparency entry: 971991603
- Sigstore integration time:
-
Permalink:
datasette/datasette-files-s3@0c3bbbeaa6b5e7fc2d6002d708cd5021cbe39bfb -
Branch / Tag:
refs/tags/0.1a0 - Owner: https://github.com/datasette
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0c3bbbeaa6b5e7fc2d6002d708cd5021cbe39bfb -
Trigger Event:
release
-
Statement type: