Skip to main content

Python SDK for Wasabi Cloud Storage

Project description

wasabi-s3-sdk

A Python SDK for managing Wasabi Cloud Storage resources. Wraps Wasabi's S3-compatible and IAM APIs into a friendly interface for managing buckets, users, groups, and policies.

Installation

pip install wasabi-s3-sdk

Requires Python 3.10+.

Configuration

Set your Wasabi credentials as environment variables:

export WASABI_ACCESS_KEY="your-access-key"
export WASABI_SECRET_KEY="your-secret-key"

Request Timeout

The SDK sets a default request timeout of 60 seconds, which is sufficient for most use cases. However, operations on large buckets containing many objects can take significantly longer. The Client class accepts an optional request_timeout parameter to adjust the timeout in seconds:

from wasabi_s3 import Client

client = Client(request_timeout=120)

Quick Start

Buckets

from wasabi_s3 import Bucket

# Create a bucket in us-east-1 (default)
bucket = Bucket("my-bucket")
bucket.create_bucket()

# Create a bucket in a specific region
bucket = Bucket("my-bucket", region="eu-central-1")

# Manage versioning
bucket.set_versioning(True)
print(bucket.get_versioning())  # True

# Set a lifecycle rule
bucket.set_lifecycle({"Rules": [{"Status": "Enabled", "Prefix": "", "Expiration": {"Days": 90}}]})

# Get bucket properties
print(bucket.to_dict())

# Delete (even if not empty)
bucket.force_delete_bucket()

Users

from wasabi_s3 import User

user = User("jimbob")
user.create_user()

# API key management
key = user.create_api_key()  # Returns {key_id: {secret-key, status}}
user.disable_api_key("AKIA...")
user.enable_api_key("AKIA...")
user.delete_api_key("AKIA...")

# List groups the user belongs to
groups = user.list_groups()

print(user.to_dict())

Groups

from wasabi_s3 import Group

group = Group("developers")
group.create_group()

# Membership
group.add_member("jimbob")
group.remove_member("jimbob")

# Attach a managed policy
group.attach_managed_policy("arn:aws:iam::123456789012:policy/dev-policy")

# Inline policies
group.put_inline_group_policy({
    "Version": "2012-10-17",
    "Statement": [{"Sid": "AllowS3", "Effect": "Allow", "Action": "s3:*", "Resource": "*"}]
})

print(group.to_dict())

Policies

from wasabi_s3 import Policy

policy = Policy("dev-policy")
policy.create_policy({
    "Version": "2012-10-17",
    "Statement": [{
        "Sid": "dev-policy",
        "Effect": "Allow",
        "Action": ["s3:GetObject", "s3:PutObject"],
        "Resource": ["arn:aws:s3:::my-bucket/*"]
    }]
})

# Update creates a new version
policy.update_policy({...})

# List and manage versions
policy.list_versions()
policy.delete_version("v1")

# Clean up
policy.detach_from_all()
policy.delete_policy()

Schema Reference

Each resource class has a to_dict() method that returns a dictionary of its properties. See SCHEMA.md for the full schema documentation.

Development

# Install dev dependencies
uv sync --extra dev

# Run tests
uv run pytest

# Run tests with coverage
uv run pytest --cov=wasabi_s3 --cov-report=term-missing

# Lint
uv run ruff check src/ tests/

# Type check
uv run mypy src/

License

LGPL-2.1-or-later

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

wasabi_s3_sdk-1.0.1.tar.gz (43.7 kB view details)

Uploaded Source

Built Distribution

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

wasabi_s3_sdk-1.0.1-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file wasabi_s3_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: wasabi_s3_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 43.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wasabi_s3_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 033171414873d9c70024e2d68bc6a902f829fb72598402285fddae5e45e2d321
MD5 fe6dcfa691b9f993c859a07f72a080f3
BLAKE2b-256 82b3f4c657db5613a74b1a437386e7ecca97dbb8150ad3c31b7d4e8d876eea73

See more details on using hashes here.

Provenance

The following attestation bundles were made for wasabi_s3_sdk-1.0.1.tar.gz:

Publisher: publish.yml on av8rgeek/wasabi-s3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wasabi_s3_sdk-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: wasabi_s3_sdk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wasabi_s3_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bcc5f135b24a856f6e417ee2f267533d48bf5c37cce3cc17d51fdb38b597c3a7
MD5 05653f3d83070d2ace0e6bde0709c142
BLAKE2b-256 7edbada71984483010bfdc7175236d8154f3b5a25ab054b2170960f6f915ba60

See more details on using hashes here.

Provenance

The following attestation bundles were made for wasabi_s3_sdk-1.0.1-py3-none-any.whl:

Publisher: publish.yml on av8rgeek/wasabi-s3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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