Skip to main content

MinIO storage adapter for SwarmauriSDK

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_storage_minio Discord

Swarmauri MinIO Storage Adapter

Peagen storage adapter that saves artifacts to a MinIO or any S3-compatible bucket using the official minio Python client.

Features

  • Automatically creates the target bucket if it does not already exist.
  • Optional prefix argument to scope uploads without changing your keys.
  • Implements upload, download, upload_dir, download_dir, and iter_prefix helpers for working with single files or directories.
  • Adds upload_memoryview, download_memoryview, upload_mmap, and open_mmap helpers for zero-copy byte workflows.
  • Exposes a root_uri describing the bucket and prefix (minio[s]://endpoint/bucket/prefix/).
  • MinioStorageAdapter.from_uri() reads credentials from MINIO_ACCESS_KEY and MINIO_SECRET_KEY environment variables for zero-copy configuration.

Installation

Using uv

uv add swarmauri_storage_minio
# or install into an existing environment
uv pip install swarmauri_storage_minio

Using Poetry

poetry add swarmauri_storage_minio

Using pip

pip install swarmauri_storage_minio

Usage

The adapter wraps a MinIO client instance. When you instantiate it, the bucket is created if it does not already exist. Use the secure flag for HTTPS endpoints (True by default) and supply a prefix when you want to namespace all uploads under a directory.

from swarmauri_storage_minio import MinioStorageAdapter
import io

adapter = MinioStorageAdapter(
    endpoint="localhost:9000",
    access_key="minio",
    secret_key="minio123",
    bucket="peagen",
    secure=False,
    prefix="examples/",
)
uri = adapter.upload("artifact.txt", io.BytesIO(b"data"))
print(uri)

downloaded = adapter.download("artifact.txt").read()
print(downloaded.decode("utf-8"))

Note: If you store credentials as SecretStr, call .get_secret_value() when passing them to the adapter.

Config-driven instantiation

The adapter can also be created from a URI. Credentials are loaded from environment variables.

from swarmauri_storage_minio import MinioStorageAdapter

adapter = MinioStorageAdapter.from_uri("minio://localhost:9000/peagen/examples/")
print(adapter.root_uri)

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

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

swarmauri_storage_minio-0.11.0.dev1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

swarmauri_storage_minio-0.11.0.dev1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_storage_minio-0.11.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_storage_minio-0.11.0.dev1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_storage_minio-0.11.0.dev1.tar.gz
Algorithm Hash digest
SHA256 cb896afb7c4302360a64b8c937df6f98295587233cd45111772161a91dfdd309
MD5 9c0517c17d144b65651892094bf70213
BLAKE2b-256 dd9815c3477187101e8b96139a33e443682912e49c41c1f3e0c30c30fb57038e

See more details on using hashes here.

File details

Details for the file swarmauri_storage_minio-0.11.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_storage_minio-0.11.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_storage_minio-0.11.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 0713f1ea8b551447092e2eaefca1b62ecdd1a29907fb0333eb156f29757f180e
MD5 ac7b1c920e25f3efd012da93b471c4b7
BLAKE2b-256 036b5aaa875bffb5a35e3e8b1ae739e71e380d35e542f89a9c833395c1f4969c

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