Introduction
Aleph BlobStorage provides a unified interface for versioned blob storage across multiple backends, including local filesystem and Azure Blob Storage. It supports hierarchical paths, content-based versioning, metadata tagging, and robust lifecycle management for data assets.
Installation
pip
pip install git+https://github.com/AlephTechAi/aleph_blobstorage.git
# Particular release
pip install git+https://github.com/AlephTechAi/aleph_blobstorage.git@0.1.0
poetry
[tool.poetry.dependencies]
aleph_blobstorage = {git = "https://github.com/AlephTechAi/aleph_blobstorage.git"}
# Particular release
aleph_blobstorage = {git = "https://github.com/AlephTechAi/aleph_blobstorage.git", rev = "0.1.0"}
uv
uv pip install --git https://github.com/AlephTechAi/aleph_blobstorage.git
# Particular release
uv pip install --git https://github.com/AlephTechAi/aleph_blobstorage.git@0.1.0
Code Organization
The codebase follows a port-and-adapter architecture:
Port (Abstract Interface): Defines the generic blob storage operations and domain models. See aleph_blobstorage/ports.py.
Adapters: Implement backend-specific logic for local filesystem (LocalFilesystemAdaptor) and Azure (AzureBlobAdaptor). See aleph_blobstorage/adapters.py
Entities & Value Objects: Pydantic models for blob URIs, metadata, and lifecycle management. Tests: Comprehensive pytest suite for both adaptors in tests/. See aleph_blobstorage/valueobjects.py and aleph_blobstorage/entities.py
As you will see below, the main way for interacting with a blob is through the VOBlobURI object.
Usage Examples
Azure Blob Storage
from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient
from aleph_blobstorage.adapters import AzureBlobAdaptor
from aleph_blobstorage.valueobjects import VOBlobURI
# Initialize adapter
account_name = "teststorageaccount"
container_name = "testcontainer"
credentials = DefaultAzureCredential()
blob_client = BlobServiceClient(account_url=f"https://{account_name}.blob.core.windows.net", credential=credentials)
storage = AzureBlobAdaptor(container_name="testazureblobstorage3",blob_client=blob_client)
# Upload file to blob
source_path = Path() / "local_folder/test.py"
blob_uri = VOBlobURI(logical_path="test_folder", logical_name="test.py")
storage.upload_from_file(destination=blob_uri, source_path=source_path)
# Download blob to file
destination_path = Path() / "local_folder/download.py"
storage.download_to_file(source=blob_uri, destination_path=destination_path)
# Delete blob
storage.delete(blob_uri)
# Restore deleted blob
storage.restore(blob_uri)
Dependencies
Python 3.8+
pydanticpytestazure-storage-blobazure-identity
Cloud Credentials
- Azure: Storage Account connection string, or be logged into Azure CLI with your user identity having "Storage Blob Data Owner" role assignment.
Release files for aleph-blobstorage 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aleph_blobstorage-0.1.0.tar.gz | 82.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aleph_blobstorage-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 110.4 kB
Release files / aleph_blobstorage-0.1.0.tar.gz
| Download URL | aleph_blobstorage-0.1.0.tar.gz |
|---|---|
| Size | 82.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0bf0cdbdea78b3815dd63e6c30f4d8dae352c761be2de37bb70a149cc70c31e
|
|
BLAKE2b-256 checksum How to use checksums |
df3736f30d2b5b12b301f7881dbc381ebb745fb9ba29cb61ba9d9cd9215a8185
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / aleph_blobstorage-0.1.0-py3-none-any.whl
| Download URL | aleph_blobstorage-0.1.0-py3-none-any.whl |
|---|---|
| Size | 27.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1cb65e38d2fd61267f962b9bf954469c96f8d71240b47c2c6ec38cb9c562bfd9
|
|
BLAKE2b-256 checksum How to use checksums |
311a5aa8035bb86350bce4273cc675bb22ffd9cb614a5dce21ea377c7937edbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|