Unified object storage client API
Project description
Object Storage Client
A unified object storage client for Rust and Python, supporting S3, GCS, Azure Blob Storage, HTTP/HTTPS, and Local Filesystem. It provides a simple, URL-based API for object operations, including cross-provider copy and move.
Features
- Unified API: Single interface for various storage backends.
- Cross-Provider: Copy or move objects between different storage providers (e.g., S3 to Local FS).
- Pre-signed URLs: Generate time-limited, credential-free URLs for S3, GCS and Azure.
- Multi-Language: Native Rust library with Python 3.13+ bindings.
- Streaming: Async streaming support for both Rust and Python.
- CLI:
osccommand-line tool for quick operations.
Supported Schemes
s3://bucket/path(AWS S3)gs://bucket/pathorgcs://bucket/path(Google Cloud Storage)az://,wasb://,wasbs://,abfs://, orabfss://(Azure Blob Storage)http://host/pathorhttps://host/path(HTTP/HTTPS)file:///absolute/pathorlocal_path(Local Filesystem)
CLI Usage (osc)
The osc tool allows you to interact with object storage directly from your terminal.
Installation
Install the osc binary directly from the Bixority Codeberg crate registry with Cargo. Point Cargo at the registry with an environment variable, then install:
export CARGO_REGISTRIES_BIXORITY_INDEX="sparse+https://codeberg.org/api/packages/bixority/cargo/"
cargo install object-storage-client --registry bixority
Alternatively, install straight from Git:
cargo install --git https://codeberg.org/bixority/object-storage-client
Or, if you have the source code, install it from the local checkout:
cargo install --path .
Examples
-
Upload a local file:
osc put my_file.txt s3://my-bucket/remote_file.txt
-
Download an object:
osc get gs://my-bucket/data.json ./local_data.json
-
Copy between providers:
osc cp s3://source-bucket/image.png az://dest-container/image.png
-
Move an object:
osc mv s3://my-bucket/old_name.txt s3://my-bucket/new_name.txt
-
List objects:
osc ls s3://my-bucket/logs/
-
Delete an object:
osc rm s3://my-bucket/temp_file.tmp
-
Stream an object:
osc get-stream gs://my-bucket/large_file.bin
-
Generate a pre-signed URL (S3, GCS, Azure):
# Pre-signed download URL, valid for the default 1 hour osc sign s3://my-bucket/report.pdf # Pre-signed upload URL (PUT), valid for 15 minutes osc sign --method PUT --expires-in 900 s3://my-bucket/upload.bin # Pre-signed upload URL binding the exact size and type the client must send # (S3 only): the upload is rejected unless Content-Length and Content-Type # match, so the object store enforces size/type up front. osc sign --method PUT --content-length 1048576 \ --content-type application/pdf s3://my-bucket/upload.pdf
Rust Usage
Installation
The crate is published to the Bixority Codeberg crate registry. Point Cargo at the registry with an environment variable:
export CARGO_REGISTRIES_BIXORITY_INDEX="sparse+https://codeberg.org/api/packages/bixority/cargo/"
Then add object-storage-client to your Cargo.toml:
[dependencies]
object-storage-client = { version = "0.0.31", registry = "bixority" }
tokio = { version = "1.0", features = ["full"] }
Alternatively, you can depend on it directly from Git:
[dependencies]
object-storage-client = { git = "https://codeberg.org/bixority/object-storage-client" }
tokio = { version = "1.0", features = ["full"] }
Example
use object_storage_client::ObjectStorageClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = ObjectStorageClient::new();
// Upload data
let data = b"Hello from Rust!";
client.put("s3://my-bucket/hello.txt", &data).await?;
// Download data
let retrieved = client.get("s3://my-bucket/hello.txt").await?;
println!("Retrieved: {:?}", String::from_utf8(retrieved.to_vec())?);
// Cross-provider copy (S3 to Local)
client.copy("s3://my-bucket/hello.txt", "file:///tmp/hello_local.txt").await?;
// Pre-signed URL: time-limited, credential-free access (S3/GCS/Azure)
use object_storage_client::{SignMethod, SignOptions};
use std::time::Duration;
// Pre-signed download (GET) link, valid for one hour
let download_url = client
.get_pre_signed_url(
"s3://my-bucket/hello.txt",
SignMethod::Get,
Duration::from_secs(3600),
&SignOptions::default(),
)
.await?;
println!("Share this download link: {download_url}");
// Pre-signed upload (PUT) link binding the exact size and type the client
// must send (S3 only); the store rejects mismatched uploads up front.
let upload_url = client
.get_pre_signed_url(
"s3://my-bucket/upload.bin",
SignMethod::Put,
Duration::from_secs(900),
&SignOptions {
content_length: Some(1_048_576),
content_type: Some("application/octet-stream".to_string()),
},
)
.await?;
println!("Upload directly to: {upload_url}");
Ok(())
}
Python 3.13+ Usage
Installation
The package is published on PyPI. Note that it requires Python 3.13+.
pip install object-storage-client
Or if you are developing locally, you can use maturin:
maturin develop
Example
import asyncio
from object_storage_client import ObjectStorageClient
async def main():
client = ObjectStorageClient()
# Upload data
await client.put_object("s3://my-bucket/python_test.txt", b"Hello from Python!")
# Download data
data = await client.get_object("s3://my-bucket/python_test.txt")
print(f"Retrieved: {data.decode()}")
# List objects
items = await client.list_objects("s3://my-bucket/")
print(f"Bucket items: {items}")
# Stream data
stream = await client.get_object_stream("s3://my-bucket/python_test.txt")
async for chunk in stream:
print(f"Chunk size: {len(chunk)}")
# Cross-provider move (GCS to S3)
await client.move_object("gs://my-gcs-bucket/data.csv", "s3://my-s3-bucket/data.csv")
# Pre-signed URL (S3/GCS/Azure): hand out credential-free, time-limited access
download_url = await client.get_pre_signed_url("s3://my-bucket/python_test.txt")
# Bind the exact Content-Length and Content-Type the client must send (S3
# only); the store rejects uploads that don't match.
upload_url = await client.get_pre_signed_url(
"s3://my-bucket/upload.bin",
method="PUT",
expires_in_secs=900,
content_length=1_048_576,
content_type="application/octet-stream",
)
print(f"Download: {download_url}\nUpload: {upload_url}")
if __name__ == "__main__":
asyncio.run(main())
Developer Instructions
Prerequisites
- Rust 1.85+ (or latest stable)
- Python 3.13+
maturin(for Python bindings)
Building
- Rust:
cargo build --release - Python:
maturin build --release - CLI:
cargo build --bin osc
Testing
cargo test
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 Distributions
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 object_storage_client-0.0.32.tar.gz.
File metadata
- Download URL: object_storage_client-0.0.32.tar.gz
- Upload date:
- Size: 54.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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 |
80809c69ac091d4b3a4eb96f2cef2117ada942410ba3130d1de3429acaf91407
|
|
| MD5 |
f34403f4269e55f35d57127d7fc165f0
|
|
| BLAKE2b-256 |
5a87b510aeb99d3a691d779d880eb5ad5390555703c711e1efb8a3fae826a5f8
|
File details
Details for the file object_storage_client-0.0.32-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: object_storage_client-0.0.32-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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 |
0875c4a619ff7ad386a14936683f270eaeb155bc70863185461e37a12b2b988a
|
|
| MD5 |
7c79cb3048f1830e09241807ab5bc56f
|
|
| BLAKE2b-256 |
d658fe724140d0858e117fb173cc048511d0470c6a8da81108afedc1803ba223
|
File details
Details for the file object_storage_client-0.0.32-cp314-cp314-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: object_storage_client-0.0.32-cp314-cp314-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.14, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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 |
87e365d052b96ad635bc33f9265b3e04256576134346d7de11daa1baa3d80ab2
|
|
| MD5 |
2c7fa26b5b08aa6879ebfc1c3eedea28
|
|
| BLAKE2b-256 |
5f905573da551de8e2e220aa52aeb76346bcf6aa588725e53d4ef132ee580b27
|
File details
Details for the file object_storage_client-0.0.32-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: object_storage_client-0.0.32-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.14, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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 |
f1803bd864ef480196d85bff3bf8835f833b10e2ca67374b856bcb2f6e8c6c03
|
|
| MD5 |
5a4b96da3899f4903ad56aef392a8284
|
|
| BLAKE2b-256 |
0b9ef37e6b3312b047eaf848f221c5530e1bf58ffa4ef2419ac7b78bf40cebfd
|
File details
Details for the file object_storage_client-0.0.32-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: object_storage_client-0.0.32-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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 |
f22c2bfe40d3891dc5aaa96366596308f47a120536624d3fbfb0808e98455656
|
|
| MD5 |
9528ae0db5a26562fe6e9756b851abec
|
|
| BLAKE2b-256 |
b0876cedf83e84e8a2d1afb53a65131b6e5f1ddfb565afa1b67aad784bdaa2e8
|
File details
Details for the file object_storage_client-0.0.32-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: object_storage_client-0.0.32-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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 |
998785764597d3309454090d07d53bd9f2cf251a212fc7951be4f6cb89832e89
|
|
| MD5 |
9cbb2f2ae74de911f68dfbc60ad75d19
|
|
| BLAKE2b-256 |
a4774fe2cc78169320a47abedadf55f7e18dd0b25b1919744ff8eb9c879ae521
|
File details
Details for the file object_storage_client-0.0.32-cp313-cp313-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: object_storage_client-0.0.32-cp313-cp313-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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 |
69946e83ec090768638905da9453c9ba8c94f99b15e4ab58f194dbd626440f21
|
|
| MD5 |
57e26ced5d993c1068bdd5e8480f33ff
|
|
| BLAKE2b-256 |
f9a72db6bc65c29f0405c1dc3091a1ac6900e38997d5db72dd8889ed93a7ce8b
|
File details
Details for the file object_storage_client-0.0.32-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: object_storage_client-0.0.32-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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 |
15b22de0ffb73240933a6166006f5f3bb5badfdfda304d6482b1810b7771f5bc
|
|
| MD5 |
8be8965316a0a7706aff3efc32e55f7e
|
|
| BLAKE2b-256 |
5e38a182dca33d967e053719ad840a13e50e036a581df15d572781719f98786e
|
File details
Details for the file object_storage_client-0.0.32-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: object_storage_client-0.0.32-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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 |
d8eb3900b2107c6d249281ea4a13f9563e9ebe89c75d5e63513fd9bc07989920
|
|
| MD5 |
7c59925c30d804b5bf21e0b709b9a159
|
|
| BLAKE2b-256 |
129550676a7c738e27e94177ab8c53dacd748ce7964cac5b5bdf21ac4c1cf2dc
|