Skip to main content

Python SDK for Wasabi Cloud Storage

Project description

wasabi-s3

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"

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-0.1.1.tar.gz (37.4 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-0.1.1-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wasabi_s3_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 37.4 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-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fbcb385a9abb26ec123d4a2e1f1b6aa523b02689e256235b91f81a68fc7f7ccd
MD5 44c478d1609ca59dc8085424162df12d
BLAKE2b-256 4280a763d5f63a7050041fcb17481d8dbbe14be193abfecc04548a4eaee09c37

See more details on using hashes here.

Provenance

The following attestation bundles were made for wasabi_s3_sdk-0.1.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-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: wasabi_s3_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.1 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-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60d12dccd3e2eca81cffe6b48cb1e75adc35ee2b3f722eedf5a055e44d8c6307
MD5 65a273dc62b7e04be6bd8c969f012bf3
BLAKE2b-256 5488637bfeecdd12149253e605a2d90d4072bac1ec35e33ca1c1787b8163eb2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for wasabi_s3_sdk-0.1.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