Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Swarmauri Logo

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

Swarmauri File Storage Adapter

Filesystem-based storage adapter for Peagen that stores binary artifacts on the local disk.

Features

  • Resolves and prepares the configured output_dir on instantiation so uploads can run without additional filesystem setup.
  • Supports an optional prefix to scope all keys inside a nested directory tree while keeping the same adapter instance.
  • upload writes files atomically by copying into a temporary file before an atomic rename, ensuring partially written data is never observed.
  • download returns a :class:io.BytesIO handle positioned at the start of the stored content for immediate consumption by downstream tooling.
  • Convenience helpers such as upload_dir, download_dir, iter_prefix and from_uri mirror the behavior of :class:pathlib.Path operations and make it easy to bulk transfer artifacts.
  • root_uri exposes the workspace as a file:// URI which is used when constructing the URIs returned by upload.

Installation

Install the package with your preferred Python packaging tool:

pip install swarmauri_storage_file
poetry add swarmauri_storage_file
uv pip install swarmauri_storage_file

Usage

from pathlib import Path
import io

from swarmauri_storage_file import FileStorageAdapter

workspace = Path("./artifacts").resolve()
adapter = FileStorageAdapter(output_dir=workspace)

root_uri = adapter.root_uri
print("Root URI:", root_uri)

uri = adapter.upload("example.txt", io.BytesIO(b"hello world"))
print("Stored at:", uri)

downloaded = adapter.download("example.txt").read().decode("utf-8")
print("Contents:", downloaded)

keys = list(adapter.iter_prefix(""))
print("Keys:", keys)

The snippet above resolves a local workspace, uploads an artifact, reads it back as text and inspects the stored keys. URIs returned by upload reuse root_uri (with the relative key appended) so they can be dereferenced by tools that understand file:// locations.

Additional helpers

  • upload_dir recursively walks a source directory and stores each file under an optional destination prefix.
  • download_dir materializes a stored prefix into a destination directory, recreating any nested structure.
  • iter_prefix yields keys rooted at output_dir (including any configured prefix) which is useful for inventory or cleanup tasks.
  • from_uri rebuilds an adapter from a file:// URI previously emitted by root_uri or upload.

Want to help?

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

Metadata

Release files for swarmauri_storage_file 0.11.0.dev1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swarmauri_storage_file 0.11.0.dev1
File Size Uploaded
swarmauri_storage_file-0.11.0.dev1.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for swarmauri_storage_file 0.11.0.dev1
File Interpreter ABI Platform
swarmauri_storage_file-0.11.0.dev1-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / swarmauri_storage_file-0.11.0.dev1.tar.gz

Download URL swarmauri_storage_file-0.11.0.dev1.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b4527b5383e0177ac2f46b742a452cbefa7a89688626ffa2233f5af333b1b3db
BLAKE2b-256 checksum
How to use checksums
24c74a4a284e1ce765588e39a7ac76488dca620e14173ee67114411a8ffc264d
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / swarmauri_storage_file-0.11.0.dev1-py3-none-any.whl

Download URL swarmauri_storage_file-0.11.0.dev1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e854bec991769deb67dec758f6b1f58607db79271760f47b672334c4f28bbe89
BLAKE2b-256 checksum
How to use checksums
c7222cf3fd10086725f938af18f3ca6f912b81bdb3f5cd28a91e9e29dce0e60f
Upload date
Uploaded using Trusted Publishing?
What is 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}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page