Skip to main content

Unified Python SDK for cloud object/blob storage

Project description

files-sdk

Unified Python SDK for cloud object/blob storage. Python port of files-sdk.dev.

One API, swap the adapter to change backend. v0 ships R2, S3, and Local adapters; 15 cloud providers scaffolded for contributors.

uv add files-sdk
uv add files-sdk-local             # zero deps, ideal for dev/test
uv add files-sdk-s3                # Amazon S3 (sync + async)
uv add files-sdk-r2                # Cloudflare R2 (sync + async)

pip install ... works too if you're not on uv yet. Get uv: curl -LsSf https://astral.sh/uv/install.sh | sh.

Quickstart — no credentials (Local)

from files_sdk import Files
from files_sdk_local import LocalAdapter

files = Files(adapter=LocalAdapter(root="/tmp/my-store"))
files.upload("hello.txt", b"hi")
print(files.download("hello.txt").text())

Quickstart — Cloudflare R2

from files_sdk import Files
from files_sdk_r2 import R2Adapter

# Reads R2_ACCOUNT_ID, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY from env
files = Files(adapter=R2Adapter(bucket="my-bucket"))
files.upload("hello.txt", b"hi")

Quickstart — Amazon S3

from files_sdk import Files
from files_sdk_s3 import S3Adapter

# Reads standard AWS env: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION
files = Files(adapter=S3Adapter(bucket="my-bucket"))

Async equivalent

from files_sdk import AsyncFiles
from files_sdk_s3 import AsyncS3Adapter

afiles = AsyncFiles(adapter=AsyncS3Adapter(bucket="my-bucket"))
await afiles.upload("hello.txt", b"hi")

Adapter lookup by name

files = Files.from_name("local", root="/tmp/my-store")
files = Files.from_name("s3", bucket="my-bucket")

API

Method Purpose
files.upload(key, body, *, content_type=None, metadata=None, cache_control=None) Store an object. body is bytes, str, Path, or a file-like.
files.download(key) Return a StoredFile (fully buffered).
files.stream(key, *, chunk_size=65536) Yield chunks (memory-bounded).
files.head(key) Return FileMetadata without the body.
files.delete(key) Remove an object. Idempotent (no error on missing).
files.list(*, prefix=None, cursor=None, limit=1000) Paginated listing. Returns ListPage.
files.copy(src, dst) Server-side copy.
files.url(key, *, expires_in=3600, public=False) Signed or public URL.
files.signed_upload_url(key, *, method="put"|"post", expires_in=3600, ...) Browser-direct upload contract.
files.raw Escape hatch — provider-native client.

Errors raise FilesError with code in {"not_found", "unauthorized", "conflict", "provider", "invalid_input"} and the original exception preserved via __cause__.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

files_sdk-0.1.0a1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

files_sdk-0.1.0a1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file files_sdk-0.1.0a1.tar.gz.

File metadata

  • Download URL: files_sdk-0.1.0a1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for files_sdk-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 ae48bb02e3da2e4e601532f8869796c9d324688517c19f15592941a5f6eac229
MD5 946ed5dc2b9c908795b932fad659390a
BLAKE2b-256 de5347be5892666371fef2149e8bfeeda728b2203f3184408c2cf02d9c90c852

See more details on using hashes here.

File details

Details for the file files_sdk-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: files_sdk-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for files_sdk-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 70299e77e2672a12b4aa04a3ff5b2fe66c362c6124e12febc53ce12a8178f763
MD5 40fbd826afe34f1e26adb07ab9376098
BLAKE2b-256 20d95789f75b7a40b2c85a3e43c7aad83a44ef8f9b5f31bd5284bb21a148898a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page