S3-compatible ObjectStorePort adapter for muscles-data
Project description
muscles-data-s3
S3-compatible adapter package for muscles-data.
This package is intentionally separate from muscles-data: the core package
owns typed ports and runtime, while this package owns the boto3-backed
ObjectStorePort adapter.
Related packages
- Core runtime and port contracts:
muscles-data - Elasticsearch search adapter:
muscles-data-elasticsearch - OpenSearch search adapter:
muscles-data-opensearch - Redis key-value/lock/stream adapter:
muscles-data-redis - Qdrant vector adapter:
muscles-data-qdrant - MongoDB document-store adapter:
muscles-data-mongodb - SQLAlchemy direct SQL resource adapter:
muscles-data-sqlalchemy - Executable example:
example_data_s3_1
Install
python -m pip install muscles-data-s3
For local framework development:
PYTHONPATH=../muscles-data/src:src python3 -m pytest -q
Configuration
data:
resources:
objects.docs:
type: s3
endpoint_url: ${S3_ENDPOINT}
bucket: documents
region_name: us-east-1
prefix: raw
max_keys: 100
The adapter also supports standard boto3 credential options:
aws_access_key_id;aws_secret_access_key;aws_session_token;profile_name;- the default boto3 environment/provider chain.
Usage
Register the external factory in the project composition root:
from muscles_data.catalog import DataAdapterCatalog
from muscles_data.config import DataConfig
from muscles_data.ports import ObjectStorePort
from muscles_data.runtime import DataRuntime
from muscles_data_s3 import S3ObjectStoreFactory
catalog = DataAdapterCatalog.with_defaults()
catalog.register(S3ObjectStoreFactory())
runtime = DataRuntime(config=DataConfig.from_raw(config), catalog=catalog)
objects = runtime.require_port("objects.docs", ObjectStorePort)
Then use the narrow port:
objects.put_object("docs/readme.txt", b"hello", content_type="text/plain")
blob = objects.get_object("docs/readme.txt")
items = objects.list_objects(prefix="docs", limit=20)
objects.delete_object("docs/readme.txt")
Backend-specific request options are available without exposing the boto3
client: get_object() accepts range, conditional headers and
version/checksum options; list_objects() accepts delimiter and continuation
helpers; and delete_object() accepts version and retention options.
If prefix: raw is configured, the public key docs/readme.txt is stored as
raw/docs/readme.txt in S3 and returned to port consumers without the configured
prefix. This keeps application code independent from bucket layout details.
Capabilities
S3ObjectStoreFactory provides:
object_store;healthcheck;native_clientonly when the resource declaresnative_client: true.
Native access is an advanced project escape hatch:
from muscles_data import DataCapability
client = runtime.require_resource("objects.docs", DataCapability.NATIVE_CLIENT).native_client()
Use the native client for backend-specific operations such as presigned URLs,
multipart upload configuration, bucket policies or lifecycle rules. Keep normal
blob reads and writes on ObjectStorePort.
Boundaries
This package owns:
- lazy boto3 client creation;
- S3-compatible endpoint and bucket binding;
- object put/get/list/delete;
- key normalization and optional prefix mapping;
- safe
inspect()anddoctor().
It does not own:
- document parsing;
- application storage schemas;
- lifecycle policies;
- multipart/streaming abstractions in the MVP;
- cross-resource transactions.
data.doctor performs head_bucket. data.resources.list and package
initialization do not open an S3 connection.
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 muscles_data_s3-0.1.1.tar.gz.
File metadata
- Download URL: muscles_data_s3-0.1.1.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abc5e0f5a618507693e266dd5048a8a1b37c8150c110837acff96ed00651f101
|
|
| MD5 |
33e8bd1168ea056da37dc9970e77af5b
|
|
| BLAKE2b-256 |
4807d535ae191d481f8aaafb73183ce67323fe7ececb1cbe2fb7545efa6fb017
|
Provenance
The following attestation bundles were made for muscles_data_s3-0.1.1.tar.gz:
Publisher:
release.yml on butkoden/muscles-data-s3
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
muscles_data_s3-0.1.1.tar.gz -
Subject digest:
abc5e0f5a618507693e266dd5048a8a1b37c8150c110837acff96ed00651f101 - Sigstore transparency entry: 2261288542
- Sigstore integration time:
-
Permalink:
butkoden/muscles-data-s3@dedbbf2e471aa6ce4bf0f8730788bede6bd429d8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/butkoden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dedbbf2e471aa6ce4bf0f8730788bede6bd429d8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file muscles_data_s3-0.1.1-py3-none-any.whl.
File metadata
- Download URL: muscles_data_s3-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
907ded0f3d3b66500f4f540a1449249a5f116030489cc9b41afec96022ce699e
|
|
| MD5 |
e7013ef8936b850c3cd2c80592884b34
|
|
| BLAKE2b-256 |
be686945ec2302a2357c6b1e0272b37f2118d1ac4b587b678316b81fa9824860
|
Provenance
The following attestation bundles were made for muscles_data_s3-0.1.1-py3-none-any.whl:
Publisher:
release.yml on butkoden/muscles-data-s3
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
muscles_data_s3-0.1.1-py3-none-any.whl -
Subject digest:
907ded0f3d3b66500f4f540a1449249a5f116030489cc9b41afec96022ce699e - Sigstore transparency entry: 2261288715
- Sigstore integration time:
-
Permalink:
butkoden/muscles-data-s3@dedbbf2e471aa6ce4bf0f8730788bede6bd429d8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/butkoden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dedbbf2e471aa6ce4bf0f8730788bede6bd429d8 -
Trigger Event:
release
-
Statement type: