MinIO storage adapter for SwarmauriSDK
Project description
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
prefixargument to scope uploads without changing your keys. - Implements
upload,download,upload_dir,download_dir, anditer_prefixhelpers for working with single files or directories. - Exposes a
root_uridescribing the bucket and prefix (minio[s]://endpoint/bucket/prefix/). MinioStorageAdapter.from_uri()reads credentials fromMINIO_ACCESS_KEYandMINIO_SECRET_KEYenvironment 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_storage_minio-0.2.1.dev1.tar.gz.
File metadata
- Download URL: swarmauri_storage_minio-0.2.1.dev1.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
198056584892949476e4a993b2603c22e20b1484b0ba37cf6f0f38aca6c83f44
|
|
| MD5 |
f11cb5ae203efa1e0b39d713b0976dc2
|
|
| BLAKE2b-256 |
376143dadda844c2270758f23ffe76c16cf1c64d4c2fb197e3b67fc3c3db1781
|
File details
Details for the file swarmauri_storage_minio-0.2.1.dev1-py3-none-any.whl.
File metadata
- Download URL: swarmauri_storage_minio-0.2.1.dev1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c880b1ae79a88ab23477c5f2ea7ea08b5ba5803fa3b854bc179ec779d11b9b0
|
|
| MD5 |
60f10d41797ae626e59140c3970e5707
|
|
| BLAKE2b-256 |
7071a9a71767f37195d86c319d6b0801f164085fc551ad43ef10df4f73222373
|