Skip to main content

s3dol

s3 (through boto3) with a simple (dict-like or list-like) interface

To install: pip install s3dol

Documentation

Quick start

import s3dol

s = s3dol.s3_store("my-bucket")  # MutableMapping[str, bytes]
s["hello.txt"] = b"world"
s["hello.txt"]  # b'world'
list(s)
"hello.txt" in s
del s["hello.txt"]

s = s3dol.s3_store("my-bucket", prefix="logs/")  # scoped to a prefix
s = s3dol.s3_store("open-data", anon=True)  # public bucket, no credentials
s = s3dol.s3_store("b", preset="minio", endpoint_url="http://localhost:9000")

Starting from nothing (the default never creates a bucket from a typo):

s = s3dol.s3_store("brand-new-bucket", on_missing_bucket="create")

Big objects go through the same interface — no upload_multipart method:

s["video.mp4"] = s3dol.Filepath("/tmp/video.mp4")  # streamed, multipart above 8 MiB
s["stream.bin"] = s3dol.Chunks(chunk_iterator)  # never fully in memory

Keyed capabilities are stores you index, not methods (a dol key wrapper hands a method the unmapped key — so s3dol has none):

s3dol.handles(s)["video.mp4"].read(offset=0, length=1024)  # ranged read
s3dol.handles(s)["video.mp4"].url(expires_in=3600)  # presigned URL
s3dol.urls(s)["video.mp4"]  # ...or directly
s3dol.info(s)["video.mp4"].size  # one HeadObject

Everything else is a free function taking the store first:

s3dol.sub(s, "folder/")
s3dol.prefixes(s)
s3dol.delete_many(s, ["a", "b"])
s3dol.delete_bucket(endpoint, "name", force=True)

Test without a cloud — no network, no docker, no moto:

from s3dol.testing import mock_s3, run_conformance


def test_my_service():
    assert MediaService(mock_s3(data={"a.mp4": b"..."})).play("a.mp4")

run_conformance(make_store) is exported too: run the same laws against your own store (or a sibling *dol package's).

Heads-up: v1 is coming — run s3dol.diagnose() now

A major, behaviour-clarifying v1 is in progress (design: misc/docs/architecture.md and the ADRs in misc/docs/decisions/). Today's S3Store will keep working through a compatibility shim, but a few v0 behaviours were bugs (e.g. an explicit endpoint_url= being silently dropped whenever AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY are exported) and v1 fixes them — which can move where your data goes.

Before upgrading to v1, run the diagnosis with the same arguments you pass S3Store today, in the environment you deploy in:

import s3dol

s3dol.diagnose(bucket_name="my-bucket", endpoint_url="...", path="...")

It prints what resolves (endpoint, region, signing, credential source — never a secret), where each value came from, and a v0-vs-v1 divergence table telling you whether the upgrade changes anything for your call. It never raises; a failing resolution is part of the report.

Set up credentials

Recommended prerequisite to make getting started easier but not required.

Option 1: Environment Variables

export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_DEFAULT_REGION=us-west-2

Option 2: Configure Default Profile in Credentials File

Add credentails in ~/.aws/credentials

[default]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

Option 3: Configure Default Profile with AWS CLI

Install AWS CLI

brew instal awscli

Set credentails with CLI

aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]:

Metadata

Release files for s3dol 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for s3dol 1.0.6
File Size Uploaded Provenance Actions
s3dol-1.0.6.tar.gz 185.9 kB Without provenance Details for s3dol-1.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for s3dol 1.0.6
File Interpreter ABI Platform Actions
s3dol-1.0.6-py3-none-any.whl Python 3 none any Details for s3dol-1.0.6-py3-none-any.whl

Total release size: 303.2 kB

Release files / s3dol-1.0.6.tar.gz

Download URL s3dol-1.0.6.tar.gz
Size 185.9 kB
Tags Source
SHA-256 checksum
How to use checksums
58158ed2d5684563dee724cae2ff2f480130c7a0d1e7f70592cba590acc148ee
BLAKE2b-256 checksum
How to use checksums
6af55b2ba77ce7a6c1c85026f4fb8a4fed39abf9af61eb43fe9c5f9f34ce9c99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / s3dol-1.0.6-py3-none-any.whl

Download URL s3dol-1.0.6-py3-none-any.whl
Size 117.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb10e3433d420447e5da3888f2c473ebcd75e1f5ca76532d5c1837b8288b0095
BLAKE2b-256 checksum
How to use checksums
c2dbad1c31d17a8ec8c15622b92b17492a89cbf2d9d85e8bbc134b1dd5cdc66b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for s3dol 1.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page