LocalBucket
LocalBucket is a minimal S3-compatible HTTP server that stores buckets as folders on a local directory. It is a single Python script for Python 3.10 and newer, with no dependencies beyond the standard library, meant for local development and testing against S3 clients such as boto3 and the AWS CLI.
Each bucket is a folder under the data directory and each object is a regular file, so you can inspect and change the stored data with ordinary file tools.
Installation
uv tool install localbucket # or: pipx install localbucket
You can also run it without installing, with uvx localbucket ./data, or
copy localbucket.py anywhere and run it with python3 localbucket.py.
Usage
localbucket ./data
This serves ./data on http://127.0.0.1:9000. Use --host and --port
to change the address.
Point a client at the server with path-style addressing. Credentials are not checked, so any access key and secret will do:
aws --endpoint-url http://127.0.0.1:9000 s3 mb s3://mybucket
aws --endpoint-url http://127.0.0.1:9000 s3 cp file.txt s3://mybucket/
import boto3
from botocore.config import Config
s3 = boto3.client(
"s3",
endpoint_url="http://127.0.0.1:9000",
aws_access_key_id="test",
aws_secret_access_key="test",
region_name="us-east-1",
config=Config(s3={"addressing_style": "path"}),
)
Supported operations
- Buckets: ListBuckets, CreateBucket, HeadBucket, and DeleteBucket (empty buckets only)
- Objects: ListObjects, ListObjectsV2, PutObject (including
If-None-Match: *), GetObject and HeadObject (includingRangeandresponse-*header overrides such asresponse-content-disposition), CopyObject, DeleteObject - Multipart uploads: CreateMultipartUpload, UploadPart, UploadPartCopy, CompleteMultipartUpload, AbortMultipartUpload
- GetObjectTagging, which always returns an empty tag set because tags are not stored
Requests with any other query parameter, such as ACL or tagging changes,
return 501 NotImplemented and do not change anything. Virtual-hosted-style
URLs, authentication and versioning are not supported. Object metadata is
not stored either: Content-Type is guessed from the key's file extension.
Unfinished multipart uploads are kept in DATA_ROOT/.localbucket-uploads.
CORS is open: requests from any origin are allowed, including OPTIONS
preflights, so browser code on your development site can call LocalBucket
directly. Any web page you open can also read from it while it runs, so
keep it on 127.0.0.1 and don't store anything sensitive in it.
Testing
The test suite starts LocalBucket on a temporary directory and checks its behaviour with boto3. It is a uv script that declares its own dependencies:
uv run test_localbucket.py
Metadata
Release files for localbucket 1.2.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 | |
|---|---|---|---|
| localbucket-1.2.1.tar.gz | 20.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| localbucket-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.7 kB
Release files / localbucket-1.2.1.tar.gz
| Download URL | localbucket-1.2.1.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37e5400e346eff3ea1320865e20648b929c0c6bd5c1b26bce69e53cdb4ab21f4
|
|
BLAKE2b-256 checksum How to use checksums |
40bdfc95a71398116d03479e9db088b634aa47d0da5e0b4ba9b9b384f1bf00f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.12
|
Release files / localbucket-1.2.1-py3-none-any.whl
| Download URL | localbucket-1.2.1-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
452278528f7e3957f72d77a75b146dd0b83af1da9cd1f7c233d54724d264af3f
|
|
BLAKE2b-256 checksum How to use checksums |
93deb13bac24c9bb6b5fcc9d5cf617313fae1c134abf86681260bf4f8f734493
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.12
|